diff --git a/.gitignore b/.gitignore index b114926..ef40c2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,15 @@ *.slo *.lo *.o +*~ + +Makefile +av/av +source/av_ffi_header.cpp +CMakeCache.txt +CMakeFiles/ +cmake_install.cmake + *.lai *.la @@ -18,4 +27,13 @@ *.perspectivev3 *.xcuserdatad -build \ No newline at end of file +build +.ninja_deps +.ninja_log +build.ninja +rules.ninja +CMakeScripts/ +av.build/ +av.xcodeproj/ +source/Debug/ + diff --git a/.gitmodules b/.gitmodules index 15618bd..46be153 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ -[submodule "src/luajit-2.0"] - path = src/luajit-2.0 - url = http://luajit.org/git/luajit-2.0.git -[submodule "src/hidapi"] - path = src/hidapi - url = git://github.com/signal11/hidapi.git +[submodule "Penlight"] + path = Penlight + url = https://github.com/stevedonovan/Penlight.git +[submodule "LDoc"] + path = LDoc + url = https://github.com/stevedonovan/LDoc.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8ef3f2a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 2.8) + +project(av) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) +set(CMAKE_BUILD_TYPE Release) + +# do if/else to fix this on some platforms... +set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -pagezero_size 10000 -image_base 100000000") + +find_package(LuaJIT REQUIRED) +find_package(OpenGL REQUIRED) +find_package(GLFW REQUIRED) + +# generate embedded script .cpp (aka av_ffi_header). check "result" variable if desired. +# +execute_process( + COMMAND luajit h2ffi.lua av.h av_ffi_header + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/source + RESULT_VARIABLE result +) + +set(SOURCES + ${CMAKE_SOURCE_DIR}/source/av.cpp + ${CMAKE_SOURCE_DIR}/source/av_audio.cpp + ${CMAKE_SOURCE_DIR}/source/RtAudio.cpp +) + +set(INCLUDE_DIRS + ${LUAJIT_INCLUDE_DIR} + ${OPENGL_INCLUDE_DIR} + ${GLFW_INCLUDE_DIR} +) +include_directories(${INCLUDE_DIRS}) + +set(LINK_LIBRARIES + ${LUAJIT_LIBRARIES} + ${GLFW_LIBRARY} + ${OPENGL_LIBRARY} +) + +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/av) +add_executable(${CMAKE_PROJECT_NAME} ${SOURCES}) +target_link_libraries(${CMAKE_PROJECT_NAME} ${LINK_LIBRARIES}) diff --git a/LDoc b/LDoc new file mode 160000 index 0000000..52e9b6f --- /dev/null +++ b/LDoc @@ -0,0 +1 @@ +Subproject commit 52e9b6f32c06f10f8a8c4353fa53161e95ac141f diff --git a/Penlight b/Penlight new file mode 160000 index 0000000..e7eebbf --- /dev/null +++ b/Penlight @@ -0,0 +1 @@ +Subproject commit e7eebbf9e843d55a24bd8eb24ab2d1c17e6acfbf diff --git a/av.exe b/av.exe deleted file mode 100644 index 7818d78..0000000 Binary files a/av.exe and /dev/null differ diff --git a/src/include/glm/gtx/ocl_type.inl b/av.lua old mode 100755 new mode 100644 similarity index 100% rename from src/include/glm/gtx/ocl_type.inl rename to av.lua diff --git a/modules/allosphere.lua b/av/modules/allosphere.lua similarity index 100% rename from modules/allosphere.lua rename to av/modules/allosphere.lua diff --git a/modules/audio.lua b/av/modules/audio.lua similarity index 100% rename from modules/audio.lua rename to av/modules/audio.lua diff --git a/modules/audioprocess.lua b/av/modules/audioprocess.lua similarity index 100% rename from modules/audioprocess.lua rename to av/modules/audioprocess.lua diff --git a/modules/cubefbo.lua b/av/modules/cubefbo.lua similarity index 100% rename from modules/cubefbo.lua rename to av/modules/cubefbo.lua diff --git a/modules/displaylist.lua b/av/modules/displaylist.lua similarity index 100% rename from modules/displaylist.lua rename to av/modules/displaylist.lua diff --git a/modules/draw2D.lua b/av/modules/draw2D.lua similarity index 100% rename from modules/draw2D.lua rename to av/modules/draw2D.lua diff --git a/modules/draw3D.lua b/av/modules/draw3D.lua similarity index 100% rename from modules/draw3D.lua rename to av/modules/draw3D.lua diff --git a/modules/fbo.lua b/av/modules/fbo.lua similarity index 100% rename from modules/fbo.lua rename to av/modules/fbo.lua diff --git a/modules/ffiffy.lua b/av/modules/ffiffy.lua similarity index 100% rename from modules/ffiffy.lua rename to av/modules/ffiffy.lua diff --git a/modules/field2D.lua b/av/modules/field2D.lua similarity index 100% rename from modules/field2D.lua rename to av/modules/field2D.lua diff --git a/modules/field3D.lua b/av/modules/field3D.lua similarity index 100% rename from modules/field3D.lua rename to av/modules/field3D.lua diff --git a/modules/freeimage.lua b/av/modules/freeimage.lua similarity index 100% rename from modules/freeimage.lua rename to av/modules/freeimage.lua diff --git a/modules/freenect.lua b/av/modules/freenect.lua similarity index 100% rename from modules/freenect.lua rename to av/modules/freenect.lua diff --git a/modules/gl.lua b/av/modules/gl.lua similarity index 100% rename from modules/gl.lua rename to av/modules/gl.lua diff --git a/modules/glfw.lua b/av/modules/glfw.lua old mode 100755 new mode 100644 similarity index 100% rename from modules/glfw.lua rename to av/modules/glfw.lua diff --git a/modules/glfw3.lua b/av/modules/glfw3.lua old mode 100755 new mode 100644 similarity index 100% rename from modules/glfw3.lua rename to av/modules/glfw3.lua diff --git a/modules/glu.lua b/av/modules/glu.lua similarity index 100% rename from modules/glu.lua rename to av/modules/glu.lua diff --git a/modules/io.lua b/av/modules/io.lua similarity index 100% rename from modules/io.lua rename to av/modules/io.lua diff --git a/modules/lua.lua b/av/modules/lua.lua similarity index 100% rename from modules/lua.lua rename to av/modules/lua.lua diff --git a/modules/mat4.lua b/av/modules/mat4.lua similarity index 100% rename from modules/mat4.lua rename to av/modules/mat4.lua diff --git a/modules/math.lua b/av/modules/math.lua similarity index 100% rename from modules/math.lua rename to av/modules/math.lua diff --git a/modules/mesh.lua b/av/modules/mesh.lua similarity index 100% rename from modules/mesh.lua rename to av/modules/mesh.lua diff --git a/modules/nav3.lua b/av/modules/nav3.lua similarity index 100% rename from modules/nav3.lua rename to av/modules/nav3.lua diff --git a/modules/os.lua b/av/modules/os.lua similarity index 100% rename from modules/os.lua rename to av/modules/os.lua diff --git a/modules/png.lua b/av/modules/png.lua old mode 100755 new mode 100644 similarity index 100% rename from modules/png.lua rename to av/modules/png.lua diff --git a/modules/portaudio_h.lua b/av/modules/portaudio_h.lua similarity index 100% rename from modules/portaudio_h.lua rename to av/modules/portaudio_h.lua diff --git a/modules/quat.lua b/av/modules/quat.lua similarity index 100% rename from modules/quat.lua rename to av/modules/quat.lua diff --git a/modules/re.lua b/av/modules/re.lua similarity index 100% rename from modules/re.lua rename to av/modules/re.lua diff --git a/modules/rgbd.lua b/av/modules/rgbd.lua similarity index 100% rename from modules/rgbd.lua rename to av/modules/rgbd.lua diff --git a/modules/scheduler.lua b/av/modules/scheduler.lua similarity index 100% rename from modules/scheduler.lua rename to av/modules/scheduler.lua diff --git a/modules/sdl.lua b/av/modules/sdl.lua similarity index 100% rename from modules/sdl.lua rename to av/modules/sdl.lua diff --git a/modules/shader.lua b/av/modules/shader.lua similarity index 100% rename from modules/shader.lua rename to av/modules/shader.lua diff --git a/modules/string.lua b/av/modules/string.lua similarity index 100% rename from modules/string.lua rename to av/modules/string.lua diff --git a/modules/table.lua b/av/modules/table.lua similarity index 100% rename from modules/table.lua rename to av/modules/table.lua diff --git a/modules/texture.lua b/av/modules/texture.lua similarity index 100% rename from modules/texture.lua rename to av/modules/texture.lua diff --git a/modules/util.lua b/av/modules/util.lua similarity index 100% rename from modules/util.lua rename to av/modules/util.lua diff --git a/modules/vec2.lua b/av/modules/vec2.lua similarity index 100% rename from modules/vec2.lua rename to av/modules/vec2.lua diff --git a/modules/vec3.lua b/av/modules/vec3.lua similarity index 100% rename from modules/vec3.lua rename to av/modules/vec3.lua diff --git a/modules/vec4.lua b/av/modules/vec4.lua similarity index 100% rename from modules/vec4.lua rename to av/modules/vec4.lua diff --git a/modules/window.lua b/av/modules/window.lua similarity index 100% rename from modules/window.lua rename to av/modules/window.lua diff --git a/av_linux b/av_linux deleted file mode 100755 index b070634..0000000 Binary files a/av_linux and /dev/null differ diff --git a/av_osx b/av_osx deleted file mode 100755 index bc07af6..0000000 Binary files a/av_osx and /dev/null differ diff --git a/cmake/FindGLFW.cmake b/cmake/FindGLFW.cmake new file mode 100644 index 0000000..66491d0 --- /dev/null +++ b/cmake/FindGLFW.cmake @@ -0,0 +1,70 @@ +# Locate the glfw library +# This module defines the following variables: +# GLFW_LIBRARY, the name of the library; +# GLFW_INCLUDE_DIR, where to find glfw include files. +# GLFW_FOUND, true if both the GLFW_LIBRARY and GLFW_INCLUDE_DIR have been found. +# +# To help locate the library and include file, you could define an environment variable called +# GLFW_ROOT which points to the root of the glfw library installation. This is pretty useful +# on a Windows platform. +# +# +# Usage example to compile an "executable" target to the glfw library: +# +# FIND_PACKAGE (glfw REQUIRED) +# INCLUDE_DIRECTORIES (${GLFW_INCLUDE_DIR}) +# ADD_EXECUTABLE (executable ${EXECUTABLE_SRCS}) +# TARGET_LINK_LIBRARIES (executable ${GLFW_LIBRARY}) +# +# TODO: +# Allow the user to select to link to a shared library or to a static library. + +#Search for the include file... +FIND_PATH(GLFW_INCLUDE_DIR GL/glfw.h DOC "Path to GLFW include directory." + HINTS + $ENV{GLFW_ROOT} + PATH_SUFFIX include + PATHS + /usr/include/ + /usr/local/include/ + # By default headers are under GL subfolder + /usr/include/GL + /usr/local/include/GL + ${GLFW_ROOT_DIR}/include/ # added by ptr +) + +FIND_LIBRARY(GLFW_LIBRARY_TEMP DOC "Absolute path to GLFW library." + NAMES glfw GLFW.lib + HINTS + $ENV{GLFW_ROOT} + # In the expanded GLFW source archive. Should be uncommon, but whatever. + PATH_SUFFIXES lib/win32 lib/cocoa lib/x11 + PATHS + /usr/local/lib + /usr/lib + ${GLFW_ROOT_DIR}/lib-msvc100/release # added by ptr +) + +SET(GLFW_FOUND "NO") +IF(GLFW_LIBRARY_TEMP AND GLFW_INCLUDE_DIR) + SET(GLFW_FOUND "YES") + message(STATUS "Found GLFW: ${GLFW_LIBRARY_TEMP}") + + # For MinGW library + IF(MINGW) + SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") + SET(GLFW_LIBRARY_TEMP ${MINGW32_LIBRARY} ${GLFW_LIBRARY_TEMP}) + ENDIF(MINGW) + + # OS X uses the Cocoa port so we need to link against Cocoa + IF(APPLE) + SET(GLFW_LIBRARY_TEMP ${GLFW_LIBRARY_TEMP} "-framework Cocoa -framework IOKit") + SET(GLFW_LIBRARY ${GLFW_LIBRARY_TEMP}) + ENDIF(APPLE) + + # Set the final string here so the GUI reflects the final state. + SET(GLFW_LIBRARY ${GLFW_LIBRARY_TEMP} CACHE STRING "Where the GLFW Library can be found") + # Set the temp variable to INTERNAL so it is not seen in the CMake GUI + SET(GLFW_LIBRARY_TEMP "" CACHE INTERNAL "") +ENDIF(GLFW_LIBRARY_TEMP AND GLFW_INCLUDE_DIR) + diff --git a/cmake/FindGLUT.cmake b/cmake/FindGLUT.cmake new file mode 100644 index 0000000..9452e60 --- /dev/null +++ b/cmake/FindGLUT.cmake @@ -0,0 +1,92 @@ +# - try to find glut library and include files +# GLUT_INCLUDE_DIR, where to find GL/glut.h, etc. +# GLUT_LIBRARIES, the libraries to link against +# GLUT_FOUND, If false, do not try to use GLUT. +# Also defined, but not for general use are: +# GLUT_glut_LIBRARY = the full path to the glut library. +# GLUT_Xmu_LIBRARY = the full path to the Xmu library. +# GLUT_Xi_LIBRARY = the full path to the Xi Library. + +#============================================================================= +# Copyright 2001-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +IF (WIN32) + FIND_PATH( GLUT_INCLUDE_DIR NAMES GL/glut.h + PATHS ${GLUT_ROOT_PATH}/include ) + FIND_LIBRARY( GLUT_glut_LIBRARY NAMES glut glut32 + PATHS + ${OPENGL_LIBRARY_DIR} + ${GLUT_ROOT_PATH}/Release + ) +ELSE (WIN32) + + IF (APPLE) + # These values for Apple could probably do with improvement. + FIND_PATH( GLUT_INCLUDE_DIR glut.h + /System/Library/Frameworks/GLUT.framework/Versions/A/Headers + ${OPENGL_LIBRARY_DIR} + ) + SET(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX") + SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") + ELSE (APPLE) + + FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h + /usr/include/GL + /usr/openwin/share/include + /usr/openwin/include + /opt/graphics/OpenGL/include + /opt/graphics/OpenGL/contrib/libglut + ) + + FIND_LIBRARY( GLUT_glut_LIBRARY glut + /usr/openwin/lib + ) + +# FIND_LIBRARY( GLUT_Xi_LIBRARY Xi +# /usr/openwin/lib +# ) + +# FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu +# /usr/openwin/lib +# ) + + ENDIF (APPLE) + +ENDIF (WIN32) + +SET( GLUT_FOUND "NO" ) +IF(GLUT_INCLUDE_DIR) + IF(GLUT_glut_LIBRARY) + # Is -lXi and -lXmu required on all platforms that have it? + # If not, we need some way to figure out what platform we are on. + SET( GLUT_LIBRARIES + ${GLUT_glut_LIBRARY} + ${GLUT_Xmu_LIBRARY} + ${GLUT_Xi_LIBRARY} + ${GLUT_cocoa_LIBRARY} + ) + SET( GLUT_FOUND "YES" ) + + #The following deprecated settings are for backwards compatibility with CMake1.4 + SET (GLUT_LIBRARY ${GLUT_LIBRARIES}) + SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) + + ENDIF(GLUT_glut_LIBRARY) +ENDIF(GLUT_INCLUDE_DIR) + +MARK_AS_ADVANCED( + GLUT_INCLUDE_DIR + GLUT_glut_LIBRARY +# GLUT_Xmu_LIBRARY +# GLUT_Xi_LIBRARY + ) diff --git a/cmake/FindLuaJIT.cmake b/cmake/FindLuaJIT.cmake new file mode 100644 index 0000000..218a3a0 --- /dev/null +++ b/cmake/FindLuaJIT.cmake @@ -0,0 +1,78 @@ +# Locate Lua library +# This module defines +# LUAJIT_FOUND, if false, do not try to link to Lua +# LUAJIT_LIBRARIES +# LUAJIT_INCLUDE_DIR, where to find lua.h +# +# Note that the expected include convention is +# #include "lua.h" +# and not +# #include +# This is because, the lua location is not standardized and may exist +# in locations other than lua/ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) +# +# ################ +# 2010 - modified for cronkite to find luajit instead of lua, as it was before. +# + +FIND_PATH(LUAJIT_INCLUDE_DIR lua.h + HINTS + $ENV{LUAJIT_DIR} + PATH_SUFFIXES include/luajit-2.0 include/luajit2.0 include/luajit include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +FIND_LIBRARY(LUAJIT_LIBRARY + NAMES luajit-51 luajit-5.1 luajit + HINTS + $ENV{LUAJIT_DIR} + PATH_SUFFIXES lib64 lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt +) + +IF(LUAJIT_LIBRARY) + # include the math library for Unix + IF(UNIX AND NOT APPLE) + FIND_LIBRARY(LUAJIT_MATH_LIBRARY m) + SET( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries") + # For Windows and Mac, don't need to explicitly include the math library + ELSE(UNIX AND NOT APPLE) + SET( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries") + ENDIF(UNIX AND NOT APPLE) +ENDIF(LUAJIT_LIBRARY) + +INCLUDE(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT DEFAULT_MSG LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR) + +MARK_AS_ADVANCED(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY) diff --git a/distclean b/distclean new file mode 100755 index 0000000..2f83719 --- /dev/null +++ b/distclean @@ -0,0 +1,12 @@ +rm -rf CMakeCache.txt cmake_install.cmake CMakeFiles/ CMakeScripts/ +rm -rf av/av +rm -rf Makefile +rm -rf .ninja_deps +rm -rf .ninja_log +rm -rf build.ninja +rm -rf rules.ninja +rm -rf CMakeScripts/ +rm -rf av.build/ +rm -rf av.xcodeproj/ +rm -rf source/Debug/ + diff --git a/docs/ldoc.css b/docs/ldoc.css deleted file mode 100644 index 54f8d4c..0000000 --- a/docs/ldoc.css +++ /dev/null @@ -1,297 +0,0 @@ -/* BEGIN RESET - -Copyright (c) 2010, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.com/yui/license.html -version: 2.8.2r1 -*/ -html { - color: #000; - background: #FFF; -} -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { - margin: 0; - padding: 0; -} -table { - border-collapse: collapse; - border-spacing: 0; -} -fieldset,img { - border: 0; -} -address,caption,cite,code,dfn,em,strong,th,var,optgroup { - font-style: inherit; - font-weight: inherit; -} -del,ins { - text-decoration: none; -} -li { - list-style: bullet; - margin-left: 20px; -} -caption,th { - text-align: left; -} -h1,h2,h3,h4,h5,h6 { - font-size: 100%; - font-weight: bold; -} -q:before,q:after { - content: ''; -} -abbr,acronym { - border: 0; - font-variant: normal; -} -sup { - vertical-align: baseline; -} -sub { - vertical-align: baseline; -} -legend { - color: #000; -} -input,button,textarea,select,optgroup,option { - font-family: inherit; - font-size: inherit; - font-style: inherit; - font-weight: inherit; -} -input,button,textarea,select {*font-size:100%; -} -/* END RESET */ - -body { - margin-left: 1em; - margin-right: 1em; - font-family: arial, helvetica, geneva, sans-serif; - background-color: #ffffff; margin: 0px; -} - -code, tt { font-family: monospace; } -span.parameter { font-family:monospace; } -span.parameter:after { content:":"; } -span.types:before { content:"("; } -span.types:after { content:")"; } -.type { font-weight: bold; font-style:italic } - -body, p, td, th { font-size: .95em; line-height: 1.2em;} - -p, ul { margin: 10px 0 0 0px;} - -strong { font-weight: bold;} - -em { font-style: italic;} - -h1 { - font-size: 1.5em; - margin: 0 0 20px 0; -} -h2, h3, h4 { margin: 15px 0 10px 0; } -h2 { font-size: 1.25em; } -h3 { font-size: 1.15em; } -h4 { font-size: 1.06em; } - -a:link { font-weight: bold; color: #004080; text-decoration: none; } -a:visited { font-weight: bold; color: #006699; text-decoration: none; } -a:link:hover { text-decoration: underline; } - -hr { - color:#cccccc; - background: #00007f; - height: 1px; -} - -blockquote { margin-left: 3em; } - -ul { list-style-type: disc; } - -p.name { - font-family: "Andale Mono", monospace; - padding-top: 1em; -} - -pre.example { - background-color: rgb(245, 245, 245); - border: 1px solid silver; - padding: 10px; - margin: 10px 0 10px 0; - font-family: "Andale Mono", monospace; - font-size: .85em; -} - -pre { - background-color: rgb(245, 245, 245); - border: 1px solid silver; - padding: 10px; - margin: 10px 0 10px 0; - overflow: auto; - font-family: "Andale Mono", monospace; -} - - -table.index { border: 1px #00007f; } -table.index td { text-align: left; vertical-align: top; } - -#container { - margin-left: 1em; - margin-right: 1em; - background-color: #f0f0f0; -} - -#product { - text-align: center; - border-bottom: 1px solid #cccccc; - background-color: #ffffff; -} - -#product big { - font-size: 2em; -} - -#main { - background-color: #f0f0f0; - border-left: 2px solid #cccccc; -} - -#navigation { - float: left; - width: 18em; - vertical-align: top; - background-color: #f0f0f0; - overflow: visible; -} - -#navigation h2 { - background-color:#e7e7e7; - font-size:1.1em; - color:#000000; - text-align: left; - padding:0.2em; - border-top:1px solid #dddddd; - border-bottom:1px solid #dddddd; -} - -#navigation ul -{ - font-size:1em; - list-style-type: none; - margin: 1px 1px 10px 1px; -} - -#navigation li { - text-indent: -1em; - display: block; - margin: 3px 0px 0px 22px; -} - -#navigation li li a { - margin: 0px 3px 0px -1em; -} - -#content { - margin-left: 18em; - padding: 1em; - width: 700px; - border-left: 2px solid #cccccc; - border-right: 2px solid #cccccc; - background-color: #ffffff; -} - -#about { - clear: both; - padding: 5px; - border-top: 2px solid #cccccc; - background-color: #ffffff; -} - -@media print { - body { - font: 12pt "Times New Roman", "TimeNR", Times, serif; - } - a { font-weight: bold; color: #004080; text-decoration: underline; } - - #main { - background-color: #ffffff; - border-left: 0px; - } - - #container { - margin-left: 2%; - margin-right: 2%; - background-color: #ffffff; - } - - #content { - padding: 1em; - background-color: #ffffff; - } - - #navigation { - display: none; - } - pre.example { - font-family: "Andale Mono", monospace; - font-size: 10pt; - page-break-inside: avoid; - } -} - -table.module_list { - border-width: 1px; - border-style: solid; - border-color: #cccccc; - border-collapse: collapse; -} -table.module_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #cccccc; -} -table.module_list td.name { background-color: #f0f0f0; ; min-width: 200px; } -table.module_list td.summary { width: 100%; } - - -table.function_list { - border-width: 1px; - border-style: solid; - border-color: #cccccc; - border-collapse: collapse; -} -table.function_list td { - border-width: 1px; - padding: 3px; - border-style: solid; - border-color: #cccccc; -} -table.function_list td.name { background-color: #f0f0f0; ; min-width: 200px; } -table.function_list td.summary { width: 100%; } - -dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} -dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} -dl.table h3, dl.function h3 {font-size: .95em;} - -/* stop sublists from having initial vertical space */ -ul ul { margin-top: 0px; } -ol ul { margin-top: 0px; } -ol ol { margin-top: 0px; } -ul ol { margin-top: 0px; } - -/* styles for prettification of source */ -pre .comment { color: #558817; } -pre .constant { color: #a8660d; } -pre .escape { color: #844631; } -pre .keyword { color: #2239a8; font-weight: bold; } -pre .library { color: #0e7c6b; } -pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } -pre .string { color: #a8660d; } -pre .number { color: #f8660d; } -pre .operator { color: #2239a8; font-weight: bold; } -pre .preprocessor, pre .prepro { color: #a33243; } -pre .global { color: #800080; } -pre .prompt { color: #558817; } -pre .url { color: #272fc2; text-decoration: underline; } diff --git a/docs/modules/allosphere.html b/docs/modules/allosphere.html deleted file mode 100644 index 4be3eb5..0000000 --- a/docs/modules/allosphere.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module allosphere

- -

allosphere: Utilities relating specifically to the AlloSphere

-

- - -

Fields

- - - - - -
e[[ - the caps:
- -
-
- - -

Fields

-
-
- - e -
-
- [[ - the caps: - - - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/audio.html b/docs/modules/audio.html deleted file mode 100644 index 5326ed7..0000000 --- a/docs/modules/audio.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module audio

- -

audio: accessing the audio system

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/audioprocess.html b/docs/modules/audioprocess.html deleted file mode 100644 index b907e25..0000000 --- a/docs/modules/audioprocess.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module audioprocess

- -

audioprocess: (audio thread internal use only)

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/displaylist.html b/docs/modules/displaylist.html deleted file mode 100644 index 51b0fc7..0000000 --- a/docs/modules/displaylist.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module displaylist

- -

displaylist: A friendly wrapper for OpenGL display lists

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/draw2D.html b/docs/modules/draw2D.html deleted file mode 100644 index f491ec5..0000000 --- a/docs/modules/draw2D.html +++ /dev/null @@ -1,402 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module draw2D

- -

Draw2D: simple drawing primitives for 2D graphics

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
push ()Store the current transformation until the next pop() - Caches the current transform matrix into the matrix stack, and pushes a new copy of the matrix onto the top.
pop ()Restore the transformation from the previous push() - Discards the current transformation matrix and restores the previous matrix from the matrix stack.
translate (x, y)Move the coordinate system origin to x, y - (modifies the transformation matrix)
scale (x, y)Scale the coordinate system - (modifies the transformation matrix)
rotate (a)Rotate the coordinate system around the origin - (modifies the transformation matrix)
point (x, y)Draw a point at position x,y
line (x1, y1, x2, y2)Draw a line from x1,y1 to x2,y2
rect (x, y, w, h)Draw a rectangle at the point (x, y) with width w and height h
ellipse (x, y, w, h)Draw an ellipse at the point (x, y) with horizontal diameter w and vertical diameter h
circle (x, y, d)Draw an ellipse at the point (x, y) with horizontal diameter d
arc (x, y, s, e, w, h)Draw an arc at the point (x, y) with horizontal diameter d
color (red, green, blue, alpha)Set the rendering color
- -
-
- - -

Functions

-
-
- - push () -
-
- Store the current transformation until the next pop() - Caches the current transform matrix into the matrix stack, and pushes a new copy of the matrix onto the top. - Note that the stack is limited in size (typically 32 items). - - - - - - -
-
- - pop () -
-
- Restore the transformation from the previous push() - Discards the current transformation matrix and restores the previous matrix from the matrix stack. - - - - - - -
-
- - translate (x, y) -
-
- Move the coordinate system origin to x, y - (modifies the transformation matrix) - -

Parameters:

-
    -
  • x - coordinate of new origin
  • -
  • y - coordinate of new origin
  • -
- - - - - -
-
- - scale (x, y) -
-
- Scale the coordinate system - (modifies the transformation matrix) - -

Parameters:

-
    -
  • x - horizontal factor
  • -
  • y - vertical factor
  • -
- - - - - -
-
- - rotate (a) -
-
- Rotate the coordinate system around the origin - (modifies the transformation matrix) - -

Parameters:

-
    -
  • a - the angle (in radians) to rotate
  • -
- - - - - -
-
- - point (x, y) -
-
- Draw a point at position x,y - -

Parameters:

-
    -
  • x - coordinate of center (optional, defaults to 0)
  • -
  • y - coordinate of center (optional, defaults to 0)
  • -
- - - - - -
-
- - line (x1, y1, x2, y2) -
-
- Draw a line from x1,y1 to x2,y2 - -

Parameters:

-
    -
  • x1 - start coordinate
  • -
  • y1 - start coordinate
  • -
  • x2 - end coordinate (optional, defaults to 0)
  • -
  • y2 - end coordinate (optional, defaults to 0)
  • -
- - - - - -
-
- - rect (x, y, w, h) -
-
- Draw a rectangle at the point (x, y) with width w and height h - -

Parameters:

-
    -
  • x - coordinate of center (optional, defaults to 0)
  • -
  • y - coordinate of center (optional, defaults to 0)
  • -
  • w - width (optional, defaults to 1)
  • -
  • h - height (optional, defaults to 1)
  • -
- - - - - -
-
- - ellipse (x, y, w, h) -
-
- Draw an ellipse at the point (x, y) with horizontal diameter w and vertical diameter h - -

Parameters:

-
    -
  • x - coordinate of center (optional, defaults to 0)
  • -
  • y - coordinate of center (optional, defaults to 0)
  • -
  • w - horizontal diameter (optional, defaults to 1)
  • -
  • h - vertical diameter (optional, defaults to w)
  • -
- - - - - -
-
- - circle (x, y, d) -
-
- Draw an ellipse at the point (x, y) with horizontal diameter d - -

Parameters:

-
    -
  • x - coordinate of center (optional, defaults to 0)
  • -
  • y - coordinate of center (optional, defaults to 0)
  • -
  • d - diameter (optional, defaults to 1)
  • -
- - - - - -
-
- - arc (x, y, s, e, w, h) -
-
- Draw an arc at the point (x, y) with horizontal diameter d - -

Parameters:

-
    -
  • x - coordinate of center (optional, defaults to 0)
  • -
  • y - coordinate of center (optional, defaults to 0)
  • -
  • s - start angle (optional, defaults to -pi/2)
  • -
  • e - end angle (optional, defaults to pi/2)
  • -
  • w - horizontal radius (optional, defaults to 1)
  • -
  • h - vertical radius (optional, defaults to w)
  • -
- - - - - -
-
- - color (red, green, blue, alpha) -
-
- Set the rendering color - -

Parameters:

-
    -
  • red - value from 0 to 1 (optional, default 0)
  • -
  • green - value from 0 to 1 (optional, default 0)
  • -
  • blue - value from 0 to 1 (optional, default 0)
  • -
  • alpha - (opacity) value from 0 to 1 (optional, default 1)
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/draw3D.html b/docs/modules/draw3D.html deleted file mode 100644 index 1d0632d..0000000 --- a/docs/modules/draw3D.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module draw3D

- -

draw3D: utilities for 3D OpenGL

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/field2D.html b/docs/modules/field2D.html deleted file mode 100644 index f30fb10..0000000 --- a/docs/modules/field2D.html +++ /dev/null @@ -1,521 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module field2D

- -

Field2D: an object representing a 2D densely packed array.

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
field2D:set (value, x, y)set the value of a cell, or of all cells.
field2D:get (x, y)return the value of a cell - If x or y is out of range of the field, it wraps around (positive modulo) - If x or y are not integers, the fractional component is discarded (rounded down)
field2D:sample (x, y)return the value at a normalized index (0..1 range maps to field dimensions) - Uses linear interpolation between nearest cells.
field2D:update (value, x, y)Update the field at a normalized (0..1) index - Like field2D:set(), but uses linear interpolation to distribute the update between nearest cells (thus it is an inverse of field:sample()).
field2D:splat (value, x, y)Add a value to the field at a normalized (0..1) index - Uses linear interpolation to distribute the value between nearest cells, for accumulation.
field2D:scale (value, x, y)Multiply the field by a value, optionally at a normalized (0..1) index - If indices are not given, all cells are multipled by the value.
field2D:diffuse (sourcefield, diffusion, passes)fill the field with a diffused (blurred) copy of another
field2D:map (func)Apply a function to each cell of the field in turn - The function arguments will be the current value of the cell and the x and y position, and the return value should be the new value of the cell (or nil to indicate no change).
field2D:normalize ()normalize the field values to a 0..1 range
field2D:sum ()return the sum of all cells
field2D:max ()return the maximum value of all cells
field2D:min ()return the minimum value of all cells
field2D:draw (x, y, w, h, unit)Draw the field in greyscale from 0..1
field2D:drawHueRange (range)Draw the field as a Hue spectrum from red to blue
drawFlow (fx, fy)draw two fields representing X and Y vector components
field2D:copy ()Create a copy of the field with the same dimensions and contents
- -
-
- - -

Functions

-
-
- - field2D:set (value, x, y) -
-
- set the value of a cell, or of all cells. - If the x,y coordinate is not specified, it will apply the value for all cells. - If the value to set is a function, this function is called (passing the x, y coordinates as arguments). If the function returns a value, the cell is set to this value; otherwise the cell is left unchanged. - -

Parameters:

-
    -
  • value - number or function - to set
  • -
  • x - optional int - coordinate (row) to set a single cell
  • -
  • y - optional int - coordinate (column) to set a single cell
  • -
- - - - - -
-
- - field2D:get (x, y) -
-
- return the value of a cell - If x or y is out of range of the field, it wraps around (positive modulo) - If x or y are not integers, the fractional component is discarded (rounded down) - -

Parameters:

-
    -
  • x - optional int - coordinate (row) to get a single cell
  • -
  • y - optional int - coordinate (column) to get a single cell
  • -
- - - - - -
-
- - field2D:sample (x, y) -
-
- return the value at a normalized index (0..1 range maps to field dimensions) - Uses linear interpolation between nearest cells. - Indices out of range will wrap. - -

Parameters:

-
    -
  • x - coordinate (0..1) to sample
  • -
  • y - coordinate (0..1) to sample
  • -
- - - - - -
-
- - field2D:update (value, x, y) -
-
- Update the field at a normalized (0..1) index - Like field2D:set(), but uses linear interpolation to distribute the update between nearest cells (thus it is an inverse of field:sample()). If the index falls exactly in the center of one cell, it is equivalent to field:set(). Otherwise, the four nearest cells will be updated as a weighted average of their current and the new value. - If the value is a function, this function is called for each nearby cell to generate a new value. The function argument is the old value of the cell. - Indices out of range will wrap. - -

Parameters:

-
    -
  • value - (number or function) the value to update the field
  • -
  • x - coordinate (0..1) to update
  • -
  • y - coordinate (0..1) to update
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - field2D:splat (value, x, y) -
-
- Add a value to the field at a normalized (0..1) index - Uses linear interpolation to distribute the value between nearest cells, for accumulation. - Indices out of range will wrap. - -

Parameters:

-
    -
  • value - the value to add to the field
  • -
  • x - coordinate (0..1) to update
  • -
  • y - coordinate (0..1) to update
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - field2D:scale (value, x, y) -
-
- Multiply the field by a value, optionally at a normalized (0..1) index - If indices are not given, all cells are multipled by the value. - Otherwise, uses linear interpolation to distribute the value between nearest cells, for multiplication. If the position index is exactly in the center of a cell, it performs a normal multiplcation. Otherwise the four nearest cells are updated according to a weighted average of their current and modified value. - Indices out of range will wrap. - -

Parameters:

-
    -
  • value - the value to scale to the field
  • -
  • x - coordinate (0..1) to update (optional)
  • -
  • y - coordinate (0..1) to update (optional)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - field2D:diffuse (sourcefield, diffusion, passes) -
-
- fill the field with a diffused (blurred) copy of another - -

Parameters:

-
    -
  • sourcefield - the field to be diffused
  • -
  • diffusion - the rate of diffusion
  • -
  • passes - ?int the number of iterations to improve numerical accuracy (default 10)
  • -
- - - - - -
-
- - field2D:map (func) -
-
- Apply a function to each cell of the field in turn - The function arguments will be the current value of the cell and the x and y position, and the return value should be the new value of the cell (or nil to indicate no change). E.g. to multiply all cells by 2: field:map(function(value, x, y) return value * 2 end) - -

Parameters:

-
    -
  • func - the function to apply
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - field2D:normalize () -
-
- normalize the field values to a 0..1 range - - -

Returns:

-
    - - self -
- - - - -
-
- - field2D:sum () -
-
- return the sum of all cells - - -

Returns:

-
    - - sum -
- - - - -
-
- - field2D:max () -
-
- return the maximum value of all cells - - -

Returns:

-
    - - max -
- - - - -
-
- - field2D:min () -
-
- return the minimum value of all cells - - -

Returns:

-
    - - min -
- - - - -
-
- - field2D:draw (x, y, w, h, unit) -
-
- Draw the field in greyscale from 0..1 - -

Parameters:

-
    -
  • x - left coordinate (optional, defaults to 0)
  • -
  • y - bottom coordinate (optional, defaults to 0)
  • -
  • w - width (optional, defaults to 1)
  • -
  • h - height (optional, defaults to 1)
  • -
  • unit - texture unit to use (defaults to 0)
  • -
- - - - - -
-
- - field2D:drawHueRange (range) -
-
- Draw the field as a Hue spectrum from red to blue - -

Parameters:

-
    -
  • range - the maximum field value (renders as blue)
  • -
- - - - - -
-
- - drawFlow (fx, fy) -
-
- draw two fields representing X and Y vector components - -

Parameters:

-
    -
  • fx - X component field
  • -
  • fy - Y component field
  • -
- - - - - -
-
- - field2D:copy () -
-
- Create a copy of the field with the same dimensions and contents - - - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/field3D.html b/docs/modules/field3D.html deleted file mode 100644 index 9d10ac8..0000000 --- a/docs/modules/field3D.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module field3D

- -

Field3D: an object representing a 3D densely packed array.

-

- - -

Functions

- - - - - -
field3D:set (value, x, y, z)set the value of a cell, or of all cells.
- -
-
- - -

Functions

-
-
- - field3D:set (value, x, y, z) -
-
- set the value of a cell, or of all cells. - If the x,y,z coordinate is not specified, it will apply the value for all cells. - If the value to set is a function, this function is called (passing the x, y, z coordinates as arguments). If the function returns a value, the cell is set to this value; otherwise the cell is left unchanged. - -

Parameters:

-
    -
  • value - number or function - to set
  • -
  • x - optional int - coordinate (row) to set a single cell
  • -
  • y - optional int - coordinate (column) to set a single cell
  • -
  • z - optional int - coordinate (layer) to set a single cell
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/io.html b/docs/modules/io.html deleted file mode 100644 index 8641e5f..0000000 --- a/docs/modules/io.html +++ /dev/null @@ -1,561 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module io

- -

Reading and Writing Files.

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
close (file)Equivalent to `file:close()`.
flush ()Equivalent to `file:flush` over the default output file.
input (file)When called with a file name, it opens the named file (in text mode), - and sets its handle as the default input file.
lines (filename)Opens the given file name in read mode and returns an iterator function - that, each time it is called, returns a new line from the file.
open (filename, mode)This function opens a file, in the mode specified in the string `mode`.
output (file)Similar to `io.input`, but operates over the default output file.
popen (prog, mode)Starts program `prog` in a separated process and returns a file handle - that you can use to read data from this program (if `mode` is `"r"`, - the default) or to write data to this program (if `mode` is `"w"`).
read (...)Equivalent to `io.input():read`.
tmpfile ()Returns a handle for a temporary file.
type (obj)Checks whether `obj` is a valid file handle.
write (...)Equivalent to `io.output():write`.
file:close ()Closes `file`.
file:flush ()Saves any written data to `file`.
file:lines ()Returns an iterator function that, each time it is called, returns a - new line from the file.
file:read (...)Reads the file `file`, according to the given formats, which specify - what to read.
file:seek (whence, offset)Sets and gets the file position, measured from the beginning of the - file, to the position given by `offset` plus a base specified by the string - `whence`, as follows: - "set": base is position 0 (beginning of the file); - "cur": base is current position; - "end": base is end of file; - In case of success, function `seek` returns the final file position, - measured in bytes from the beginning of the file.
file:setvbuf (mode, size)Sets the buffering mode for an output file.
file:write (...)Writes the value of each of its arguments to the `file`.
- -
-
- - -

Functions

-
-
- - close (file) -
-
- Equivalent to `file:close()`. Without a `file`, closes the default - output file. - -

Parameters:

-
    -
  • file -
  • -
- - - - - -
-
- - flush () -
-
- Equivalent to `file:flush` over the default output file. - - - - - - -
-
- - input (file) -
-
- When called with a file name, it opens the named file (in text mode), - and sets its handle as the default input file. When called with a file - handle, it simply sets this file handle as the default input file. When - called without parameters, it returns the current default input file. - In case of errors this function raises the error, instead of returning an - error code. - -

Parameters:

-
    -
  • file -
  • -
- - - - - -
-
- - lines (filename) -
-
- Opens the given file name in read mode and returns an iterator function - that, each time it is called, returns a new line from the file. Therefore, - the construction - for line in io.lines(filename) do *body* end - will iterate over all lines of the file. When the iterator function detects - the end of file, it returns nil (to finish the loop) and automatically - closes the file. - The call `io.lines()` (with no file name) is equivalent to - `io.input():lines()`; that is, it iterates over the lines of the default - input file. In this case it does not close the file when the loop ends. - -

Parameters:

-
    -
  • filename -
  • -
- - - - - -
-
- - open (filename, mode) -
-
- This function opens a file, in the mode specified in the string `mode`. It - returns a new file handle, or, in case of errors, nil plus an error message. - The `mode` string can be any of the following: - "r": read mode (the default); - "w": write mode; - "a": append mode; - "r+": update mode, all previous data is preserved; - "w+": update mode, all previous data is erased; - "a+": append update mode, previous data is preserved, writing is only - allowed at the end of file. - The `mode` string can also have a '`b`' at the end, which is needed in - some systems to open the file in binary mode. This string is exactly what - is used in the standard C function `fopen`. - -

Parameters:

-
    -
  • filename -
  • -
  • mode -
  • -
- - - - - -
-
- - output (file) -
-
- Similar to `io.input`, but operates over the default output file. - -

Parameters:

-
    -
  • file -
  • -
- - - - - -
-
- - popen (prog, mode) -
-
- Starts program `prog` in a separated process and returns a file handle - that you can use to read data from this program (if `mode` is `"r"`, - the default) or to write data to this program (if `mode` is `"w"`). - This function is system dependent and is not available on all platforms. - -

Parameters:

-
    -
  • prog -
  • -
  • mode -
  • -
- - - - - -
-
- - read (...) -
-
- Equivalent to `io.input():read`. - -

Parameters:

-
    -
  • ... -
  • -
- - - - - -
-
- - tmpfile () -
-
- Returns a handle for a temporary file. This file is opened in update - mode and it is automatically removed when the program ends. - - - - - - -
-
- - type (obj) -
-
- Checks whether `obj` is a valid file handle. Returns the string `"file"` - if `obj` is an open file handle, `"closed file"` if `obj` is a closed file - handle, or nil if `obj` is not a file handle. - -

Parameters:

-
    -
  • obj -
  • -
- - - - - -
-
- - write (...) -
-
- Equivalent to `io.output():write`. - -

Parameters:

-
    -
  • ... -
  • -
- - - - - -
-
- - file:close () -
-
- Closes `file`. Note that files are automatically closed when their - handles are garbage collected, but that takes an unpredictable amount of - time to happen. - - - - - - -
-
- - file:flush () -
-
- Saves any written data to `file`. - - - - - - -
-
- - file:lines () -
-
- Returns an iterator function that, each time it is called, returns a - new line from the file. Therefore, the construction - for line in file:lines() do *body* end - will iterate over all lines of the file. (Unlike `io.lines`, this function - does not close the file when the loop ends.) - - - - - - -
-
- - file:read (...) -
-
- Reads the file `file`, according to the given formats, which specify - what to read. For each format, the function returns a string (or a number) - with the characters read, or nil if it cannot read data with the specified - format. When called without formats, it uses a default format that reads - the entire next line (see below). - The available formats are - "*n": reads a number; this is the only format that returns a number - instead of a string. - "*a": reads the whole file, starting at the current position. On end of - file, it returns the empty string. - "*l": reads the next line (skipping the end of line), returning nil on - end of file. This is the default format. - *number*: reads a string with up to this number of characters, returning - nil on end of file. If number is zero, it reads nothing and returns an - empty string, or nil on end of file. - -

Parameters:

-
    -
  • ... -
  • -
- - - - - -
-
- - file:seek (whence, offset) -
-
- Sets and gets the file position, measured from the beginning of the - file, to the position given by `offset` plus a base specified by the string - `whence`, as follows: - "set": base is position 0 (beginning of the file); - "cur": base is current position; - "end": base is end of file; - In case of success, function `seek` returns the final file position, - measured in bytes from the beginning of the file. If this function fails, - it returns nil, plus a string describing the error. - The default value for `whence` is `"cur"`, and for `offset` is 0. Therefore, - the call `file:seek()` returns the current file position, without changing - it; the call `file:seek("set")` sets the position to the beginning of the - file (and returns 0); and the call `file:seek("end")` sets the position - to the end of the file, and returns its size. - -

Parameters:

-
    -
  • whence -
  • -
  • offset -
  • -
- - - - - -
-
- - file:setvbuf (mode, size) -
-
- Sets the buffering mode for an output file. There are three available - modes: -

* "no": no buffering; the result of any output operation appears immediately. - * "full": full buffering; output operation is performed only when the - buffer is full (or when you explicitly `flush` the file (see `io.flush`)). - * "line": line buffering; output is buffered until a newline is output or - there is any input from some special files (such as a terminal device). - For the last two cases, `size` specifies the size of the buffer, in - bytes. The default is an appropriate size. - -

Parameters:

-
    -
  • mode -
  • -
  • size -
  • -
- - - - - -
-
- - file:write (...) -
-
- Writes the value of each of its arguments to the `file`. The arguments - must be strings or numbers. To write other values, use `tostring` or - `string.format` before `write`. - -

Parameters:

-
    -
  • ... -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/mat4.html b/docs/modules/mat4.html deleted file mode 100644 index dab1258..0000000 --- a/docs/modules/mat4.html +++ /dev/null @@ -1,552 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module mat4

- -

mat4: A 4x4 matrix

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mat4:index (column, row)Get the array index in a matrix:
mat4:getcell (column, row)Get the value of a matrix cell
mat4:setcell (column, row, value)Set the value of a matrix cell
mat4:row (i)Get a row of the matrix as a vec4
mat4:col (i)Get a column of the matrix as a vec4
mat4:row3 (i)Get a row of the matrix as a vec3
mat4:col3 (i)Get a column of the matrix as a vec3
mat4:copy ()Create a copy of the matrix
mat4:transposenew ()Get transposed copy of the matrix
mat4:set (...)Set the values of a matrix from a list of arguments
mat4:identity ()Set or create identity matrix - If called without object (mat4.identity()), returns a new matrix - If called with object (mat4:identity()), resets the matrix to identity
mat4:transform (v)Computes product of matrix multiplied by column vector, r = m * vCol - This is typically what is required to project a vertex through a transform - For a better explanation, @see http:--xkcd.com/184/
mat4:transform_transposed (v)Computes product of a vec4 with the transpose of the matrix
fromPositionAxis (pos, ux, uy, uz)Generate a matrix from a position and three unit axes
perspectivePlane (nearBL, nearBR, nearTL, eye, near, far)Calculate perspective projection for near plane and eye coordinates - (nearBL, nearBR, nearTL, eye) all share the same coordinate system - (nearBR,nearBL) and (nearTL,nearBL) should form a right angle - (eye) can be set freely, allowing diverse off-axis projections - See Generalized Perspective Projection, Robert Kooima, 2009, EVL
perspectiveOffAxis (fovy, aspect, near, far, xshift, yshift, focal)Generalized off-axis perspective:
- -
-
- - -

Functions

-
-
- - mat4:index (column, row) -
-
- Get the array index in a matrix: - -

Parameters:

-
    -
  • column - (zero-based)
  • -
  • row - (zero-based)
  • -
- -

Returns:

-
    - - index -
- - - - -
-
- - mat4:getcell (column, row) -
-
- Get the value of a matrix cell - -

Parameters:

-
    -
  • column - (zero-based)
  • -
  • row - (zero-based)
  • -
- -

Returns:

-
    - - value -
- - - - -
-
- - mat4:setcell (column, row, value) -
-
- Set the value of a matrix cell - -

Parameters:

-
    -
  • column - (zero-based)
  • -
  • row - (zero-based)
  • -
  • value - (optional, default 0)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - mat4:row (i) -
-
- Get a row of the matrix as a vec4 - -

Parameters:

-
    -
  • i - (zero-based)
  • -
- -

Returns:

-
    - - vec4 -
- - - - -
-
- - mat4:col (i) -
-
- Get a column of the matrix as a vec4 - -

Parameters:

-
    -
  • i - (zero-based)
  • -
- -

Returns:

-
    - - vec4 -
- - - - -
-
- - mat4:row3 (i) -
-
- Get a row of the matrix as a vec3 - -

Parameters:

-
    -
  • i - (zero-based)
  • -
- -

Returns:

-
    - - vec3 -
- - - - -
-
- - mat4:col3 (i) -
-
- Get a column of the matrix as a vec3 - -

Parameters:

-
    -
  • i - (zero-based)
  • -
- -

Returns:

-
    - - vec3 -
- - - - -
-
- - mat4:copy () -
-
- Create a copy of the matrix - - -

Returns:

-
    - - new matrix -
- - - - -
-
- - mat4:transposenew () -
-
- Get transposed copy of the matrix - - -

Returns:

-
    - - new matrix -
- - - - -
-
- - mat4:set (...) -
-
- Set the values of a matrix from a list of arguments - -

Parameters:

-
    -
  • ... - arguments to set
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - mat4:identity () -
-
- Set or create identity matrix - If called without object (mat4.identity()), returns a new matrix - If called with object (mat4:identity()), resets the matrix to identity - - -

Returns:

-
    - - matrix -
- - - - -
-
- - mat4:transform (v) -
-
- Computes product of matrix multiplied by column vector, r = m * vCol - This is typically what is required to project a vertex through a transform - For a better explanation, @see http:--xkcd.com/184/ - -

Parameters:

-
    -
  • v - vec4 column vector to multiply
  • -
- -

Returns:

-
    - - vec4 result -
- - - - -
-
- - mat4:transform_transposed (v) -
-
- Computes product of a vec4 with the transpose of the matrix - -

Parameters:

-
    -
  • v - vec4 vector to multiply
  • -
- -

Returns:

-
    - - vec4 -
- - - - -
-
- - fromPositionAxis (pos, ux, uy, uz) -
-
- Generate a matrix from a position and three unit axes - -

Parameters:

-
    -
  • pos - vec3 position
  • -
  • ux - vec3 right-vector (unit length)
  • -
  • uy - vec3 up-vector (unit length)
  • -
  • uz - vec3 rear-vector (unit length)
  • -
- -

Returns:

-
    - - matrix -
- - - - -
-
- - perspectivePlane (nearBL, nearBR, nearTL, eye, near, far) -
-
- Calculate perspective projection for near plane and eye coordinates - (nearBL, nearBR, nearTL, eye) all share the same coordinate system - (nearBR,nearBL) and (nearTL,nearBL) should form a right angle - (eye) can be set freely, allowing diverse off-axis projections - See Generalized Perspective Projection, Robert Kooima, 2009, EVL - -

Parameters:

-
    -
  • nearBL - bottom-left near-plane coordinate (world-space)
  • -
  • nearBR - bottom-right near-plane coordinate (world-space)
  • -
  • nearTL - top-left near-plane coordinate (world-space)
  • -
  • eye - eye coordinate (world-space)
  • -
  • near - near plane distance from eye
  • -
  • far - far plane distance from eye
  • -
- - - - - -
-
- - perspectiveOffAxis (fovy, aspect, near, far, xshift, yshift, focal) -
-
- Generalized off-axis perspective: - -

Parameters:

-
    -
  • fovy -
  • -
  • aspect -
  • -
  • near -
  • -
  • far -
  • -
  • xshift -
  • -
  • yshift -
  • -
  • focal -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/math.html b/docs/modules/math.html deleted file mode 100644 index 96189dd..0000000 --- a/docs/modules/math.html +++ /dev/null @@ -1,744 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module math

- -

standard mathematical functions.

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
abs (x)Returns the absolute value of `x`.
acos (x)Returns the arc cosine of `x` (in radians).
asin (x)Returns the arc sine of `x` (in radians).
atan (x)Returns the arc tangent of `x` (in radians).
atan2 (y, x)Returns the arc tangent of `y/x` (in radians), but uses the signs - of both parameters to find the quadrant of the result.
ceil (x)Returns the smallest integer larger than or equal to `x`.
cos (x)Returns the cosine of `x` (assumed to be in radians).
cosh (x)Returns the hyperbolic cosine of `x`.
deg (x)Returns the angle `x` (given in radians) in degrees.
exp (x)Returns the value *e^x*.
floor (x)Returns the largest integer smaller than or equal to `x`.
fmod (x, y)Returns the remainder of the division of `x` by `y` that rounds the - quotient towards zero.
frexp (x)Returns `m` and `e` such that *x = m2^e*, `e` is an integer and the - absolute value of `m` is in the range *[0.5, 1)* (or zero when `x` is zero).
ldexp (m, e)Returns *m2^e* (`e` should be an integer).
log (x)Returns the natural logarithm of `x`.
log10 (x)Returns the base-10 logarithm of `x`.
max (x, ...)Returns the maximum value among its arguments.
min (x, ...)Returns the minimum value among its arguments.
modf (x)Returns two numbers, the integral part of `x` and the fractional part of - `x`.
pow (x, y)Returns *x^y*.
rad (x)Returns the angle `x` (given in degrees) in radians.
random (m, n)This function is an interface to the simple pseudo-random generator - function `rand` provided by ANSI C.
randomseed (x)Sets `x` as the "seed" for the pseudo-random generator: equal seeds - produce equal sequences of numbers.
sin (x)Returns the sine of `x` (assumed to be in radians).
sinh (x)Returns the hyperbolic sine of `x`.
sqrt (x)Returns the square root of `x`.
tan (x)Returns the tangent of `x` (assumed to be in radians).
tanh (x)Returns the hyperbolic tangent of `x`.
- -
-
- - -

Functions

-
-
- - abs (x) -
-
- Returns the absolute value of `x`. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - acos (x) -
-
- Returns the arc cosine of `x` (in radians). - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - asin (x) -
-
- Returns the arc sine of `x` (in radians). - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - atan (x) -
-
- Returns the arc tangent of `x` (in radians). - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - atan2 (y, x) -
-
- Returns the arc tangent of `y/x` (in radians), but uses the signs - of both parameters to find the quadrant of the result. (It also handles - correctly the case of `x` being zero.) - -

Parameters:

-
    -
  • y -
  • -
  • x -
  • -
- - - - - -
-
- - ceil (x) -
-
- Returns the smallest integer larger than or equal to `x`. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - cos (x) -
-
- Returns the cosine of `x` (assumed to be in radians). - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - cosh (x) -
-
- Returns the hyperbolic cosine of `x`. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - deg (x) -
-
- Returns the angle `x` (given in radians) in degrees. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - exp (x) -
-
- Returns the value *e^x*. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - floor (x) -
-
- Returns the largest integer smaller than or equal to `x`. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - fmod (x, y) -
-
- Returns the remainder of the division of `x` by `y` that rounds the - quotient towards zero. - -

Parameters:

-
    -
  • x -
  • -
  • y -
  • -
- - - - - -
-
- - frexp (x) -
-
- Returns `m` and `e` such that *x = m2^e*, `e` is an integer and the - absolute value of `m` is in the range *[0.5, 1)* (or zero when `x` is zero). - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - ldexp (m, e) -
-
- Returns *m2^e* (`e` should be an integer). - -

Parameters:

-
    -
  • m -
  • -
  • e -
  • -
- - - - - -
-
- - log (x) -
-
- Returns the natural logarithm of `x`. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - log10 (x) -
-
- Returns the base-10 logarithm of `x`. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - max (x, ...) -
-
- Returns the maximum value among its arguments. - -

Parameters:

-
    -
  • x -
  • -
  • ... -
  • -
- - - - - -
-
- - min (x, ...) -
-
- Returns the minimum value among its arguments. - -

Parameters:

-
    -
  • x -
  • -
  • ... -
  • -
- - - - - -
-
- - modf (x) -
-
- Returns two numbers, the integral part of `x` and the fractional part of - `x`. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - pow (x, y) -
-
- Returns *x^y*. (You can also use the expression `x^y` to compute this - value.) - -

Parameters:

-
    -
  • x -
  • -
  • y -
  • -
- - - - - -
-
- - rad (x) -
-
- Returns the angle `x` (given in degrees) in radians. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - random (m, n) -
-
- This function is an interface to the simple pseudo-random generator - function `rand` provided by ANSI C. (No guarantees can be given for its - statistical properties.) - When called without arguments, returns a uniform pseudo-random real - number in the range *[0,1)*. When called with an integer number `m`, - `math.random` returns a uniform pseudo-random integer in the range *[1, - m]*. When called with two integer numbers `m` and `n`, `math.random` - returns a uniform pseudo-random integer in the range *[m, n]*. - -

Parameters:

-
    -
  • m -
  • -
  • n -
  • -
- - - - - -
-
- - randomseed (x) -
-
- Sets `x` as the "seed" for the pseudo-random generator: equal seeds - produce equal sequences of numbers. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - sin (x) -
-
- Returns the sine of `x` (assumed to be in radians). - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - sinh (x) -
-
- Returns the hyperbolic sine of `x`. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - sqrt (x) -
-
- Returns the square root of `x`. (You can also use the expression `x^0.5` - to compute this value.) - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - tan (x) -
-
- Returns the tangent of `x` (assumed to be in radians). - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - tanh (x) -
-
- Returns the hyperbolic tangent of `x`. - -

Parameters:

-
    -
  • x -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/nav3.html b/docs/modules/nav3.html deleted file mode 100644 index d392b30..0000000 --- a/docs/modules/nav3.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module nav3

- -

nav3: utilities for 3D navigation

-

- - - -
-
- - - - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/os.html b/docs/modules/os.html deleted file mode 100644 index 681efb3..0000000 --- a/docs/modules/os.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module os

- -

Operating System facilities like date, time and program execution.

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
clock ()Returns an approximation of the amount in seconds of CPU time used by - the program.
date (format, time)Returns a string or a table containing date and time, formatted according - to the given string `format`.
difftime (t2, t1)Returns the number of seconds from time `t1` to time `t2`.
execute (command)This function is equivalent to the C function `system`.
exit (code)Calls the C function `exit`, with an optional `code`, to terminate the - host program.
getenv (varname)Returns the value of the process environment variable `varname`, or - nil if the variable is not defined.
remove (filename)Deletes the file or directory with the given name.
rename (oldname, newname)Renames file or directory named `oldname` to `newname`.
setlocale (locale, category)Sets the current locale of the program.
time (table)Returns the current time when called without arguments, or a time - representing the date and time specified by the given table.
tmpname ()Returns a string with a file name that can be used for a temporary - file.
- -
-
- - -

Functions

-
-
- - clock () -
-
- Returns an approximation of the amount in seconds of CPU time used by - the program. - - - - - - -
-
- - date (format, time) -
-
- Returns a string or a table containing date and time, formatted according - to the given string `format`. -

If the `time` argument is present, this is the time to be formatted - (see the `os.time` function for a description of this value). Otherwise, - `date` formats the current time. -

If `format` starts with '`!`', then the date is formatted in Coordinated - Universal Time. After this optional character, if `format` is the string - "`*t`", then `date` returns a table with the following fields: -

* `year` (four digits) - * `month` (1--12) - * `day` (1--31) - * `hour` (0--23) - * `min` (0--59) - * `sec` (0--61) - * `wday` (weekday, Sunday is 1) - * `yday` (day of the year) - * `isdst` (daylight saving flag, a boolean). -

If `format` is not "`*t`", then `date` returns the date as a string, - formatted according to the same rules as the C function `strftime`. - When called without arguments, `date` returns a reasonable date and time - representation that depends on the host system and on the current locale - (that is, `os.date()` is equivalent to `os.date("%c")`). - -

Parameters:

-
    -
  • format -
  • -
  • time -
  • -
- - - - - -
-
- - difftime (t2, t1) -
-
- Returns the number of seconds from time `t1` to time `t2`. In POSIX, - Windows, and some other systems, this value is exactly `t2`*-*`t1`. - -

Parameters:

-
    -
  • t2 -
  • -
  • t1 -
  • -
- - - - - -
-
- - execute (command) -
-
- This function is equivalent to the C function `system`. It passes - `command` to be executed by an operating system shell. It returns a status - code, which is system-dependent. If `command` is absent, then it returns - nonzero if a shell is available and zero otherwise. - -

Parameters:

-
    -
  • command -
  • -
- - - - - -
-
- - exit (code) -
-
- Calls the C function `exit`, with an optional `code`, to terminate the - host program. The default value for `code` is the success code. - -

Parameters:

-
    -
  • code -
  • -
- - - - - -
-
- - getenv (varname) -
-
- Returns the value of the process environment variable `varname`, or - nil if the variable is not defined. - -

Parameters:

-
    -
  • varname -
  • -
- - - - - -
-
- - remove (filename) -
-
- Deletes the file or directory with the given name. Directories must be - empty to be removed. If this function fails, it returns nil, plus a string - describing the error. - -

Parameters:

-
    -
  • filename -
  • -
- - - - - -
-
- - rename (oldname, newname) -
-
- Renames file or directory named `oldname` to `newname`. If this function - fails, it returns nil, plus a string describing the error. - -

Parameters:

-
    -
  • oldname -
  • -
  • newname -
  • -
- - - - - -
-
- - setlocale (locale, category) -
-
- Sets the current locale of the program. `locale` is a string specifying - a locale; `category` is an optional string describing which category to - change: `"all"`, `"collate"`, `"ctype"`, `"monetary"`, `"numeric"`, or - `"time"`; the default category is `"all"`. The function returns the name - of the new locale, or nil if the request cannot be honored. - If `locale` is the empty string, the current locale is set to an - implementation-defined native locale. If `locale` is the string "`C`", - the current locale is set to the standard C locale. - When called with nil as the first argument, this function only returns - the name of the current locale for the given category. - -

Parameters:

-
    -
  • locale -
  • -
  • category -
  • -
- - - - - -
-
- - time (table) -
-
- Returns the current time when called without arguments, or a time - representing the date and time specified by the given table. This table - must have fields `year`, `month`, and `day`, and may have fields `hour`, - `min`, `sec`, and `isdst` (for a description of these fields, see the - `os.date` function). - The returned value is a number, whose meaning depends on your system. In - POSIX, Windows, and some other systems, this number counts the number - of seconds since some given start time (the "epoch"). In other systems, - the meaning is not specified, and the number returned by `time` can be - used only as an argument to `date` and `difftime`. - -

Parameters:

-
    -
  • table -
  • -
- - - - - -
-
- - tmpname () -
-
- Returns a string with a file name that can be used for a temporary - file. The file must be explicitly opened before its use and explicitly - removed when no longer needed. - On some systems (POSIX), this function also creates a file with that - name, to avoid security risks. (Someone else might create the file with - wrong permissions in the time between getting the name and creating the - file.) You still have to open the file to use it and to remove it (even - if you do not use it). - When possible, you may prefer to use `io.tmpfile`, which automatically - removes the file when the program ends. - - - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/quat.html b/docs/modules/quat.html deleted file mode 100644 index dd204c2..0000000 --- a/docs/modules/quat.html +++ /dev/null @@ -1,450 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module quat

- -

quat: A simple 2-component vector

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
quat (x, y, z, w)Create a new quat with components x, y, z, w: - (Can also be used to duplicate: quat(v))
copy (v)Create a copy of a vector:
quat:set (x, y, z, w)Set the components of a vector:
fromRotor (v1, v2)derive quaternion as absolute difference between two unit vectors - v1 and v2 must be normalized.
quat:mul (q)Multiply a quaternion - If q is a scalar, it scales all components.
quat:mulnew (q)Multiply two quaternions - If q is a scalar, it scales all components.
divnew (a, b)Multiply two quaternions - If q is a scalar, it scales all components.
quat:normalize ()set the length of the vector to 1 (unit vector) - (randomized direction if self length was zero)
quat:normalizenew ()return a normalized copy of the vector - (randomized direction if self length was zero)
quat:length ()return the length of a vector - (Can also use #vector)
quat:dot (v)return the dot product of two quaternions:
rotate (q, v)Rotate a vector: - q must be a normalized quaternion
unrotate (q, v)Rotate a vector out of a quaternion: - equiv.
- -
-
- - -

Functions

-
-
- - quat (x, y, z, w) -
-
- Create a new quat with components x, y, z, w: - (Can also be used to duplicate: quat(v)) - -

Parameters:

-
    -
  • x - number or vector (optional, default 0)
  • -
  • y - number (optional, default 0)
  • -
  • z - number (optional, default 0)
  • -
  • w - number (optional, default 1)
  • -
- - - - - -
-
- - copy (v) -
-
- Create a copy of a vector: - -

Parameters:

-
    -
  • v - vector
  • -
- - - - - -
-
- - quat:set (x, y, z, w) -
-
- Set the components of a vector: - -

Parameters:

-
    -
  • x - component
  • -
  • y - component
  • -
  • z - component
  • -
  • w - component
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - fromRotor (v1, v2) -
-
- derive quaternion as absolute difference between two unit vectors - v1 and v2 must be normalized. the order of v1,v2 is not important; - v1 and v2 define a plane orthogonal to a rotational axis - the rotation around this axis increases as v1 and v2 diverge - alternatively expressed as Q = (1+gp(v1, v2))/sqrt(2*(1+dot(b, a))) - -

Parameters:

-
    -
  • v1 -
  • -
  • v2 - get the normal to the plane (i.e. the unit bivector containing the v1 and v2) normalize because the cross product can get slightly denormalized
  • -
- - - - - -
-
- - quat:mul (q) -
-
- Multiply a quaternion - If q is a scalar, it scales all components. If q is a quaternion, it applies quaternion rotation. - -

Parameters:

-
    -
  • q - number or quaternion to mul
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - quat:mulnew (q) -
-
- Multiply two quaternions - If q is a scalar, it scales all components. If q is a quaternion, it applies quaternion rotation. - -

Parameters:

-
    -
  • q - number or quaternion to mul
  • -
- -

Returns:

-
    - - new quaternion -
- - - - -
-
- - divnew (a, b) -
-
- Multiply two quaternions - If q is a scalar, it scales all components. If q is a quaternion, it applies conjugate quaternion rotation. - -

Parameters:

-
    -
  • a - number or quaternion to divide
  • -
  • b - number or quaternion to divide by
  • -
- -

Returns:

-
    - - new quaternion -
- - - - -
-
- - quat:normalize () -
-
- set the length of the vector to 1 (unit vector) - (randomized direction if self length was zero) - - -

Returns:

-
    - - self -
- - - - -
-
- - quat:normalizenew () -
-
- return a normalized copy of the vector - (randomized direction if self length was zero) - - -

Returns:

-
    - - vector of length 1 (unit vector) -
- - - - -
-
- - quat:length () -
-
- return the length of a vector - (Can also use #vector) - - -

Returns:

-
    - - length -
- - - - -
-
- - quat:dot (v) -
-
- return the dot product of two quaternions: - -

Parameters:

-
    -
  • v - quaternion argument
  • -
- -

Returns:

-
    - - dot product -
- - - - -
-
- - rotate (q, v) -
-
- Rotate a vector: - q must be a normalized quaternion - -

Parameters:

-
    -
  • q - qv = vec4(v, 0) -- 'pure quaternion' derived from vector return ((q * qv) * q^-1).xyz reduced to 24 multiplies and 17 additions -
  • -
  • v -
  • -
- - - - - -
-
- - unrotate (q, v) -
-
- Rotate a vector out of a quaternion: - equiv. quat_rotate(quat_conj(q), v): - q must be a normalized quaternion - -

Parameters:

-
    -
  • q - reduced -
  • -
  • v -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/string.html b/docs/modules/string.html deleted file mode 100644 index ae7fce2..0000000 --- a/docs/modules/string.html +++ /dev/null @@ -1,541 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module string

- -

string operations like searching and matching.

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
byte (s, i, j)Returns the internal numerical codes of the characters `s[i]`, `s[i+1]`, - ..., `s[j]`.
char (...)Receives zero or more integers.
dump (function)Returns a string containing a binary representation of the given - function, so that a later `loadstring` on this string returns a copy of - the function.
find (s, pattern, init, plain)Looks for the first match of `pattern` in the string `s`.
format (formatstring, ...)Returns a formatted version of its variable number of arguments following - the description given in its first argument (which must be a string).
gmatch (s, pattern)Returns an iterator function that, each time it is called, returns the - next captures from `pattern` over string `s`.
gsub (s, pattern, repl, n)Returns a copy of `s` in which all (or the first `n`, if given) - occurrences of the `pattern` have been replaced by a replacement string - specified by `repl`, which can be a string, a table, or a function.
len (s)Receives a string and returns its length.
lower (s)Receives a string and returns a copy of this string with all uppercase - letters changed to lowercase.
match (s, pattern, init)Looks for the first *match* of `pattern` in the string `s`.
rep (s, n)Returns a string that is the concatenation of `n` copies of the string - `s`.
reverse (s)Returns a string that is the string `s` reversed.
sub (s, i, j)Returns the substring of `s` that starts at `i` and continues until - `j`; `i` and `j` can be negative.
upper (s)Receives a string and returns a copy of this string with all lowercase - letters changed to uppercase.
- -
-
- - -

Functions

-
-
- - byte (s, i, j) -
-
- Returns the internal numerical codes of the characters `s[i]`, `s[i+1]`, - ..., `s[j]`. The default value for `i` is 1; the default value for `j` - is `i`. - Note that numerical codes are not necessarily portable across platforms. - -

Parameters:

-
    -
  • s -
  • -
  • i -
  • -
  • j -
  • -
- - - - - -
-
- - char (...) -
-
- Receives zero or more integers. Returns a string with length equal to - the number of arguments, in which each character has the internal numerical - code equal to its corresponding argument. - Note that numerical codes are not necessarily portable across platforms. - -

Parameters:

-
    -
  • ... -
  • -
- - - - - -
-
- - dump (function) -
-
- Returns a string containing a binary representation of the given - function, so that a later `loadstring` on this string returns a copy of - the function. `function` must be a Lua function without upvalues. - -

Parameters:

-
    -
  • function -
  • -
- - - - - -
-
- - find (s, pattern, init, plain) -
-
- Looks for the first match of `pattern` in the string `s`. If it finds a - match, then `find` returns the indices of `s` where this occurrence starts - and ends; otherwise, it returns nil. A third, optional numerical argument - `init` specifies where to start the search; its default value is 1 and - can be negative. A value of true as a fourth, optional argument `plain` - turns off the pattern matching facilities, so the function does a plain - "find substring" operation, with no characters in `pattern` being considered - "magic". Note that if `plain` is given, then `init` must be given as well. - If the pattern has captures, then in a successful match the captured values - are also returned, after the two indices. - -

Parameters:

-
    -
  • s -
  • -
  • pattern -
  • -
  • init -
  • -
  • plain -
  • -
- - - - - -
-
- - format (formatstring, ...) -
-
- Returns a formatted version of its variable number of arguments following - the description given in its first argument (which must be a string). The - format string follows the same rules as the `printf` family of standard C - functions. The only differences are that the options/modifiers `*`, `l`, - `L`, `n`, `p`, and `h` are not supported and that there is an extra option, - `q`. The `q` option formats a string in a form suitable to be safely read - back by the Lua interpreter: the string is written between double quotes, - and all double quotes, newlines, embedded zeros, and backslashes in the - string are correctly escaped when written. For instance, the call -

string.format('%q', 'a string with "quotes" and \n new line') -

will produce the string: -

"a string with \"quotes\" and \ - new line" -

The options `c`, `d`, `E`, `e`, `f`, `g`, `G`, `i`, `o`, `u`, `X`, and - `x` all expect a number as argument, whereas `q` and `s` expect a string. - This function does not accept string values containing embedded zeros, - except as arguments to the `q` option. - -

Parameters:

-
    -
  • formatstring -
  • -
  • ... -
  • -
- - - - - -
-
- - gmatch (s, pattern) -
-
- Returns an iterator function that, each time it is called, returns the - next captures from `pattern` over string `s`. If `pattern` specifies no - captures, then the whole match is produced in each call. - As an example, the following loop -

s = "hello world from Lua" - for w in string.gmatch(s, "%a+") do - print(w) - end -

will iterate over all the words from string `s`, printing one per line. The - next example collects all pairs `key=value` from the given string into - a table: -

t = {} - s = "from=world, to=Lua" - for k, v in string.gmatch(s, "(%w+)=(%w+)") do - t[k] = v - end -

For this function, a '`^`' at the start of a pattern does not work as an - anchor, as this would prevent the iteration. - -

Parameters:

-
    -
  • s -
  • -
  • pattern -
  • -
- - - - - -
-
- - gsub (s, pattern, repl, n) -
-
- Returns a copy of `s` in which all (or the first `n`, if given) - occurrences of the `pattern` have been replaced by a replacement string - specified by `repl`, which can be a string, a table, or a function. `gsub` - also returns, as its second value, the total number of matches that occurred. -

If `repl` is a string, then its value is used for replacement. The character - `%` works as an escape character: any sequence in `repl` of the form `%n`, - with *n* between 1 and 9, stands for the value of the *n*-th captured - substring (see below). The sequence `%0` stands for the whole match. The - sequence `%%` stands for a single `%`. -

If `repl` is a table, then the table is queried for every match, using - the first capture as the key; if the pattern specifies no captures, then - the whole match is used as the key. -

If `repl` is a function, then this function is called every time a match - occurs, with all captured substrings passed as arguments, in order; if - the pattern specifies no captures, then the whole match is passed as a - sole argument. -

If the value returned by the table query or by the function call is a - string or a number, then it is used as the replacement string; otherwise, - if it is false or nil, then there is no replacement (that is, the original - match is kept in the string). -

Here are some examples: - x = string.gsub("hello world", "(%w+)", "%1 %1") - --> x="hello hello world world" - x = string.gsub("hello world", "%w+", "%0 %0", 1) - --> x="hello hello world" - x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1") - --> x="world hello Lua from" - x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv) - --> x="home = /home/roberto, user = roberto" - x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s) - return loadstring(s)() - end) - --> x="4+5 = 9" - local t = {name="lua", version="5.1"} - x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t) - --> x="lua-5.1.tar.gz" - -

Parameters:

-
    -
  • s -
  • -
  • pattern -
  • -
  • repl -
  • -
  • n -
  • -
- - - - - -
-
- - len (s) -
-
- Receives a string and returns its length. The empty string `""` has - length 0. Embedded zeros are counted, so `"a\000bc\000"` has length 5. - -

Parameters:

-
    -
  • s -
  • -
- - - - - -
-
- - lower (s) -
-
- Receives a string and returns a copy of this string with all uppercase - letters changed to lowercase. All other characters are left unchanged. The - definition of what an uppercase letter is depends on the current locale. - -

Parameters:

-
    -
  • s -
  • -
- - - - - -
-
- - match (s, pattern, init) -
-
- Looks for the first *match* of `pattern` in the string `s`. If it - finds one, then `match` returns the captures from the pattern; otherwise - it returns nil. If `pattern` specifies no captures, then the whole match - is returned. A third, optional numerical argument `init` specifies where - to start the search; its default value is 1 and can be negative. - -

Parameters:

-
    -
  • s -
  • -
  • pattern -
  • -
  • init -
  • -
- - - - - -
-
- - rep (s, n) -
-
- Returns a string that is the concatenation of `n` copies of the string - `s`. - -

Parameters:

-
    -
  • s -
  • -
  • n -
  • -
- - - - - -
-
- - reverse (s) -
-
- Returns a string that is the string `s` reversed. - -

Parameters:

-
    -
  • s -
  • -
- - - - - -
-
- - sub (s, i, j) -
-
- Returns the substring of `s` that starts at `i` and continues until - `j`; `i` and `j` can be negative. If `j` is absent, then it is assumed to - be equal to -1 (which is the same as the string length). In particular, - the call `string.sub(s,1,j)` returns a prefix of `s` with length `j`, and - `string.sub(s, -i)` returns a suffix of `s` with length `i`. - -

Parameters:

-
    -
  • s -
  • -
  • i -
  • -
  • j -
  • -
- - - - - -
-
- - upper (s) -
-
- Receives a string and returns a copy of this string with all lowercase - letters changed to uppercase. All other characters are left unchanged. The - definition of what a lowercase letter is depends on the current locale. - -

Parameters:

-
    -
  • s -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/table.html b/docs/modules/table.html deleted file mode 100644 index 0327ccf..0000000 --- a/docs/modules/table.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module table

- -

manipulating Lua tables.

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - -
concat (table, sep, i, j)Given an array where all elements are strings or numbers, returns - `table[i]..sep..table[i+1] ...
insert (table, pos, value)Inserts element `value` at position `pos` in `table`, shifting up - other elements to open space, if necessary.
maxn (table)Returns the largest positive numerical index of the given table, or - zero if the table has no positive numerical indices.
remove (table, pos)Removes from `table` the element at position `pos`, shifting down other - elements to close the space, if necessary.
sort (table, comp)Sorts table elements in a given order, - *in-place*, from `table[1]` to `table[n]`, where `n` is the length of the - table.
- -
-
- - -

Functions

-
-
- - concat (table, sep, i, j) -
-
- Given an array where all elements are strings or numbers, returns - `table[i]..sep..table[i+1] ... sep..table[j]`. The default value for - `sep` is the empty string, the default for `i` is 1, and the default for - `j` is the length of the table. If `i` is greater than `j`, returns the - empty string. - -

Parameters:

-
    -
  • table -
  • -
  • sep -
  • -
  • i -
  • -
  • j -
  • -
- - - - - -
-
- - insert (table, pos, value) -
-
- Inserts element `value` at position `pos` in `table`, shifting up - other elements to open space, if necessary. The default value for `pos` is - `n+1`, where `n` is the length of the table (see §2.5.5), so that a call - `table.insert(t,x)` inserts `x` at the end of table `t`. - -

Parameters:

-
    -
  • table -
  • -
  • pos -
  • -
  • value -
  • -
- - - - - -
-
- - maxn (table) -
-
- Returns the largest positive numerical index of the given table, or - zero if the table has no positive numerical indices. (To do its job this - function does a linear traversal of the whole table.) - -

Parameters:

-
    -
  • table -
  • -
- - - - - -
-
- - remove (table, pos) -
-
- Removes from `table` the element at position `pos`, shifting down other - elements to close the space, if necessary. Returns the value of the removed - element. The default value for `pos` is `n`, where `n` is the length of the - table, so that a call `table.remove(t)` removes the last element of table - `t`. - -

Parameters:

-
    -
  • table -
  • -
  • pos -
  • -
- - - - - -
-
- - sort (table, comp) -
-
- Sorts table elements in a given order, - *in-place*, from `table[1]` to `table[n]`, where `n` is the length of the - table. If `comp` is given, then it must be a function that receives two - table elements, and returns true when the first is less than the second - (so that `not comp(a[i+1],a[i])` will be true after the sort). If `comp` - is not given, then the '<' operator will be used. - -

Parameters:

-
    -
  • table -
  • -
  • comp -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/util.html b/docs/modules/util.html deleted file mode 100644 index 8747e07..0000000 --- a/docs/modules/util.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module util

- -

A collection of highly re-usable Lua utilities

-

- - -

Functions

- - - - - - - - - - - - - - - - - -
gc (self, gcfunc)return an object that will call func when it is garbage collected: - (Sentinel pattern) - Note: this is not necessary in Lua 5.2 where tables can have __gc metamethods
conflat (v, sep, ext)Return a string concatenation of all elements in v - Similar to table.concat, however conflat also recurses to all nested tables - and calls tostring() on all non-table values - Any nested functions will also be invoked, and conflat called on their results.
template (source)Generate a template-filling function based on a template string - The template source can contain various template substitution items, indicated by the "$" character followed by a valid Lua variable name, e.g.
tostring (t)Return a pretty-formatted string representation of a table - Array portion is printed after dict portion.
- -
-
- - -

Functions

-
-
- - gc (self, gcfunc) -
-
- return an object that will call func when it is garbage collected: - (Sentinel pattern) - Note: this is not necessary in Lua 5.2 where tables can have __gc metamethods - -

Parameters:

-
    -
  • self - an object to pass to this gcfunc
  • -
  • gcfunc - a function to call
  • -
- -

Returns:

-
    - - obj (for method chaining) -
- - - - -
-
- - conflat (v, sep, ext) -
-
- Return a string concatenation of all elements in v - Similar to table.concat, however conflat also recurses to all nested tables - and calls tostring() on all non-table values - Any nested functions will also be invoked, and conflat called on their results. - -

Parameters:

-
    -
  • v - the item to concat (e.g. a list)
  • -
  • sep -
  • -
  • ext -
  • -
- -

Returns:

-
    - - string -
- - - - -
-
- - template (source) -
-
- Generate a template-filling function based on a template string - The template source can contain various template substitution items, indicated by the "$" character followed by a valid Lua variable name, e.g. "$foo", "$_x1", etc. - A template item can optionally be terminated using "{}", in order to distinguish the item name from plain text. E.g. "$foo{}plain" defines the item "foo" followed by the string "plain". - The returned function takes a Lua table as an argument. All substitution item names index corresponding fields in this table to find their data. If the data value is a table, util.conflat() is used to convert this to a string. - If a template item is preceded by a newline and whitespace, the newline and whitespace are repeated for all items substituted (via the argument to conflat()). - -

Parameters:

-
    -
  • source - string template source
  • -
- -

Returns:

-
    - - function to apply a model -
- - - - -
-
- - tostring (t) -
-
- Return a pretty-formatted string representation of a table - Array portion is printed after dict portion. - Keys are sorted alphanumerically. - Could also be used as a replacement of the global tostring() - -

Parameters:

-
    -
  • t - the value (e.g. table) to print
  • -
- -

Returns:

-
    - - string -
- - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/vec2.html b/docs/modules/vec2.html deleted file mode 100644 index 63e3c18..0000000 --- a/docs/modules/vec2.html +++ /dev/null @@ -1,1319 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module vec2

- -

vec2: A simple 2-component vector

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
vec2 (x, y)Create a new vector with components x, y: - (Can also be used to duplicate a vector: vec2(v))
copy (v)Create a copy of a vector:
vec2:set (x, y)Set the components of a vector:
fromAngle (angle)Create a unit (length 1) vector from an angle
fromPolar (length, angle)Create a vector from a polar form length and angle
vec2:add (v)Add a vector (or number) to self (in-place)
addnew (a, b)Add two vectors (or numbers) to create a new vector
vec2:sub (v)Subtract a vector (or number) to self (in-place)
subnew (a, b)Subtract two vectors (or numbers) to create a new vector
vec2:mul (v)Multiply a vector (or number) to self (in-place)
mulnew (a, b)Multiply two vectors (or numbers) to create a new vector
vec2:div (v)Divide a vector (or number) to self (in-place)
divnew (a, b)Divide two vectors (or numbers) to create a new vector
vec2:pow (v)Raise to power a vector (or number) to self (in-place)
pownew (a, b)Raise to power two vectors (or numbers) to create a new vector
vec2:mod (v)Calculate modulo a vector (or number) to self (in-place)
modnew (a, b)Calculate modulo two vectors (or numbers) to create a new vector
vec2:min (v)Calculate minimum of elements (in-place)
minnew (a, b)Calculate minimum of elements to create a new vector
vec2:max (v)Calculate maximum of elements (in-place)
maxnew (a, b)Calculate maximum of elements to create a new vector
vec2:clip (lo, hi)Constrain vector to range (in-place)
vec2:clip (lo, hi)Constrain vector to range to create a new vector
vec2:relativewrap (dimx, dimy)Determine shortest relative vector in a toroidal space
vec2:relativewrapnew (dimx, dimy)Create new vector as shortest relative vector in a toroidal space
vec2:lerp (v, f)interpolate from self to v by factor of f
lerpnew (a, b, f)create a vector from the linear interpolation of two vectors:
vec2:normalize ()set the length of the vector to 1 (unit vector) - (randomized direction if self length was zero)
vec2:normalizenew ()return a normalized copy of the vector - (randomized direction if self length was zero)
vec2:limit (maximum)Impose a maximum magnitude - Rescales vector if greater than maximum
vec2:limitnew (maximum)Create a copy of a vector, limited to a maximum magnitude - Rescales vector if greater than maximum
vec2:setangle (a)Rotate a vector to a specific angle:
vec2:setanglenew (a)Return a copy rotated to a specific angle:
vec2:setmag (m)Rescale a vector to a specific magnitude:
vec2:setmagnew (m)Return a vector copy rescaled to a specific magnitude:
vec2:rotate (angle)Rotate a vector by an angle
vec2:rotatenew (angle)Create a vector by rotating a vector by an angle
random (mag)Create a new vector in a uniformly random direction:
vec2:randomize (mag)Set to a vector of magnitude 1 in a uniformly random direction:
vec2:length ()return the length of a vector - (Can also use #vector)
vec2:angle ()Return the angle to the vector (direction)
vec2:polar ()Return the magnitude and angle (polar form):
dot (a, b)return the dot product of two vectors:
vec2:distance (p)The distance between two vectors (two points) - (The relative distance from self to p)
anglebetween (a, b)The angle between two vectors (two points) - (The relative angle from self to v)
- -
-
- - -

Functions

-
-
- - vec2 (x, y) -
-
- Create a new vector with components x, y: - (Can also be used to duplicate a vector: vec2(v)) - -

Parameters:

-
    -
  • x - number or vector (optional, default 0)
  • -
  • y - number (optional, default 0)
  • -
- - - - - -
-
- - copy (v) -
-
- Create a copy of a vector: - -

Parameters:

-
    -
  • v - vector
  • -
- - - - - -
-
- - vec2:set (x, y) -
-
- Set the components of a vector: - -

Parameters:

-
    -
  • x - component
  • -
  • y - component
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - fromAngle (angle) -
-
- Create a unit (length 1) vector from an angle - -

Parameters:

-
    -
  • angle - in radians
  • -
- - - - - -
-
- - fromPolar (length, angle) -
-
- Create a vector from a polar form length and angle - -

Parameters:

-
    -
  • length - magnitude
  • -
  • angle - in radians
  • -
- - - - - -
-
- - vec2:add (v) -
-
- Add a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to add
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - addnew (a, b) -
-
- Add two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:sub (v) -
-
- Subtract a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to sub
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - subnew (a, b) -
-
- Subtract two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:mul (v) -
-
- Multiply a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to mul
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - mulnew (a, b) -
-
- Multiply two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:div (v) -
-
- Divide a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to div
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - divnew (a, b) -
-
- Divide two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:pow (v) -
-
- Raise to power a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to pow
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - pownew (a, b) -
-
- Raise to power two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:mod (v) -
-
- Calculate modulo a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to mod
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - modnew (a, b) -
-
- Calculate modulo two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:min (v) -
-
- Calculate minimum of elements (in-place) - -

Parameters:

-
    -
  • v - number or vector limit
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - minnew (a, b) -
-
- Calculate minimum of elements to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:max (v) -
-
- Calculate maximum of elements (in-place) - -

Parameters:

-
    -
  • v - number or vector limit
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - maxnew (a, b) -
-
- Calculate maximum of elements to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:clip (lo, hi) -
-
- Constrain vector to range (in-place) - -

Parameters:

-
    -
  • lo - vector or number minimum value
  • -
  • hi - vector or number minimum value
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec2:clip (lo, hi) -
-
- Constrain vector to range to create a new vector - -

Parameters:

-
    -
  • lo - vector or number minimum value
  • -
  • hi - vector or number minimum value
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:relativewrap (dimx, dimy) -
-
- Determine shortest relative vector in a toroidal space - -

Parameters:

-
    -
  • dimx - width of space (optional, default 1)
  • -
  • dimy - height of space (optional, default dimx)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec2:relativewrapnew (dimx, dimy) -
-
- Create new vector as shortest relative vector in a toroidal space - -

Parameters:

-
    -
  • dimx - width of space (optional, default 1)
  • -
  • dimy - height of space (optional, default dimx)
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:lerp (v, f) -
-
- interpolate from self to v by factor of f - -

Parameters:

-
    -
  • v - vector
  • -
  • f - interpolation factor from self to v (0 = none, 1 = full)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - lerpnew (a, b, f) -
-
- create a vector from the linear interpolation of two vectors: - -

Parameters:

-
    -
  • a - vector
  • -
  • b - vector
  • -
  • f - interpolation factor from a to b (0 = none, 1 = full)
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:normalize () -
-
- set the length of the vector to 1 (unit vector) - (randomized direction if self length was zero) - - -

Returns:

-
    - - self -
- - - - -
-
- - vec2:normalizenew () -
-
- return a normalized copy of the vector - (randomized direction if self length was zero) - - -

Returns:

-
    - - vector of length 1 (unit vector) -
- - - - -
-
- - vec2:limit (maximum) -
-
- Impose a maximum magnitude - Rescales vector if greater than maximum - -

Parameters:

-
    -
  • maximum - maximum magnitude of vector
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec2:limitnew (maximum) -
-
- Create a copy of a vector, limited to a maximum magnitude - Rescales vector if greater than maximum - -

Parameters:

-
    -
  • maximum - maximum magnitude of vector
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:setangle (a) -
-
- Rotate a vector to a specific angle: - -

Parameters:

-
    -
  • a - new angle
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec2:setanglenew (a) -
-
- Return a copy rotated to a specific angle: - -

Parameters:

-
    -
  • a - new angle
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:setmag (m) -
-
- Rescale a vector to a specific magnitude: - -

Parameters:

-
    -
  • m - new magnitude
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec2:setmagnew (m) -
-
- Return a vector copy rescaled to a specific magnitude: - -

Parameters:

-
    -
  • m - new magnitude
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:rotate (angle) -
-
- Rotate a vector by an angle - -

Parameters:

-
    -
  • angle - in radians
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec2:rotatenew (angle) -
-
- Create a vector by rotating a vector by an angle - -

Parameters:

-
    -
  • angle - in radians
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - random (mag) -
-
- Create a new vector in a uniformly random direction: - -

Parameters:

-
    -
  • mag - magnitude (optional, default 1)
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec2:randomize (mag) -
-
- Set to a vector of magnitude 1 in a uniformly random direction: - -

Parameters:

-
    -
  • mag - magnitude (optional, default 1)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec2:length () -
-
- return the length of a vector - (Can also use #vector) - - -

Returns:

-
    - - length -
- - - - -
-
- - vec2:angle () -
-
- Return the angle to the vector (direction) - - -

Returns:

-
    - - angle (in radians) -
- - - - -
-
- - vec2:polar () -
-
- Return the magnitude and angle (polar form): - - -

Returns:

-
    - - length, angle (in radians) -
- - - - -
-
- - dot (a, b) -
-
- return the dot product of two vectors: - -

Parameters:

-
    -
  • a - vector
  • -
  • b - vector
  • -
- -

Returns:

-
    - - dot product -
- - - - -
-
- - vec2:distance (p) -
-
- The distance between two vectors (two points) - (The relative distance from self to p) - -

Parameters:

-
    -
  • p - target to measure distance to
  • -
- -

Returns:

-
    - - distance -
- - - - -
-
- - anglebetween (a, b) -
-
- The angle between two vectors (two points) - (The relative angle from self to v) - -

Parameters:

-
    -
  • a - vector to measure angle between
  • -
  • b - vector to measure angle between
  • -
- -

Returns:

-
    - - distance -
- - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/vec3.html b/docs/modules/vec3.html deleted file mode 100644 index 892e1c9..0000000 --- a/docs/modules/vec3.html +++ /dev/null @@ -1,1180 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module vec3

- -

vec3: A simple 3-component vector

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
vec3 (x, y, z)Create a new vector with components x, y, z: - (Can also be used to duplicate a vector: vec3(v))
copy (v)Create a copy of a vector:
fromvec2 (v, z)Create a copy of a vec2 vector:
vec3:set (x, y, z)Set the components of a vector:
vec3:add (v)Add a vector (or number) to self (in-place)
addnew (a, b)Add two vectors (or numbers) to create a new vector
vec3:sub (v)Subtract a vector (or number) to self (in-place)
subnew (a, b)Subtract two vectors (or numbers) to create a new vector
vec3:mul (v)Multiply a vector (or number) to self (in-place)
mulnew (a, b)Multiply two vectors (or numbers) to create a new vector
vec3:div (v)Divide a vector (or number) to self (in-place)
divnew (a, b)Divide two vectors (or numbers) to create a new vector
vec3:pow (v)Raise to power a vector (or number) to self (in-place)
pownew (a, b)Raise to power two vectors (or numbers) to create a new vector
vec3:mod (v)Calculate modulo a vector (or number) to self (in-place)
modnew (a, b)Calculate modulo two vectors (or numbers) to create a new vector
vec3:min (v)Calculate minimum of elements (in-place)
minnew (a, b)Calculate minimum of elements to create a new vector
vec3:max (v)Calculate maximum of elements (in-place)
maxnew (a, b)Calculate maximum of elements to create a new vector
vec3:clip (lo, hi)Constrain vector to range (in-place)
vec3:clip (lo, hi)Constrain vector to range to create a new vector
vec3:relativewrap (dimx, dimy, dimz)Determine shortest relative vector in a toroidal space
vec3:relativewrapnew (dimx, dimy)Create new vector as shortest relative vector in a toroidal space
vec3:lerp (v, f)interpolate from self to v by factor of f
lerpnew (a, b, f)create a vector from the linear interpolation of two vectors:
vec3:normalize ()set the length of the vector to 1 (unit vector) - (randomized direction if self length was zero)
vec3:normalizenew ()return a normalized copy of the vector - (randomized direction if self length was zero)
vec3:limit (maximum)Impose a maximum magnitude - Rescales vector if greater than maximum
vec3:limitnew (maximum)Create a copy of a vector, limited to a maximum magnitude - Rescales vector if greater than maximum
vec3:setmag (m)Rescale a vector to a specific magnitude:
vec3:setmagnew (m)Return a vector copy rescaled to a specific magnitude:
random (mag)Create a new vector in a uniformly random direction:
vec3:randomize (mag)Set to a vector of magnitude 1 in a uniformly random direction:
vec3:length ()return the length of a vector - (Can also use #vector)
dot (a, b)return the dot product of two vectors:
cross (a, b)return the cross product of two vectors:
vec3:distance (p)The distance between two vectors (two points) - (The relative distance from self to p)
anglebetween (a, b)The angle between two vectors (two points) - (The relative angle from self to v)
- -
-
- - -

Functions

-
-
- - vec3 (x, y, z) -
-
- Create a new vector with components x, y, z: - (Can also be used to duplicate a vector: vec3(v)) - -

Parameters:

-
    -
  • x - number or vector (optional, default 0)
  • -
  • y - number (optional, default 0)
  • -
  • z - number (optional, default 0)
  • -
- - - - - -
-
- - copy (v) -
-
- Create a copy of a vector: - -

Parameters:

-
    -
  • v - vector
  • -
- - - - - -
-
- - fromvec2 (v, z) -
-
- Create a copy of a vec2 vector: - -

Parameters:

-
    -
  • v - vec3
  • -
  • z - number
  • -
- - - - - -
-
- - vec3:set (x, y, z) -
-
- Set the components of a vector: - -

Parameters:

-
    -
  • x - component
  • -
  • y - component
  • -
  • z - component
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec3:add (v) -
-
- Add a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to add
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - addnew (a, b) -
-
- Add two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:sub (v) -
-
- Subtract a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to sub
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - subnew (a, b) -
-
- Subtract two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:mul (v) -
-
- Multiply a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to mul
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - mulnew (a, b) -
-
- Multiply two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:div (v) -
-
- Divide a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to div
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - divnew (a, b) -
-
- Divide two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:pow (v) -
-
- Raise to power a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to pow
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - pownew (a, b) -
-
- Raise to power two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:mod (v) -
-
- Calculate modulo a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to mod
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - modnew (a, b) -
-
- Calculate modulo two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:min (v) -
-
- Calculate minimum of elements (in-place) - -

Parameters:

-
    -
  • v - number or vector limit
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - minnew (a, b) -
-
- Calculate minimum of elements to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:max (v) -
-
- Calculate maximum of elements (in-place) - -

Parameters:

-
    -
  • v - number or vector limit
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - maxnew (a, b) -
-
- Calculate maximum of elements to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:clip (lo, hi) -
-
- Constrain vector to range (in-place) - -

Parameters:

-
    -
  • lo - vector or number minimum value
  • -
  • hi - vector or number minimum value
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec3:clip (lo, hi) -
-
- Constrain vector to range to create a new vector - -

Parameters:

-
    -
  • lo - vector or number minimum value
  • -
  • hi - vector or number minimum value
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:relativewrap (dimx, dimy, dimz) -
-
- Determine shortest relative vector in a toroidal space - -

Parameters:

-
    -
  • dimx - width of space (optional, default 1)
  • -
  • dimy - height of space (optional, default dimx)
  • -
  • dimz - depth of space (optional, default dimx)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec3:relativewrapnew (dimx, dimy) -
-
- Create new vector as shortest relative vector in a toroidal space - -

Parameters:

-
    -
  • dimx - width of space (optional, default 1)
  • -
  • dimy - height of space (optional, default dimx)
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:lerp (v, f) -
-
- interpolate from self to v by factor of f - -

Parameters:

-
    -
  • v - vector
  • -
  • f - interpolation factor from self to v (0 = none, 1 = full)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - lerpnew (a, b, f) -
-
- create a vector from the linear interpolation of two vectors: - -

Parameters:

-
    -
  • a - vector
  • -
  • b - vector
  • -
  • f - interpolation factor from a to b (0 = none, 1 = full)
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:normalize () -
-
- set the length of the vector to 1 (unit vector) - (randomized direction if self length was zero) - - -

Returns:

-
    - - self -
- - - - -
-
- - vec3:normalizenew () -
-
- return a normalized copy of the vector - (randomized direction if self length was zero) - - -

Returns:

-
    - - vector of length 1 (unit vector) -
- - - - -
-
- - vec3:limit (maximum) -
-
- Impose a maximum magnitude - Rescales vector if greater than maximum - -

Parameters:

-
    -
  • maximum - maximum magnitude of vector
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec3:limitnew (maximum) -
-
- Create a copy of a vector, limited to a maximum magnitude - Rescales vector if greater than maximum - -

Parameters:

-
    -
  • maximum - maximum magnitude of vector
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:setmag (m) -
-
- Rescale a vector to a specific magnitude: - -

Parameters:

-
    -
  • m - new magnitude
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec3:setmagnew (m) -
-
- Return a vector copy rescaled to a specific magnitude: - -

Parameters:

-
    -
  • m - new magnitude
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - random (mag) -
-
- Create a new vector in a uniformly random direction: - -

Parameters:

-
    -
  • mag - magnitude (optional, default 1)
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec3:randomize (mag) -
-
- Set to a vector of magnitude 1 in a uniformly random direction: - -

Parameters:

-
    -
  • mag - magnitude (optional, default 1)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec3:length () -
-
- return the length of a vector - (Can also use #vector) - - -

Returns:

-
    - - length -
- - - - -
-
- - dot (a, b) -
-
- return the dot product of two vectors: - -

Parameters:

-
    -
  • a - vector
  • -
  • b - vector
  • -
- -

Returns:

-
    - - dot product -
- - - - -
-
- - cross (a, b) -
-
- return the cross product of two vectors: - -

Parameters:

-
    -
  • a - vector
  • -
  • b - vector
  • -
- -

Returns:

-
    - - cross product -
- - - - -
-
- - vec3:distance (p) -
-
- The distance between two vectors (two points) - (The relative distance from self to p) - -

Parameters:

-
    -
  • p - target to measure distance to
  • -
- -

Returns:

-
    - - distance -
- - - - -
-
- - anglebetween (a, b) -
-
- The angle between two vectors (two points) - (The relative angle from self to v) - -

Parameters:

-
    -
  • a - vector to measure angle between
  • -
  • b - vector to measure angle between
  • -
- -

Returns:

-
    - - distance -
- - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/modules/vec4.html b/docs/modules/vec4.html deleted file mode 100644 index c2f72fe..0000000 --- a/docs/modules/vec4.html +++ /dev/null @@ -1,1133 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module vec4

- -

vec4: A simple 3-component vector

-

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
vec4 (x, y, z, w)Create a new vector with components x, y, z: - (Can also be used to duplicate a vector: vec4(v))
copy (v)Create a copy of a vector:
fromvec3 (v, w)Create a copy of a vec2 vector:
fromvec2 (v, z, w)Create a copy of a vec3 vector:
vec4:set (x, y, z, w)Set the components of a vector:
vec4:add (v)Add a vector (or number) to self (in-place)
addnew (a, b)Add two vectors (or numbers) to create a new vector
vec4:sub (v)Subtract a vector (or number) to self (in-place)
subnew (a, b)Subtract two vectors (or numbers) to create a new vector
vec4:mul (v)Multiply a vector (or number) to self (in-place)
mulnew (a, b)Multiply two vectors (or numbers) to create a new vector
vec4:div (v)Divide a vector (or number) to self (in-place)
divnew (a, b)Divide two vectors (or numbers) to create a new vector
vec4:pow (v)Raise to power a vector (or number) to self (in-place)
pownew (a, b)Raise to power two vectors (or numbers) to create a new vector
vec4:mod (v)Calculate modulo a vector (or number) to self (in-place)
modnew (a, b)Calculate modulo two vectors (or numbers) to create a new vector
vec4:min (v)Calculate minimum of elements (in-place)
minnew (a, b)Calculate minimum of elements to create a new vector
vec4:max (v)Calculate maximum of elements (in-place)
maxnew (a, b)Calculate maximum of elements to create a new vector
vec4:clip (lo, hi)Constrain vector to range (in-place)
vec4:clip (lo, hi)Constrain vector to range to create a new vector
vec4:relativewrap (dimx, dimy, dimz, dimw)Determine shortest relative vector in a toroidal space
vec4:relativewrapnew (dimx, dimy, dimz, dimw)Create new vector as shortest relative vector in a toroidal space
vec4:lerp (v, f)interpolate from self to v by factor of f
lerpnew (a, b, f)create a vector from the linear interpolation of two vectors:
vec4:normalize ()set the length of the vector to 1 (unit vector) - (randomized direction if self length was zero)
vec4:normalizenew ()return a normalized copy of the vector - (randomized direction if self length was zero)
vec4:limit (maximum)Impose a maximum magnitude - Rescales vector if greater than maximum
vec4:limitnew (maximum)Create a copy of a vector, limited to a maximum magnitude - Rescales vector if greater than maximum
vec4:setmag (m)Rescale a vector to a specific magnitude:
vec4:setmagnew (m)Return a vector copy rescaled to a specific magnitude:
vec4:length ()return the length of a vector - (Can also use #vector)
dot (a, b)return the dot product of two vectors:
vec4:distance (p)The distance between two vectors (two points) - (The relative distance from self to p)
anglebetween (a, b)The angle between two vectors (two points) - (The relative angle from self to v)
- -
-
- - -

Functions

-
-
- - vec4 (x, y, z, w) -
-
- Create a new vector with components x, y, z: - (Can also be used to duplicate a vector: vec4(v)) - -

Parameters:

-
    -
  • x - number or vector (optional, default 0)
  • -
  • y - number (optional, default 0)
  • -
  • z - number (optional, default 0)
  • -
  • w - number (optional, default 0)
  • -
- - - - - -
-
- - copy (v) -
-
- Create a copy of a vector: - -

Parameters:

-
    -
  • v - vector to copy
  • -
- - - - - -
-
- - fromvec3 (v, w) -
-
- Create a copy of a vec2 vector: - -

Parameters:

-
    -
  • v - vec3
  • -
  • w - number (optional, default 1)
  • -
- - - - - -
-
- - fromvec2 (v, z, w) -
-
- Create a copy of a vec3 vector: - -

Parameters:

-
    -
  • v - vec3
  • -
  • z - number (optional, default 0)
  • -
  • w - number (optional, default 1)
  • -
- - - - - -
-
- - vec4:set (x, y, z, w) -
-
- Set the components of a vector: - -

Parameters:

-
    -
  • x - component (optional, default 0)
  • -
  • y - component (optional, default 0)
  • -
  • z - component (optional, default 0)
  • -
  • w - component (optional, default 0)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec4:add (v) -
-
- Add a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to add
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - addnew (a, b) -
-
- Add two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:sub (v) -
-
- Subtract a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to sub
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - subnew (a, b) -
-
- Subtract two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:mul (v) -
-
- Multiply a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to mul
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - mulnew (a, b) -
-
- Multiply two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:div (v) -
-
- Divide a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to div
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - divnew (a, b) -
-
- Divide two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:pow (v) -
-
- Raise to power a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to pow
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - pownew (a, b) -
-
- Raise to power two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:mod (v) -
-
- Calculate modulo a vector (or number) to self (in-place) - -

Parameters:

-
    -
  • v - number or vector to mod
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - modnew (a, b) -
-
- Calculate modulo two vectors (or numbers) to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:min (v) -
-
- Calculate minimum of elements (in-place) - -

Parameters:

-
    -
  • v - number or vector limit
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - minnew (a, b) -
-
- Calculate minimum of elements to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:max (v) -
-
- Calculate maximum of elements (in-place) - -

Parameters:

-
    -
  • v - number or vector limit
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - maxnew (a, b) -
-
- Calculate maximum of elements to create a new vector - -

Parameters:

-
    -
  • a - vector or number
  • -
  • b - vector or number
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:clip (lo, hi) -
-
- Constrain vector to range (in-place) - -

Parameters:

-
    -
  • lo - vector or number minimum value
  • -
  • hi - vector or number minimum value
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec4:clip (lo, hi) -
-
- Constrain vector to range to create a new vector - -

Parameters:

-
    -
  • lo - vector or number minimum value
  • -
  • hi - vector or number minimum value
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:relativewrap (dimx, dimy, dimz, dimw) -
-
- Determine shortest relative vector in a toroidal space - -

Parameters:

-
    -
  • dimx - width of space (optional, default 1)
  • -
  • dimy - height of space (optional, default dimx)
  • -
  • dimz - depth of space (optional, default dimx)
  • -
  • dimw - fourth dimension of space (optional, default dimx)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec4:relativewrapnew (dimx, dimy, dimz, dimw) -
-
- Create new vector as shortest relative vector in a toroidal space - -

Parameters:

-
    -
  • dimx - width of space (optional, default 1)
  • -
  • dimy - height of space (optional, default dimx)
  • -
  • dimz - depth of space (optional, default dimx)
  • -
  • dimw - fourth dimension of space (optional, default dimx)
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:lerp (v, f) -
-
- interpolate from self to v by factor of f - -

Parameters:

-
    -
  • v - vector
  • -
  • f - interpolation factor from self to v (0 = none, 1 = full)
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - lerpnew (a, b, f) -
-
- create a vector from the linear interpolation of two vectors: - -

Parameters:

-
    -
  • a - vector
  • -
  • b - vector
  • -
  • f - interpolation factor from a to b (0 = none, 1 = full)
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:normalize () -
-
- set the length of the vector to 1 (unit vector) - (randomized direction if self length was zero) - - -

Returns:

-
    - - self -
- - - - -
-
- - vec4:normalizenew () -
-
- return a normalized copy of the vector - (randomized direction if self length was zero) - - -

Returns:

-
    - - vector of length 1 (unit vector) -
- - - - -
-
- - vec4:limit (maximum) -
-
- Impose a maximum magnitude - Rescales vector if greater than maximum - -

Parameters:

-
    -
  • maximum - maximum magnitude of vector
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec4:limitnew (maximum) -
-
- Create a copy of a vector, limited to a maximum magnitude - Rescales vector if greater than maximum - -

Parameters:

-
    -
  • maximum - maximum magnitude of vector
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:setmag (m) -
-
- Rescale a vector to a specific magnitude: - -

Parameters:

-
    -
  • m - new magnitude
  • -
- -

Returns:

-
    - - self -
- - - - -
-
- - vec4:setmagnew (m) -
-
- Return a vector copy rescaled to a specific magnitude: - -

Parameters:

-
    -
  • m - new magnitude
  • -
- -

Returns:

-
    - - new vector -
- - - - -
-
- - vec4:length () -
-
- return the length of a vector - (Can also use #vector) - - -

Returns:

-
    - - length -
- - - - -
-
- - dot (a, b) -
-
- return the dot product of two vectors: - -

Parameters:

-
    -
  • a - vector
  • -
  • b - vector
  • -
- -

Returns:

-
    - - dot product -
- - - - -
-
- - vec4:distance (p) -
-
- The distance between two vectors (two points) - (The relative distance from self to p) - -

Parameters:

-
    -
  • p - target to measure distance to
  • -
- -

Returns:

-
    - - distance -
- - - - -
-
- - anglebetween (a, b) -
-
- The angle between two vectors (two points) - (The relative angle from self to v) - -

Parameters:

-
    -
  • a - vector to measure angle between
  • -
  • b - vector to measure angle between
  • -
- -

Returns:

-
    - - distance -
- - - - -
-
- - -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/docs/reference.html b/docs/reference.html deleted file mode 100644 index b15bab3..0000000 --- a/docs/reference.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - Reference - - - - -
- -
- -
-
-
- - -
- - - - - - -
- - - - -

Modules

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
allosphereallosphere: Utilities relating specifically to the AlloSphere
audioaudio: accessing the audio system
audioprocessaudioprocess: (audio thread internal use only)
displaylistdisplaylist: A friendly wrapper for OpenGL display lists
draw2DDraw2D: simple drawing primitives for 2D graphics
draw3Ddraw3D: utilities for 3D OpenGL
field2DField2D: an object representing a 2D densely packed array.
field3DField3D: an object representing a 3D densely packed array.
ioReading and Writing Files.
mat4mat4: A 4x4 matrix
mathstandard mathematical functions.
nav3nav3: utilities for 3D navigation
osOperating System facilities like date, time and program execution.
quatquat: A simple 2-component vector
stringstring operations like searching and matching.
tablemanipulating Lua tables.
utilA collection of highly re-usable Lua utilities
vec2vec2: A simple 2-component vector
vec3vec3: A simple 3-component vector
vec4vec4: A simple 3-component vector
- -
-
-
-generated by LDoc 1.3 -
-
- - diff --git a/audio.test.lua b/examples/audio.test.lua similarity index 100% rename from audio.test.lua rename to examples/audio.test.lua diff --git a/audio_script.lua b/examples/audio_script.lua similarity index 100% rename from audio_script.lua rename to examples/audio_script.lua diff --git a/draw.lua b/examples/draw.lua similarity index 100% rename from draw.lua rename to examples/draw.lua diff --git a/glfw_test.lua b/examples/glfw_test.lua similarity index 100% rename from glfw_test.lua rename to examples/glfw_test.lua diff --git a/kqueue.lua b/examples/kqueue.lua similarity index 100% rename from kqueue.lua rename to examples/kqueue.lua diff --git a/no.lua b/examples/no.lua similarity index 100% rename from no.lua rename to examples/no.lua diff --git a/omni.lua b/examples/omni.lua similarity index 100% rename from omni.lua rename to examples/omni.lua diff --git a/start.lua b/examples/start.lua similarity index 100% rename from start.lua rename to examples/start.lua diff --git a/test.lua b/examples/test.lua similarity index 100% rename from test.lua rename to examples/test.lua diff --git a/glut32.dll b/glut32.dll deleted file mode 100644 index 106646f..0000000 Binary files a/glut32.dll and /dev/null differ diff --git a/install_dependencies_linux.sh b/install_dependencies_linux.sh deleted file mode 100644 index fa95ccf..0000000 --- a/install_dependencies_linux.sh +++ /dev/null @@ -1,18 +0,0 @@ -sudo apt-get install libusb-1.0-dev - -mkdir -p externs -cd externs - - -git clone git://github.com/OpenKinect/libfreenect.git -pushd libfreenect -mkdir build -cd build -cmake .. -make - -cp lib/libfreenect.* ../../../linux/lib64/ - -sudo cp ../platform/linux/udev/51-kinect.rules /etc/udev/rules.d - -popd diff --git a/lua51.dll b/lua51.dll deleted file mode 100644 index eb9f0f4..0000000 Binary files a/lua51.dll and /dev/null differ diff --git a/modules/lib/OSX/AntTweakBar.dylib b/modules/lib/OSX/AntTweakBar.dylib deleted file mode 100755 index 8618494..0000000 Binary files a/modules/lib/OSX/AntTweakBar.dylib and /dev/null differ diff --git a/modules/lib/OSX/cairo.dylib b/modules/lib/OSX/cairo.dylib deleted file mode 100755 index 7e8cae0..0000000 Binary files a/modules/lib/OSX/cairo.dylib and /dev/null differ diff --git a/modules/lib/OSX/egl.dylib b/modules/lib/OSX/egl.dylib deleted file mode 100755 index 9ba0e91..0000000 Binary files a/modules/lib/OSX/egl.dylib and /dev/null differ diff --git a/modules/lib/OSX/freeimage.dylib b/modules/lib/OSX/freeimage.dylib deleted file mode 100644 index 57430e5..0000000 Binary files a/modules/lib/OSX/freeimage.dylib and /dev/null differ diff --git a/modules/lib/OSX/freenect.dylib b/modules/lib/OSX/freenect.dylib deleted file mode 100755 index 05bae3d..0000000 Binary files a/modules/lib/OSX/freenect.dylib and /dev/null differ diff --git a/modules/lib/OSX/gles2.dylib b/modules/lib/OSX/gles2.dylib deleted file mode 100755 index f3e0edf..0000000 Binary files a/modules/lib/OSX/gles2.dylib and /dev/null differ diff --git a/modules/lib/OSX/glfw.dylib b/modules/lib/OSX/glfw.dylib deleted file mode 100755 index 351f64e..0000000 Binary files a/modules/lib/OSX/glfw.dylib and /dev/null differ diff --git a/modules/lib/OSX/glfw3.dylib b/modules/lib/OSX/glfw3.dylib deleted file mode 100755 index 044345c..0000000 Binary files a/modules/lib/OSX/glfw3.dylib and /dev/null differ diff --git a/modules/lib/OSX/libclang.dylib b/modules/lib/OSX/libclang.dylib deleted file mode 100755 index 7cf7fe0..0000000 Binary files a/modules/lib/OSX/libclang.dylib and /dev/null differ diff --git a/modules/lib/OSX/pgm.dylib b/modules/lib/OSX/pgm.dylib deleted file mode 100755 index 4256181..0000000 Binary files a/modules/lib/OSX/pgm.dylib and /dev/null differ diff --git a/modules/lib/OSX/pixman.dylib b/modules/lib/OSX/pixman.dylib deleted file mode 100755 index 3c5d1ba..0000000 Binary files a/modules/lib/OSX/pixman.dylib and /dev/null differ diff --git a/modules/lib/OSX/png.dylib b/modules/lib/OSX/png.dylib deleted file mode 100755 index 4d38d0f..0000000 Binary files a/modules/lib/OSX/png.dylib and /dev/null differ diff --git a/modules/lib/OSX/sdl.dylib b/modules/lib/OSX/sdl.dylib deleted file mode 100755 index 4b1649d..0000000 Binary files a/modules/lib/OSX/sdl.dylib and /dev/null differ diff --git a/modules/lib/OSX/zmq.dylib b/modules/lib/OSX/zmq.dylib deleted file mode 100755 index bb1be9e..0000000 Binary files a/modules/lib/OSX/zmq.dylib and /dev/null differ diff --git a/modules/system/osx/darwin.lua b/modules/system/osx/darwin.lua deleted file mode 100644 index f590b4d..0000000 --- a/modules/system/osx/darwin.lua +++ /dev/null @@ -1,280 +0,0 @@ -local ffi = require "ffi" -local C = ffi.C -local bit = require "bit" -local band, bor = bit.band, bit.bor - ---[[ -The bits of darwin that I needed: ---]] - -local darwin = [[ -// types.h -typedef uint32_t socklen_t; -typedef uint8_t sa_family_t; -typedef long ssize_t; - -// errno.h -enum { - EPERM = 1, - ENOENT, - ESRCH, - EINTR, - EIO, - ENXIO, - E2BIG, - ENOEXEC, - EBADF, - ECHILD, - EDEADLK, - ENOMEM, - EACCES, - EFAULT, - ENOTBLK, - EBUSY, - EEXIST, - EXDEV, - ENODEV, - ENOTDIR, - EISDIR, - EINVAL, - ENFILE, - EMFILE -}; - -// time.h -struct timespec { - long tv_sec; - long tv_nsec; -}; - -// unistd.h -enum { - O_RDONLY = 0x0000, /* open for reading only */ - O_WRONLY = 0x0001, /* open for writing only */ - O_RDWR = 0x0002, /* open for reading and writing */ - O_ACCMODE = 0x0003, /* mask for above modes */ - - O_EVTONLY = 0x8000 -}; - -enum { - S_IWRITE = 0000200, - S_IREAD = 0000400 -}; - -int open( const char *filename, int access); -int close(int); -int gethostname(char *, size_t); -ssize_t read(int fildes, void *buf, size_t nbyte); - -// string.h -char *strerror(int); - -// socket.h - -static const int SOL_SOCKET = 0xffff; -static const int AF_UNSPEC = 0; -static const int AF_INET = 2; -static const int AF_INET6 = 30; -static const int PF_UNSPEC = 0; -static const int AI_PASSIVE = 0x00000001; /* get address to use bind() */ - -static const int SO_DEBUG = 0x0001; /* turn on debugging info recording */ -static const int SO_ACCEPTCONN = 0x0002; /* socket has had listen() */ -static const int SO_REUSEADDR = 0x0004; /* allow local address reuse */ -static const int SO_KEEPALIVE = 0x0008; /* keep connections alive */ -static const int SO_DONTROUTE = 0x0010; /* just use interface addresses */ -static const int SO_BROADCAST = 0x0020; /* permit sending of broadcast msgs */ -static const int SO_USELOOPBACK = 0x0040; /* bypass hardware when possible */ -static const int SO_LINGER = 0x0080; /* linger on close if data present (in ticks) */ -static const int SO_OOBINLINE = 0x0100; /* leave received OOB data in line */ -static const int SO_REUSEPORT = 0x0200; /* allow local address & port reuse */ -static const int SO_TIMESTAMP = 0x0400; /* timestamp received dgram traffic */ - -enum { - SOCK_STREAM = 1, /* stream socket */ - SOCK_DGRAM = 2, /* datagram socket */ - SOCK_RAW = 3, /* raw-protocol interface */ - SOCK_RDM = 4, /* reliably-delivered message */ - SOCK_SEQPACKET = 5 /* sequenced packet stream */ -}; - -struct sockaddr { - uint8_t sa_len; /* total length */ - sa_family_t sa_family; /* [XSI] address family */ - char sa_data[14]; /* [XSI] addr value (actually larger) */ -}; - -static const int _SS_PAD1SIZE = 6; -static const int _SS_PAD2SIZE = 112; -struct sockaddr_storage { - uint8_t ss_len; /* address length */ - sa_family_t ss_family; /* [XSI] address family */ - char __ss_pad1[_SS_PAD1SIZE]; - int64_t __ss_align; /* force structure storage alignment */ - char __ss_pad2[_SS_PAD2SIZE]; -}; - -// for IPv4: -struct in_addr { - uint32_t s_addr; // that's a 32-bit int (4 bytes) -}; -struct sockaddr_in { - short int sin_family; // Address family, AF_INET - unsigned short int sin_port; // Port number - struct in_addr sin_addr; // Internet address - unsigned char sin_zero[8]; // Same size as struct sockaddr -}; - -int accept(int, struct sockaddr *, socklen_t *); -int bind(int, const struct sockaddr *, socklen_t); -int connect(int, const struct sockaddr *, socklen_t); -int getpeername(int, struct sockaddr *, socklen_t *); -int getsockname(int, struct sockaddr *, socklen_t *); -int getsockopt(int, int, int, void *, socklen_t *); -int listen(int, int); -ssize_t recv(int, void *, size_t, int); -ssize_t recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *); -ssize_t recvmsg(int, struct msghdr *, int); -ssize_t send(int, const void *, size_t, int); -ssize_t sendmsg(int, const struct msghdr *, int); -ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t); -int setsockopt(int, int, int, const void *, socklen_t); -int shutdown(int, int); -int sockatmark(int); -int socket(int, int, int); - -// netdb.h -struct addrinfo { - int ai_flags; // AI_PASSIVE, AI_CANONNAME, etc. - int ai_family; // AF_INET, AF_INET6, AF_UNSPEC - int ai_socktype; // SOCK_STREAM, SOCK_DGRAM - int ai_protocol; // use 0 for "any" - size_t ai_addrlen; // size of ai_addr in bytes - char *ai_canonname; // full canonical hostname - struct sockaddr *ai_addr; // struct sockaddr_in or _in6 - struct addrinfo *ai_next; // linked list, next node -}; - -struct hostent { - char *h_name; /* official name of host */ - char **h_aliases; /* alias list */ - int h_addrtype; /* host address type */ - int h_length; /* length of address */ - char **h_addr_list; /* list of addresses from name server */ -}; - -const char * gai_strerror(int); -int getaddrinfo(const char *node, // e.g. "www.example.com" or IP - const char *service, // e.g. "http" or port number - const struct addrinfo *hints, - struct addrinfo **res); -void freeaddrinfo(struct addrinfo *); - -struct hostent *gethostbyname(const char *); - -// in.h -static const int INADDR_ANY = 0x00000000; -static const int INADDR_BROADCAST = 0xffffffff; -static const int INADDR_LOOPBACK = 0x7f000001; - -static const int INET_ADDRSTRLEN = 16; - -// in6.h -static const int INET6_ADDRSTRLEN = 46; - -// for IPv6: -struct in6_addr { - unsigned char s6_addr[16]; // IPv6 address -}; -struct sockaddr_in6 { - uint16_t sin6_family; // address family, AF_INET6 - uint16_t sin6_port; // port number, Network Byte Order - uint32_t sin6_flowinfo; // IPv6 flow information - struct in6_addr sin6_addr; // IPv6 address - uint32_t sin6_scope_id; // Scope ID -}; - -// #include -const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); -int inet_pton(int af, const char *src, void *dst); - -// kqueue.h -static const int EVFILT_READ = (-1); -static const int EVFILT_WRITE = (-2); -static const int EVFILT_AIO = (-3); /* attached to aio requests */ -static const int EVFILT_VNODE = (-4); /* attached to vnodes */ -static const int EVFILT_PROC = (-5); /* attached to struct proc */ -static const int EVFILT_SIGNAL = (-6); /* attached to struct proc */ -static const int EVFILT_TIMER = (-7); /* timers */ -static const int EVFILT_MACHPORT = (-8); /* Mach portsets */ -static const int EVFILT_FS = (-9); /* Filesystem events */ -static const int EVFILT_USER = (-10); /* User events */ -static const int EVFILT_SESSION = (-11); /* Audit session events */ -static const int EVFILT_SYSCOUNT = 11; - -enum { - EV_ADD = 0x0001, /* add event to kq (implies enable) */ - EV_DELETE = 0x0002, /* delete event from kq */ - EV_ENABLE = 0x0004, /* enable event */ - EV_DISABLE = 0x0008, /* disable event (not reported) */ - - EV_ONESHOT = 0x0010, /* only report one occurrence */ - EV_CLEAR = 0x0020, /* clear event state after reporting */ - EV_RECEIPT = 0x0040, /* force EV_ERROR on success, data == 0 */ - EV_DISPATCH = 0x0080, /* disable event after reporting */ - - EV_FLAG0 = 0x1000, /* filter-specific flag */ - EV_FLAG1 = 0x2000, /* filter-specific flag */ - - EV_ERROR = 0x4000, /* error, data contains errno */ - EV_EOF = 0x8000, /* EOF detected */ - - EV_SYSFLAGS = 0xF000 /* reserved by system */ -}; - -enum { - NOTE_DELETE = 0x00000001, /* vnode was removed */ - NOTE_WRITE = 0x00000002, /* data contents changed */ - NOTE_EXTEND = 0x00000004, /* size increased */ - NOTE_ATTRIB = 0x00000008, /* attributes changed */ - NOTE_LINK = 0x00000010, /* link count changed */ - NOTE_RENAME = 0x00000020, /* vnode was renamed */ - NOTE_REVOKE = 0x00000040, /* vnode access was revoked */ - NOTE_NONE = 0x00000080 -}; - -struct kevent { - uintptr_t ident; /* identifier for this event */ - int16_t filter; /* filter for event */ - uint16_t flags; /* general flags */ - uint32_t fflags; /* filter-specific flags */ - intptr_t data; /* filter-specific data */ - void *udata; /* opaque user data identifier */ -}; - -struct kevent64_s { - uint64_t ident; /* identifier for this event */ - int16_t filter; /* filter for event */ - uint16_t flags; /* general flags */ - uint32_t fflags; /* filter-specific flags */ - int64_t data; /* filter-specific data */ - uint64_t udata; /* opaque user data identifier */ - uint64_t ext[2]; /* filter-specific extensions */ -}; - - -int kqueue(void); -int kevent(int kq, const struct kevent *changelist, int nchanges, - struct kevent *eventlist, int nevents, - const struct timespec *timeout); -int kevent64(int kq, const struct kevent64_s *changelist, - int nchanges, struct kevent64_s *eventlist, - int nevents, unsigned int flags, - const struct timespec *timeout); - -]] - -ffi.cdef(darwin) - -return C \ No newline at end of file diff --git a/modules/system/osx/kqueue.lua b/modules/system/osx/kqueue.lua deleted file mode 100644 index a40d567..0000000 --- a/modules/system/osx/kqueue.lua +++ /dev/null @@ -1,78 +0,0 @@ -local ffi = require "ffi" -local C = ffi.C - -local darwin = require "system.osx.darwin" - -local kqueue = {} - -function kqueue.EV_SET(kevp, a, b, c, d, e, f) - --kevp should be of type struct kevent * - kevp.ident = a - kevp.filter = b - kevp.flags = c - kevp.fflags = d - kevp.data = e - kevp.udata = f -end - -function kqueue.errno() - -- find the error: - local errno = ffi.errno() - - -- why not just error(ffi.string(C.strerror(ffi.errno())))? - - if errno == C.EACCES then - error("kevent: The process does not have permission to register a filter.") - elseif errno == C.EFAULT then - error("kevent: There was an error reading or writing the kevent or kevent64_s structure.") - elseif errno == C.EBADF then - error("kevent: The specified descriptor is invalid.") - elseif errno == C.EINTR then - error("kevent: A signal was delivered before the timeout expired and before any events were placed on the kqueue for return.") - elseif errno == C.EINVAL then - error("kevent: The specified time limit or filter is invalid.") - elseif errno == C.ENOENT then - error("kevent: The event could not be found to be modified or deleted.") - elseif errno == C.ENOMEM then - error("kevent: No memory was available to register the event.") - elseif errno == C.ESRCH then - error("kevent: The specified process to attach to does not exist.") - else - error("kevent") - end -end - --- a changelist: -local change = ffi.new("struct kevent[1]") - -function kqueue.addfilter(kq, fd, filter, flags, filterflags, filterdata) - kqueue.EV_SET(change[0], - -- event identifier (e.g. file descriptor) - fd, - -- event filter - -- EVFILT_READ/EVFILT_WRITE, EVFILT_VNODE, EVFILT_PROC, EVFILT_SIGNAL, EVFILT_MACHPORT, EVFILT_TIMER - filter, - -- general flags - -- EV_ADD/EV_DELETE, EV_ENABLE/EV_DISABLE, EV_ONESHOT, EV_CLEAR - flags or C.EV_ADD, - -- filter flags - -- NOTE_DELETE, NOTE_WRITE, NOTE_EXTEND, NOTE_ATTRIB, NOTE_LINK, NOTE_RENAME, NOTE_REVOKE - -- NOTE_SECONDS, NOTE_USECONDS, NOTE_NSECONDS - filterflags or 0, - -- filter data - filterdata or 0, - -- other data - nil) - -- add to pollset: - if C.kevent(kq, change, 1, nil, 0, nil) == -1 then - kqueue.errno() - end -end - -function kqueue.new() - local kq = C.kqueue() - if kq == -1 then error("failed to initialize kqueue") end - return kq -end - -return kqueue \ No newline at end of file diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..f182b46 --- /dev/null +++ b/notes.txt @@ -0,0 +1,14 @@ +AntTweakBar.dylib +cairo.dylib +egl.dylib +freeimage.dylib +freenect.dylib +gles2.dylib +glfw.dylib +glfw3.dylib +libclang.dylib +pgm.dylib +pixman.dylib +png.dylib +sdl.dylib +zmq.dylib diff --git a/src/rtaudio-4.0.11/RtAudio.cpp b/source/RtAudio.cpp similarity index 100% rename from src/rtaudio-4.0.11/RtAudio.cpp rename to source/RtAudio.cpp diff --git a/src/rtaudio-4.0.11/RtAudio.h b/source/RtAudio.h similarity index 100% rename from src/rtaudio-4.0.11/RtAudio.h rename to source/RtAudio.h diff --git a/src/rtaudio-4.0.11/RtError.h b/source/RtError.h similarity index 100% rename from src/rtaudio-4.0.11/RtError.h rename to source/RtError.h diff --git a/src/av.cpp b/source/av.cpp similarity index 99% rename from src/av.cpp rename to source/av.cpp index bd164fd..777ff8e 100644 --- a/src/av.cpp +++ b/source/av.cpp @@ -1,6 +1,6 @@ #include "av.hpp" -#include "rgbd.h" +//#include "rgbd.h" #include #include @@ -496,8 +496,8 @@ lua_State * av_init_lua() { lua_getfield(L, -1, "preload"); lua_pushcfunction(L, luaopen_builtin); lua_setfield(L, -2, "builtin"); - lua_pushcfunction(L, luaopen_lpeg); - lua_setfield(L, -2, "lpeg"); + //lua_pushcfunction(L, luaopen_lpeg); + //lua_setfield(L, -2, "lpeg"); lua_pop(L, 2); lua_getglobal(L, "debug"); diff --git a/src/av.h b/source/av.h similarity index 100% rename from src/av.h rename to source/av.h diff --git a/src/av.hpp b/source/av.hpp similarity index 100% rename from src/av.hpp rename to source/av.hpp diff --git a/src/av_audio.cpp b/source/av_audio.cpp similarity index 100% rename from src/av_audio.cpp rename to source/av_audio.cpp diff --git a/src/h2ffi.lua b/source/h2ffi.lua old mode 100755 new mode 100644 similarity index 100% rename from src/h2ffi.lua rename to source/h2ffi.lua diff --git a/src/main.lua b/source/main.lua similarity index 94% rename from src/main.lua rename to source/main.lua index e2fe53e..9c07639 100644 --- a/src/main.lua +++ b/source/main.lua @@ -96,10 +96,10 @@ function spawn(filename) -- preload lpeg: L:getglobal("package") L:getfield(-1, "preload") - L:pushcfunction(C.luaopen_lpeg) - L:setfield(-2, "lpeg") - L:pushcfunction(C.luaopen_http_parser) - L:setfield(-2, "http.parser") + -- L:pushcfunction(C.luaopen_lpeg) + -- L:setfield(-2, "lpeg") + -- L:pushcfunction(C.luaopen_http_parser) + -- L:setfield(-2, "http.parser") L:settop(0) states[filename] = L diff --git a/src/av-Info.plist b/src/av-Info.plist deleted file mode 100644 index 3ba93b5..0000000 --- a/src/av-Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/src/av.lib b/src/av.lib deleted file mode 100644 index 97b0642..0000000 Binary files a/src/av.lib and /dev/null differ diff --git a/src/av.xcodeproj/project.pbxproj b/src/av.xcodeproj/project.pbxproj deleted file mode 100644 index f8be2ec..0000000 --- a/src/av.xcodeproj/project.pbxproj +++ /dev/null @@ -1,798 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXAggregateTarget section */ - 362BFEA216E358BE00405F7A /* build.sh */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 362BFEB116E358C900405F7A /* Build configuration list for PBXAggregateTarget "build.sh" */; - buildPhases = ( - 362BFEA116E358BE00405F7A /* ShellScript */, - ); - dependencies = ( - ); - name = build.sh; - productName = build.sh; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 36228CF916EC4C9800BB8932 /* av.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 362BFEB316E3598800405F7A /* av.cpp */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 36228DF116EC738100BB8932 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 362BFE8116E3586E00405F7A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 362BFEA216E358BE00405F7A; - remoteInfo = build.sh; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 3610AA82172F827D002DE83B /* HISTORY */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HISTORY; sourceTree = ""; }; - 3610AA83172F827D002DE83B /* lpcap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpcap.c; sourceTree = ""; }; - 3610AA84172F827D002DE83B /* lpcap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lpcap.h; sourceTree = ""; }; - 3610AA85172F827D002DE83B /* lpcode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpcode.c; sourceTree = ""; }; - 3610AA86172F827D002DE83B /* lpcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lpcode.h; sourceTree = ""; }; - 3610AA87172F827D002DE83B /* lpeg-128.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "lpeg-128.gif"; sourceTree = ""; }; - 3610AA88172F827D002DE83B /* lpeg.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = lpeg.html; sourceTree = ""; }; - 3610AA89172F827D002DE83B /* lpprint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpprint.c; sourceTree = ""; }; - 3610AA8A172F827D002DE83B /* lpprint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lpprint.h; sourceTree = ""; }; - 3610AA8B172F827D002DE83B /* lptree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lptree.c; sourceTree = ""; }; - 3610AA8C172F827D002DE83B /* lptree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lptree.h; sourceTree = ""; }; - 3610AA8D172F827D002DE83B /* lptypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lptypes.h; sourceTree = ""; }; - 3610AA8E172F827D002DE83B /* lpvm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpvm.c; sourceTree = ""; }; - 3610AA8F172F827D002DE83B /* lpvm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lpvm.h; sourceTree = ""; }; - 3610AA90172F827D002DE83B /* makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = ""; }; - 3610AA91172F827D002DE83B /* re.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = re.html; sourceTree = ""; }; - 3610AA92172F827D002DE83B /* re.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = re.lua; sourceTree = ""; }; - 3610AA93172F827D002DE83B /* test.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = test.lua; sourceTree = ""; }; - 3616CAC2170BCF9B0084E438 /* av_audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = av_audio.cpp; sourceTree = ""; }; - 3616CAC9170BD0E20084E438 /* audio.test.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; name = audio.test.lua; path = ../audio.test.lua; sourceTree = SOURCE_ROOT; }; - 3616CDCB170C3F570084E438 /* msg.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = msg.lua; sourceTree = ""; }; - 36228CEF16EC4C6D00BB8932 /* av.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = av.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 36228CF216EC4C6D00BB8932 /* av-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "av-Info.plist"; sourceTree = ""; }; - 36228D3416EC4F5300BB8932 /* makeluajitosx.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = makeluajitosx.sh; sourceTree = ""; }; - 36228E4916EC769600BB8932 /* build.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = build.sh; sourceTree = ""; }; - 36228E5816EC781300BB8932 /* start.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; name = start.lua; path = ../start.lua; sourceTree = ""; }; - 36228E9316EC7C7000BB8932 /* makefile */ = {isa = PBXFileReference; fileEncoding = 2147484672; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = ""; }; - 362290D916EC91B800BB8932 /* main.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = main.lua; sourceTree = ""; }; - 3624310F16ED8D7F00C9732C /* draw.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; name = draw.lua; path = ../draw.lua; sourceTree = SOURCE_ROOT; }; - 362BFEB316E3598800405F7A /* av.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = av.cpp; sourceTree = ""; }; - 362BFF3C16E3616900405F7A /* av.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = av.h; sourceTree = ""; }; - 362BFF4A16E3627B00405F7A /* h2ffi.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = h2ffi.lua; sourceTree = ""; }; - 362BFF5216E3643D00405F7A /* av_ffi_header.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = av_ffi_header.cpp; sourceTree = ""; }; - 366E1CE6170AA027002F9F53 /* kqueue.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; name = kqueue.lua; path = ../kqueue.lua; sourceTree = SOURCE_ROOT; }; - 366E1CEA170AA04B002F9F53 /* ignore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ignore.cpp; sourceTree = ""; }; - 366E1CFB170AA57A002F9F53 /* clang.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; name = clang.lua; path = ../clang.lua; sourceTree = SOURCE_ROOT; }; - 366E1D24170AA95A002F9F53 /* Index.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Index.h; path = ../Index.h; sourceTree = SOURCE_ROOT; }; - 366E26ED170AF7AB002F9F53 /* cindex.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; name = cindex.lua; path = ../cindex.lua; sourceTree = SOURCE_ROOT; }; - 366E26EE170AF7AB002F9F53 /* cindex.test.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; name = cindex.test.lua; path = ../cindex.test.lua; sourceTree = SOURCE_ROOT; }; - 3689A2511740FE82001CDA25 /* bullet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bullet.cpp; sourceTree = ""; }; - 3689A2561741063F001CDA25 /* modules */ = {isa = PBXFileReference; lastKnownFileType = folder; name = modules; path = ../modules; sourceTree = SOURCE_ROOT; }; - 3689ACBA17410678001CDA25 /* bullets.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; name = bullets.lua; path = ../bullets.lua; sourceTree = SOURCE_ROOT; }; - 3689AD0A17421CB8001CDA25 /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; name = src; path = "../../bullet-read-only/src"; sourceTree = SOURCE_ROOT; }; - 368C279A16F97B5500AB3D5D /* rgbd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rgbd.h; sourceTree = ""; }; - 368C279B16F97B5500AB3D5D /* rgbd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rgbd.cpp; sourceTree = ""; }; - 368C279D16F97BBE00AB3D5D /* av.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = av.hpp; sourceTree = ""; }; - 368C27F816F9828A00AB3D5D /* snap.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; name = snap.lua; path = ../snap.lua; sourceTree = SOURCE_ROOT; }; - 36C3E0B016E4400A007407CF /* devnotes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = devnotes.txt; sourceTree = ""; }; - 36C6556E16E4419600FDE98B /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.md; path = ../README.md; sourceTree = SOURCE_ROOT; }; - 36F00C641762F9B600FD0902 /* .git */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .git; sourceTree = ""; }; - 36F00C651762F9B600FD0902 /* .gitattributes */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitattributes; sourceTree = ""; }; - 36F00C661762F9B600FD0902 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 36F00C671762F9B600FD0902 /* AUTHORS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AUTHORS.txt; sourceTree = ""; }; - 36F00C681762F9B600FD0902 /* bootstrap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = bootstrap; sourceTree = ""; }; - 36F00C691762F9B600FD0902 /* configure.ac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = configure.ac; sourceTree = ""; }; - 36F00C6B1762F9B600FD0902 /* Doxyfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Doxyfile; sourceTree = ""; }; - 36F00C6C1762F9B600FD0902 /* HACKING.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HACKING.txt; sourceTree = ""; }; - 36F00C6E1762F9B600FD0902 /* hidapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hidapi.h; sourceTree = ""; }; - 36F00C701762F9B600FD0902 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 36F00C711762F9B600FD0902 /* hidtest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = hidtest.cpp; sourceTree = ""; }; - 36F00C721762F9B600FD0902 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; - 36F00C741762F9B600FD0902 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 36F00C751762F9B600FD0902 /* hid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hid.c; sourceTree = ""; }; - 36F00C761762F9B600FD0902 /* Makefile-manual */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Makefile-manual"; sourceTree = ""; }; - 36F00C771762F9B600FD0902 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; - 36F00C781762F9B600FD0902 /* Makefile.freebsd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.freebsd; sourceTree = ""; }; - 36F00C791762F9B600FD0902 /* Makefile.linux */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.linux; sourceTree = ""; }; - 36F00C7A1762F9B600FD0902 /* LICENSE-bsd.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "LICENSE-bsd.txt"; sourceTree = ""; }; - 36F00C7B1762F9B600FD0902 /* LICENSE-gpl3.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "LICENSE-gpl3.txt"; sourceTree = ""; }; - 36F00C7C1762F9B600FD0902 /* LICENSE-orig.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "LICENSE-orig.txt"; sourceTree = ""; }; - 36F00C7D1762F9B600FD0902 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.txt; sourceTree = ""; }; - 36F00C7F1762F9B600FD0902 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 36F00C801762F9B600FD0902 /* hid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hid.c; sourceTree = ""; }; - 36F00C811762F9B600FD0902 /* Makefile-manual */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Makefile-manual"; sourceTree = ""; }; - 36F00C821762F9B600FD0902 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; - 36F00C831762F9B600FD0902 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = ""; }; - 36F00C851762F9B600FD0902 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 36F00C861762F9B600FD0902 /* ax_pthread.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ax_pthread.m4; sourceTree = ""; }; - 36F00C871762F9B600FD0902 /* pkg.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pkg.m4; sourceTree = ""; }; - 36F00C891762F9B600FD0902 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 36F00C8A1762F9B600FD0902 /* hid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hid.c; sourceTree = ""; }; - 36F00C8B1762F9B600FD0902 /* Makefile-manual */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Makefile-manual"; sourceTree = ""; }; - 36F00C8C1762F9B600FD0902 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; - 36F00C8D1762F9B600FD0902 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; - 36F00C8F1762F9B600FD0902 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 36F00C901762F9B600FD0902 /* hidapi-hidraw.pc.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "hidapi-hidraw.pc.in"; sourceTree = ""; }; - 36F00C911762F9B600FD0902 /* hidapi-libusb.pc.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "hidapi-libusb.pc.in"; sourceTree = ""; }; - 36F00C921762F9B600FD0902 /* hidapi.pc.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hidapi.pc.in; sourceTree = ""; }; - 36F00C931762F9B600FD0902 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = ""; }; - 36F00C951762F9B600FD0902 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 36F00C961762F9B600FD0902 /* copy_to_bundle.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = copy_to_bundle.sh; sourceTree = ""; }; - 36F00C971762F9B600FD0902 /* mac_support.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mac_support.cpp; sourceTree = ""; }; - 36F00C981762F9B600FD0902 /* mac_support.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mac_support.h; sourceTree = ""; }; - 36F00C991762F9B600FD0902 /* mac_support_cocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = mac_support_cocoa.m; sourceTree = ""; }; - 36F00C9A1762F9B600FD0902 /* Makefile-manual */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Makefile-manual"; sourceTree = ""; }; - 36F00C9B1762F9B600FD0902 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; - 36F00C9C1762F9B600FD0902 /* Makefile.freebsd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.freebsd; sourceTree = ""; }; - 36F00C9D1762F9B600FD0902 /* Makefile.linux */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.linux; sourceTree = ""; }; - 36F00C9E1762F9B600FD0902 /* Makefile.mac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.mac; sourceTree = ""; }; - 36F00C9F1762F9B600FD0902 /* Makefile.mingw */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.mingw; sourceTree = ""; }; - 36F00CA01762F9B600FD0902 /* start.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = start.sh; sourceTree = ""; }; - 36F00CA11762F9B600FD0902 /* test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test.cpp; sourceTree = ""; }; - 36F00CA41762F9B600FD0902 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 36F00CA51762F9B600FD0902 /* PkgInfo */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PkgInfo; sourceTree = ""; }; - 36F00CA81762F9B600FD0902 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 36F00CA91762F9B600FD0902 /* Signal11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Signal11.icns; sourceTree = ""; }; - 36F00CAA1762F9B600FD0902 /* testgui.exe */ = {isa = PBXFileReference; lastKnownFileType = file; path = testgui.exe; sourceTree = ""; }; - 36F00CAB1762F9B600FD0902 /* testgui.sln */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = testgui.sln; sourceTree = ""; }; - 36F00CAC1762F9B600FD0902 /* testgui.vcproj */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testgui.vcproj; sourceTree = ""; }; - 36F00CAE1762F9B600FD0902 /* 99-hid.rules */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "99-hid.rules"; sourceTree = ""; }; - 36F00CB01762F9B600FD0902 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 36F00CB21762F9B600FD0902 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; - 36F00CB31762F9B600FD0902 /* hidapi.def */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hidapi.def; sourceTree = ""; }; - 36F00CB41762F9B600FD0902 /* makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = ""; }; - 36F00CB51762F9B600FD0902 /* sources */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sources; sourceTree = ""; }; - 36F00CB61762F9B600FD0902 /* hid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hid.c; sourceTree = ""; }; - 36F00CB71762F9B600FD0902 /* hidapi.sln */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hidapi.sln; sourceTree = ""; }; - 36F00CB81762F9B600FD0902 /* hidapi.vcproj */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = hidapi.vcproj; sourceTree = ""; }; - 36F00CB91762F9B600FD0902 /* hidtest.vcproj */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = hidtest.vcproj; sourceTree = ""; }; - 36F00CBA1762F9B600FD0902 /* Makefile-manual */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Makefile-manual"; sourceTree = ""; }; - 36F00CBB1762F9B600FD0902 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; - 36F00CBC1762F9B600FD0902 /* Makefile.mingw */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.mingw; sourceTree = ""; }; - 36F00CBD1762FA1F00FD0902 /* hidapi_test.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; name = hidapi_test.lua; path = ../hidapi_test.lua; sourceTree = ""; }; - 36FC187516EE12D400C20D48 /* coroutine.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = coroutine.lua; sourceTree = ""; }; - 36FC187616EE12D400C20D48 /* debug.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = debug.lua; sourceTree = ""; }; - 36FC187716EE12D400C20D48 /* global.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = global.lua; sourceTree = ""; }; - 36FC187816EE12D400C20D48 /* globals.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = globals.lua; sourceTree = ""; }; - 36FC187916EE12D400C20D48 /* io.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = io.lua; sourceTree = ""; }; - 36FC187A16EE12D400C20D48 /* lfs.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = lfs.lua; sourceTree = ""; }; - 36FC187B16EE12D400C20D48 /* lpeg.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = lpeg.lua; sourceTree = ""; }; - 36FC187C16EE12D400C20D48 /* math.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = math.lua; sourceTree = ""; }; - 36FC187D16EE12D400C20D48 /* os.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = os.lua; sourceTree = ""; }; - 36FC187E16EE12D400C20D48 /* package.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = package.lua; sourceTree = ""; }; - 36FC187F16EE12D400C20D48 /* string.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = string.lua; sourceTree = ""; }; - 36FC188016EE12D400C20D48 /* table.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = table.lua; sourceTree = ""; }; - 36FC188116EE12D400C20D48 /* config.ld */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = config.ld; sourceTree = ""; }; - 36FC188216EE12D400C20D48 /* doc.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = doc.lua; sourceTree = ""; }; - 36FC188416EE12D400C20D48 /* ldoc_css.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = ldoc_css.lua; sourceTree = ""; }; - 36FC188516EE12D400C20D48 /* ldoc_ltp.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = ldoc_ltp.lua; sourceTree = ""; }; - 36FC188616EE12D400C20D48 /* ldoc_one_css.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = ldoc_one_css.lua; sourceTree = ""; }; - 36FC188716EE12D400C20D48 /* html.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = html.lua; sourceTree = ""; }; - 36FC188816EE12D400C20D48 /* lang.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = lang.lua; sourceTree = ""; }; - 36FC188916EE12D400C20D48 /* lexer.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = lexer.lua; sourceTree = ""; }; - 36FC188A16EE12D400C20D48 /* markdown.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = markdown.lua; sourceTree = ""; }; - 36FC188B16EE12D400C20D48 /* markup.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = markup.lua; sourceTree = ""; }; - 36FC188C16EE12D400C20D48 /* parse.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = parse.lua; sourceTree = ""; }; - 36FC188D16EE12D400C20D48 /* prettify.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = prettify.lua; sourceTree = ""; }; - 36FC188E16EE12D400C20D48 /* SciTE.properties */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SciTE.properties; sourceTree = ""; }; - 36FC188F16EE12D400C20D48 /* tools.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = tools.lua; sourceTree = ""; }; - 36FC189016EE12D400C20D48 /* ldoc.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lua; path = ldoc.lua; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 36228CED16EC4C6C00BB8932 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 3610AA81172F827D002DE83B /* lpeg-0.11 */ = { - isa = PBXGroup; - children = ( - 3610AA82172F827D002DE83B /* HISTORY */, - 3610AA83172F827D002DE83B /* lpcap.c */, - 3610AA84172F827D002DE83B /* lpcap.h */, - 3610AA85172F827D002DE83B /* lpcode.c */, - 3610AA86172F827D002DE83B /* lpcode.h */, - 3610AA87172F827D002DE83B /* lpeg-128.gif */, - 3610AA88172F827D002DE83B /* lpeg.html */, - 3610AA89172F827D002DE83B /* lpprint.c */, - 3610AA8A172F827D002DE83B /* lpprint.h */, - 3610AA8B172F827D002DE83B /* lptree.c */, - 3610AA8C172F827D002DE83B /* lptree.h */, - 3610AA8D172F827D002DE83B /* lptypes.h */, - 3610AA8E172F827D002DE83B /* lpvm.c */, - 3610AA8F172F827D002DE83B /* lpvm.h */, - 3610AA90172F827D002DE83B /* makefile */, - 3610AA91172F827D002DE83B /* re.html */, - 3610AA92172F827D002DE83B /* re.lua */, - 3610AA93172F827D002DE83B /* test.lua */, - ); - path = "lpeg-0.11"; - sourceTree = ""; - }; - 36228CF016EC4C6D00BB8932 /* Products */ = { - isa = PBXGroup; - children = ( - 36228CEF16EC4C6D00BB8932 /* av.app */, - ); - name = Products; - sourceTree = ""; - }; - 36228E9216EC7C4800BB8932 /* windows */ = { - isa = PBXGroup; - children = ( - 36228E9316EC7C7000BB8932 /* makefile */, - ); - name = windows; - sourceTree = ""; - }; - 362BFE7F16E3586E00405F7A = { - isa = PBXGroup; - children = ( - 3689ACBA17410678001CDA25 /* bullets.lua */, - 36F00CBD1762FA1F00FD0902 /* hidapi_test.lua */, - 3689A2561741063F001CDA25 /* modules */, - 3616CAC9170BD0E20084E438 /* audio.test.lua */, - 366E26ED170AF7AB002F9F53 /* cindex.lua */, - 366E26EE170AF7AB002F9F53 /* cindex.test.lua */, - 366E1D24170AA95A002F9F53 /* Index.h */, - 366E1CFB170AA57A002F9F53 /* clang.lua */, - 366E1CE6170AA027002F9F53 /* kqueue.lua */, - 368C27F816F9828A00AB3D5D /* snap.lua */, - 3624310F16ED8D7F00C9732C /* draw.lua */, - 36C6556E16E4419600FDE98B /* README.md */, - 36228E5816EC781300BB8932 /* start.lua */, - 362BFFB816E369C600405F7A /* src */, - 36228E9216EC7C4800BB8932 /* windows */, - 36228CF016EC4C6D00BB8932 /* Products */, - 3616CDCB170C3F570084E438 /* msg.lua */, - ); - sourceTree = ""; - }; - 362BFFB816E369C600405F7A /* src */ = { - isa = PBXGroup; - children = ( - 36F00C631762F9B600FD0902 /* hidapi */, - 3689AD0A17421CB8001CDA25 /* src */, - 3610AA81172F827D002DE83B /* lpeg-0.11 */, - 36FC189016EE12D400C20D48 /* ldoc.lua */, - 36FC187316EE12D400C20D48 /* ldoc */, - 36228CF216EC4C6D00BB8932 /* av-Info.plist */, - 36C3E0B016E4400A007407CF /* devnotes.txt */, - 36228D3416EC4F5300BB8932 /* makeluajitosx.sh */, - 36228E4916EC769600BB8932 /* build.sh */, - 362BFF4A16E3627B00405F7A /* h2ffi.lua */, - 368C279A16F97B5500AB3D5D /* rgbd.h */, - 368C279B16F97B5500AB3D5D /* rgbd.cpp */, - 362BFF3C16E3616900405F7A /* av.h */, - 368C279D16F97BBE00AB3D5D /* av.hpp */, - 3616CAC2170BCF9B0084E438 /* av_audio.cpp */, - 362BFF5216E3643D00405F7A /* av_ffi_header.cpp */, - 362BFEB316E3598800405F7A /* av.cpp */, - 362290D916EC91B800BB8932 /* main.lua */, - 366E1CEA170AA04B002F9F53 /* ignore.cpp */, - 3689A2511740FE82001CDA25 /* bullet.cpp */, - ); - name = src; - path = ../src; - sourceTree = ""; - }; - 36F00C631762F9B600FD0902 /* hidapi */ = { - isa = PBXGroup; - children = ( - 36F00C641762F9B600FD0902 /* .git */, - 36F00C651762F9B600FD0902 /* .gitattributes */, - 36F00C661762F9B600FD0902 /* .gitignore */, - 36F00C671762F9B600FD0902 /* AUTHORS.txt */, - 36F00C681762F9B600FD0902 /* bootstrap */, - 36F00C691762F9B600FD0902 /* configure.ac */, - 36F00C6A1762F9B600FD0902 /* doxygen */, - 36F00C6C1762F9B600FD0902 /* HACKING.txt */, - 36F00C6D1762F9B600FD0902 /* hidapi */, - 36F00C6F1762F9B600FD0902 /* hidtest */, - 36F00C731762F9B600FD0902 /* libusb */, - 36F00C7A1762F9B600FD0902 /* LICENSE-bsd.txt */, - 36F00C7B1762F9B600FD0902 /* LICENSE-gpl3.txt */, - 36F00C7C1762F9B600FD0902 /* LICENSE-orig.txt */, - 36F00C7D1762F9B600FD0902 /* LICENSE.txt */, - 36F00C7E1762F9B600FD0902 /* linux */, - 36F00C841762F9B600FD0902 /* m4 */, - 36F00C881762F9B600FD0902 /* mac */, - 36F00C8D1762F9B600FD0902 /* Makefile.am */, - 36F00C8E1762F9B600FD0902 /* pc */, - 36F00C931762F9B600FD0902 /* README.txt */, - 36F00C941762F9B600FD0902 /* testgui */, - 36F00CAD1762F9B600FD0902 /* udev */, - 36F00CAF1762F9B600FD0902 /* windows */, - ); - path = hidapi; - sourceTree = ""; - }; - 36F00C6A1762F9B600FD0902 /* doxygen */ = { - isa = PBXGroup; - children = ( - 36F00C6B1762F9B600FD0902 /* Doxyfile */, - ); - path = doxygen; - sourceTree = ""; - }; - 36F00C6D1762F9B600FD0902 /* hidapi */ = { - isa = PBXGroup; - children = ( - 36F00C6E1762F9B600FD0902 /* hidapi.h */, - ); - path = hidapi; - sourceTree = ""; - }; - 36F00C6F1762F9B600FD0902 /* hidtest */ = { - isa = PBXGroup; - children = ( - 36F00C701762F9B600FD0902 /* .gitignore */, - 36F00C711762F9B600FD0902 /* hidtest.cpp */, - 36F00C721762F9B600FD0902 /* Makefile.am */, - ); - path = hidtest; - sourceTree = ""; - }; - 36F00C731762F9B600FD0902 /* libusb */ = { - isa = PBXGroup; - children = ( - 36F00C741762F9B600FD0902 /* .gitignore */, - 36F00C751762F9B600FD0902 /* hid.c */, - 36F00C761762F9B600FD0902 /* Makefile-manual */, - 36F00C771762F9B600FD0902 /* Makefile.am */, - 36F00C781762F9B600FD0902 /* Makefile.freebsd */, - 36F00C791762F9B600FD0902 /* Makefile.linux */, - ); - path = libusb; - sourceTree = ""; - }; - 36F00C7E1762F9B600FD0902 /* linux */ = { - isa = PBXGroup; - children = ( - 36F00C7F1762F9B600FD0902 /* .gitignore */, - 36F00C801762F9B600FD0902 /* hid.c */, - 36F00C811762F9B600FD0902 /* Makefile-manual */, - 36F00C821762F9B600FD0902 /* Makefile.am */, - 36F00C831762F9B600FD0902 /* README.txt */, - ); - path = linux; - sourceTree = ""; - }; - 36F00C841762F9B600FD0902 /* m4 */ = { - isa = PBXGroup; - children = ( - 36F00C851762F9B600FD0902 /* .gitignore */, - 36F00C861762F9B600FD0902 /* ax_pthread.m4 */, - 36F00C871762F9B600FD0902 /* pkg.m4 */, - ); - path = m4; - sourceTree = ""; - }; - 36F00C881762F9B600FD0902 /* mac */ = { - isa = PBXGroup; - children = ( - 36F00C891762F9B600FD0902 /* .gitignore */, - 36F00C8A1762F9B600FD0902 /* hid.c */, - 36F00C8B1762F9B600FD0902 /* Makefile-manual */, - 36F00C8C1762F9B600FD0902 /* Makefile.am */, - ); - path = mac; - sourceTree = ""; - }; - 36F00C8E1762F9B600FD0902 /* pc */ = { - isa = PBXGroup; - children = ( - 36F00C8F1762F9B600FD0902 /* .gitignore */, - 36F00C901762F9B600FD0902 /* hidapi-hidraw.pc.in */, - 36F00C911762F9B600FD0902 /* hidapi-libusb.pc.in */, - 36F00C921762F9B600FD0902 /* hidapi.pc.in */, - ); - path = pc; - sourceTree = ""; - }; - 36F00C941762F9B600FD0902 /* testgui */ = { - isa = PBXGroup; - children = ( - 36F00C951762F9B600FD0902 /* .gitignore */, - 36F00C961762F9B600FD0902 /* copy_to_bundle.sh */, - 36F00C971762F9B600FD0902 /* mac_support.cpp */, - 36F00C981762F9B600FD0902 /* mac_support.h */, - 36F00C991762F9B600FD0902 /* mac_support_cocoa.m */, - 36F00C9A1762F9B600FD0902 /* Makefile-manual */, - 36F00C9B1762F9B600FD0902 /* Makefile.am */, - 36F00C9C1762F9B600FD0902 /* Makefile.freebsd */, - 36F00C9D1762F9B600FD0902 /* Makefile.linux */, - 36F00C9E1762F9B600FD0902 /* Makefile.mac */, - 36F00C9F1762F9B600FD0902 /* Makefile.mingw */, - 36F00CA01762F9B600FD0902 /* start.sh */, - 36F00CA11762F9B600FD0902 /* test.cpp */, - 36F00CA21762F9B600FD0902 /* TestGUI.app.in */, - 36F00CAA1762F9B600FD0902 /* testgui.exe */, - 36F00CAB1762F9B600FD0902 /* testgui.sln */, - 36F00CAC1762F9B600FD0902 /* testgui.vcproj */, - ); - path = testgui; - sourceTree = ""; - }; - 36F00CA21762F9B600FD0902 /* TestGUI.app.in */ = { - isa = PBXGroup; - children = ( - 36F00CA31762F9B600FD0902 /* Contents */, - ); - path = TestGUI.app.in; - sourceTree = ""; - }; - 36F00CA31762F9B600FD0902 /* Contents */ = { - isa = PBXGroup; - children = ( - 36F00CA41762F9B600FD0902 /* Info.plist */, - 36F00CA51762F9B600FD0902 /* PkgInfo */, - 36F00CA61762F9B600FD0902 /* Resources */, - ); - path = Contents; - sourceTree = ""; - }; - 36F00CA61762F9B600FD0902 /* Resources */ = { - isa = PBXGroup; - children = ( - 36F00CA71762F9B600FD0902 /* InfoPlist.strings */, - 36F00CA91762F9B600FD0902 /* Signal11.icns */, - ); - path = Resources; - sourceTree = ""; - }; - 36F00CAD1762F9B600FD0902 /* udev */ = { - isa = PBXGroup; - children = ( - 36F00CAE1762F9B600FD0902 /* 99-hid.rules */, - ); - path = udev; - sourceTree = ""; - }; - 36F00CAF1762F9B600FD0902 /* windows */ = { - isa = PBXGroup; - children = ( - 36F00CB01762F9B600FD0902 /* .gitignore */, - 36F00CB11762F9B600FD0902 /* ddk_build */, - 36F00CB61762F9B600FD0902 /* hid.c */, - 36F00CB71762F9B600FD0902 /* hidapi.sln */, - 36F00CB81762F9B600FD0902 /* hidapi.vcproj */, - 36F00CB91762F9B600FD0902 /* hidtest.vcproj */, - 36F00CBA1762F9B600FD0902 /* Makefile-manual */, - 36F00CBB1762F9B600FD0902 /* Makefile.am */, - 36F00CBC1762F9B600FD0902 /* Makefile.mingw */, - ); - path = windows; - sourceTree = ""; - }; - 36F00CB11762F9B600FD0902 /* ddk_build */ = { - isa = PBXGroup; - children = ( - 36F00CB21762F9B600FD0902 /* .gitignore */, - 36F00CB31762F9B600FD0902 /* hidapi.def */, - 36F00CB41762F9B600FD0902 /* makefile */, - 36F00CB51762F9B600FD0902 /* sources */, - ); - path = ddk_build; - sourceTree = ""; - }; - 36FC187316EE12D400C20D48 /* ldoc */ = { - isa = PBXGroup; - children = ( - 36FC187416EE12D400C20D48 /* builtin */, - 36FC188116EE12D400C20D48 /* config.ld */, - 36FC188216EE12D400C20D48 /* doc.lua */, - 36FC188316EE12D400C20D48 /* html */, - 36FC188716EE12D400C20D48 /* html.lua */, - 36FC188816EE12D400C20D48 /* lang.lua */, - 36FC188916EE12D400C20D48 /* lexer.lua */, - 36FC188A16EE12D400C20D48 /* markdown.lua */, - 36FC188B16EE12D400C20D48 /* markup.lua */, - 36FC188C16EE12D400C20D48 /* parse.lua */, - 36FC188D16EE12D400C20D48 /* prettify.lua */, - 36FC188E16EE12D400C20D48 /* SciTE.properties */, - 36FC188F16EE12D400C20D48 /* tools.lua */, - ); - path = ldoc; - sourceTree = ""; - }; - 36FC187416EE12D400C20D48 /* builtin */ = { - isa = PBXGroup; - children = ( - 36FC187516EE12D400C20D48 /* coroutine.lua */, - 36FC187616EE12D400C20D48 /* debug.lua */, - 36FC187716EE12D400C20D48 /* global.lua */, - 36FC187816EE12D400C20D48 /* globals.lua */, - 36FC187916EE12D400C20D48 /* io.lua */, - 36FC187A16EE12D400C20D48 /* lfs.lua */, - 36FC187B16EE12D400C20D48 /* lpeg.lua */, - 36FC187C16EE12D400C20D48 /* math.lua */, - 36FC187D16EE12D400C20D48 /* os.lua */, - 36FC187E16EE12D400C20D48 /* package.lua */, - 36FC187F16EE12D400C20D48 /* string.lua */, - 36FC188016EE12D400C20D48 /* table.lua */, - ); - path = builtin; - sourceTree = ""; - }; - 36FC188316EE12D400C20D48 /* html */ = { - isa = PBXGroup; - children = ( - 36FC188416EE12D400C20D48 /* ldoc_css.lua */, - 36FC188516EE12D400C20D48 /* ldoc_ltp.lua */, - 36FC188616EE12D400C20D48 /* ldoc_one_css.lua */, - ); - path = html; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 36228CEE16EC4C6C00BB8932 /* av */ = { - isa = PBXNativeTarget; - buildConfigurationList = 36228CF516EC4C7500BB8932 /* Build configuration list for PBXNativeTarget "av" */; - buildPhases = ( - 36228CEB16EC4C6C00BB8932 /* Resources */, - 36228CEC16EC4C6C00BB8932 /* Sources */, - 36228CED16EC4C6C00BB8932 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 36228DF216EC738100BB8932 /* PBXTargetDependency */, - ); - name = av; - productName = av; - productReference = 36228CEF16EC4C6D00BB8932 /* av.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 362BFE8116E3586E00405F7A /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 362BFE8416E3586E00405F7A /* Build configuration list for PBXProject "av" */; - compatibilityVersion = "Xcode 2.4"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 362BFE7F16E3586E00405F7A; - productRefGroup = 36228CF016EC4C6D00BB8932 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 362BFEA216E358BE00405F7A /* build.sh */, - 36228CEE16EC4C6C00BB8932 /* av */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 36228CEB16EC4C6C00BB8932 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 362BFEA116E358BE00405F7A /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# shell script goes here\n./build.sh\nexit 0"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 36228CEC16EC4C6C00BB8932 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 36228CF916EC4C9800BB8932 /* av.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 36228DF216EC738100BB8932 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 362BFEA216E358BE00405F7A /* build.sh */; - targetProxy = 36228DF116EC738100BB8932 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 36F00CA71762F9B600FD0902 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 36F00CA81762F9B600FD0902 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 36228CF316EC4C7400BB8932 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; - ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/osx/include"; - INFOPLIST_FILE = "av-Info.plist"; - LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/osx/lib"; - OBJROOT = build; - OTHER_CFLAGS = "-DAV_OSXAPP"; - OTHER_LDFLAGS = ( - "-pagezero_size", - 10000, - "-image_base", - 100000000, - "-lluajit", - "-framework", - Carbon, - "-framework", - Cocoa, - "-framework", - CoreAudio, - "-framework", - GLUT, - "-framework", - OpenGL, - ); - PREBINDING = NO; - PRODUCT_NAME = av; - SYMROOT = ..; - VALID_ARCHS = x86_64; - }; - name = Debug; - }; - 36228CF416EC4C7400BB8932 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; - ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/osx/include"; - INFOPLIST_FILE = "av-Info.plist"; - LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/osx/lib"; - OBJROOT = build; - OTHER_CFLAGS = "-DAV_OSXAPP"; - OTHER_LDFLAGS = ( - "-pagezero_size", - 10000, - "-image_base", - 100000000, - "-lluajit", - "-framework", - Carbon, - "-framework", - Cocoa, - "-framework", - CoreAudio, - "-framework", - GLUT, - "-framework", - OpenGL, - ); - PREBINDING = NO; - PRODUCT_NAME = av; - SYMROOT = ..; - VALID_ARCHS = x86_64; - ZERO_LINK = NO; - }; - name = Release; - }; - 362BFE8216E3586E00405F7A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; - ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; - COPY_PHASE_STRIP = NO; - }; - name = Debug; - }; - 362BFE8316E3586E00405F7A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; - ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; - COPY_PHASE_STRIP = YES; - }; - name = Release; - }; - 362BFEA316E358BE00405F7A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - PRODUCT_NAME = build.sh; - }; - name = Debug; - }; - 362BFEA416E358BE00405F7A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - PRODUCT_NAME = build.sh; - ZERO_LINK = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 36228CF516EC4C7500BB8932 /* Build configuration list for PBXNativeTarget "av" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 36228CF316EC4C7400BB8932 /* Debug */, - 36228CF416EC4C7400BB8932 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 362BFE8416E3586E00405F7A /* Build configuration list for PBXProject "av" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 362BFE8216E3586E00405F7A /* Debug */, - 362BFE8316E3586E00405F7A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 362BFEB116E358C900405F7A /* Build configuration list for PBXAggregateTarget "build.sh" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 362BFEA316E358BE00405F7A /* Debug */, - 362BFEA416E358BE00405F7A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 362BFE8116E3586E00405F7A /* Project object */; -} diff --git a/src/av_ffi_header.cpp b/src/av_ffi_header.cpp deleted file mode 100644 index d9612c5..0000000 --- a/src/av_ffi_header.cpp +++ /dev/null @@ -1,218 +0,0 @@ -const char * av_ffi_header = "" -"-- generated from av.h on Mon Jul 22 16:14:12 2013 \n" -"print('Built on Mon Jul 22 16:14:12 2013') \n" -"local header = [[ \n" -" void av_sleep(double seconds); \n" -" double av_time(); \n" -" double av_filetime(const char * filename); \n" -" void av_reload(); \n" -"enum { \n" -" AV_KEY_ENTER =3, \n" -" AV_KEY_BACKSPACE =8, \n" -" AV_KEY_TAB =9, \n" -" AV_KEY_RETURN =13, \n" -" AV_KEY_ESCAPE =27, \n" -" AV_KEY_DELETE =127, \n" -" AV_KEY_F1=256, \n" -" AV_KEY_F2, AV_KEY_F3, AV_KEY_F4, AV_KEY_F5, AV_KEY_F6, AV_KEY_F7, AV_KEY_F8, AV_KEY_F9, AV_KEY_F10, AV_KEY_F11, AV_KEY_F12, \n" -" AV_KEY_INSERT, \n" -" AV_KEY_LEFT, AV_KEY_UP, AV_KEY_RIGHT, AV_KEY_DOWN, \n" -" AV_KEY_PAGE_DOWN, AV_KEY_PAGE_UP, \n" -" AV_KEY_END, AV_KEY_HOME \n" -"}; \n" -"typedef struct av_Window { \n" -" int width, height; \n" -" int is_fullscreen; \n" -" int button; \n" -" int shift, alt, ctrl; \n" -" int is_stereo; \n" -" double fps; \n" -" void (*oncreate)(struct av_Window * self); \n" -" void (*onresize)(struct av_Window * self, int w, int h); \n" -" void (*onvisible)(struct av_Window * self, int state); \n" -" void (*ondraw)(struct av_Window * self); \n" -" void (*onkey)(struct av_Window * self, int event, int key); \n" -" void (*onmouse)(struct av_Window * self, int event, int button, int x, int y); \n" -"} av_Window; \n" -"enum { \n" -" AV_AUDIO_CMD_EMPTY, \n" -" AV_AUDIO_CMD_GENERIC = 128, \n" -" AV_AUDIO_CMD_CLEAR, \n" -" AV_AUDIO_CMD_VOICE_ADD, \n" -" AV_AUDIO_CMD_VOICE_REMOVE, \n" -" AV_AUDIO_CMD_VOICE_PARAM, \n" -" AV_AUDIO_CMD_VOICE_CODE, \n" -" AV_AUDIO_CMD_SKIP = 255 \n" -"}; \n" -"typedef struct av_msg_param { \n" -" int id, pid; \n" -" double value; \n" -"} av_msg_param; \n" -"typedef struct av_msgbuffer { \n" -" int read, write, size, unused; \n" -" unsigned char * data; \n" -"} av_msgbuffer; \n" -"typedef struct av_Audio { \n" -" unsigned int blocksize; \n" -" unsigned int frames; \n" -" unsigned int indevice, outdevice; \n" -" unsigned int inchannels, outchannels; \n" -" double time; \n" -" double samplerate; \n" -" double lag; \n" -" av_msgbuffer msgbuffer; \n" -" float * buffer; \n" -" int blocks, blockread, blockwrite, blockstep; \n" -" float * input; \n" -" float * output; \n" -" void (*onframes)(struct av_Audio * self, double sampletime, float * inputs, float * outputs, int frames); \n" -"} av_Audio; \n" -" av_Window * av_window_create(); \n" -" void av_window_setfullscreen(av_Window * self, int b); \n" -" void av_window_settitle(av_Window * self, const char * name); \n" -" void av_window_setdim(av_Window * self, int x, int y); \n" -" void av_state_reset(void * state); \n" -" av_Audio * av_audio_get(); \n" -" void av_audio_start(); \n" -"typedef struct { \n" -" int kind; \n" -" int xdata; \n" -" void *data[3]; \n" -"} CXCursor; \n" -"typedef struct av_clang_visitor { \n" -" int (*fun)(CXCursor *cursor, CXCursor *parent); \n" -"} av_clang_visitor; \n" -" int av_clang_visit(CXCursor cursor, CXCursor parent, void * ud); \n" -"typedef struct lua_State lua_State; \n" -" int luaopen_lpeg (lua_State *L); \n" -" int luaopen_http_parser(lua_State* L); \n" -"]] \n" -"local ffi = require 'ffi' \n" -"ffi.cdef(header) \n" -"return header \n"; -const char * av_main = "" -"-- main.lua \n" -" \n" -"local exepath = select(1, ...) or \".\" \n" -"local filename = select(2, ...) or \"start.lua\" \n" -"local args = { select(3, ...) } \n" -" \n" -"local startupscript = [[ \n" -" local exepath, builtin_header = ... \n" -" _G.exepath = exepath \n" -" \n" -" -- also search in /modules for Lua modules: \n" -" package.path = string.format('%s/modules/?.lua;%s/modules/?/init.lua;%s', exepath, exepath, package.path); \n" -" \n" -" -- define the AV header in FFI: \n" -" local ffi = require 'ffi' \n" -" \n" -" package.loaded.builtin = builtin_header \n" -" ffi.cdef(builtin_header) \n" -" \n" -" print(\"initialize window\") \n" -" -- initialize the window bindings: \n" -" win = require \"window\" \n" -"]] \n" -" \n" -"-- load the modules we need: \n" -"local ffi = require \"ffi\" \n" -"local C = ffi.C \n" -"local builtin = require \"builtin\" \n" -" \n" -"-- also search in /modules for Lua modules: \n" -"package.path = string.format('%s/modules/?.lua;%s/modules/?/init.lua;%s', exepath, exepath, package.path); \n" -"local lua = require \"lua\" \n" -" \n" -"-- a bit of helpful info: \n" -"print(string.format(\"Using %s on %s (%s)\", jit.version, jit.os, jit.arch)) \n" -" \n" -"local watched = {} \n" -"local states = {} \n" -" \n" -"function av_tick() \n" -" -- filewatch: \n" -" for filename, mtime in pairs(watched) do \n" -" local t = C.av_filetime(filename) \n" -" if t > mtime then \n" -" watched[filename] = t \n" -" spawn(filename) \n" -" end \n" -" end \n" -"end \n" -" \n" -"-- force reload all scripts: \n" -"function av_reload() \n" -" for filename, mtime in pairs(watched) do \n" -" spawn(filename) \n" -" end \n" -"end \n" -" \n" -" \n" -"function cancel(L) \n" -" if L then \n" -" print('canceling', filename) \n" -" \n" -" -- trigger handler: \n" -" L:getglobal(\"close\") \n" -" if L:isfunction(-1) then \n" -" if L:call(0, 0) then \n" -" print(\"error on close\", L:tostring(-1)) \n" -" end \n" -" else \n" -" L:pop(1) \n" -" end \n" -" \n" -" -- before calling L:close(), we need to unregister any application callbacks! \n" -" C.av_state_reset(L) \n" -" -- should be safe to shutdown now: \n" -" L:close() \n" -" print(string.rep(\"-\", 80)) \n" -" ffi.gc(L, nil) \n" -" end \n" -"end \n" -" \n" -" \n" -"-- basic file spawning. \n" -"-- this will allow us to scale up to filewatching and multiple states in the future \n" -" \n" -"function spawn(filename) \n" -" if states[filename] then \n" -" cancel(states[filename]) \n" -" end \n" -" \n" -" print(string.rep(\"-\", 80)) \n" -" -- create a child Lua state to run user code in: \n" -" L = lua.open() \n" -" L:openlibs() \n" -" \n" -" -- preload lpeg: \n" -" L:getglobal(\"package\") \n" -" L:getfield(-1, \"preload\") \n" -" L:pushcfunction(C.luaopen_lpeg) \n" -" L:setfield(-2, \"lpeg\") \n" -" L:pushcfunction(C.luaopen_http_parser) \n" -" L:setfield(-2, \"http.parser\") \n" -" L:settop(0) \n" -" \n" -" states[filename] = L \n" -" \n" -" -- 'prime' this state with the module search path and built-in FFI header: \n" -" L:dostring(startupscript, exepath, builtin.header) \n" -" \n" -" print(string.format(\"running %s at %s\", filename, os.date())) \n" -" print(string.rep(\"-\", 80)) \n" -" \n" -" L:dofile(filename, unpack(args)) \n" -" \n" -" ffi.gc(L, cancel) \n" -" \n" -" return L \n" -"end \n" -" \n" -"function watch(filename) \n" -" watched[filename] = 0 \n" -"end \n" -" \n" -"watch(filename) \n" -" \n"; \ No newline at end of file diff --git a/src/build.sh b/src/build.sh deleted file mode 100755 index 927f7f6..0000000 --- a/src/build.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash - -# debugging: -#set -x - -SRCROOT=`pwd` -PLATFORM=`uname` -ARCH=`uname -m` -echo Building for $PLATFORM $ARCH from $SRCROOT - -echo generate FFI code -luajit h2ffi.lua av.h av_ffi_header - -echo clean -rm -f lpeg-0.11/*.o -rm -f *.o -rm -f *.d - -if [[ $PLATFORM == 'Darwin' ]]; then - - PRODUCT_NAME="av_osx" - rm -f $PRODUCT_NAME - - export MACOSX_DEPLOYMENT_TARGET=10.4 - - # cross compile 86/64 - - CC='clang++' - CFLAGS="-fno-stack-protector -O3 -Wall -fPIC" - DEFINES="-DEV_MULTIPLICITY=1 -DHAVE_GETTIMEOFDAY -D__MACOSX_CORE__" - INCLUDEPATHS="-Iosx/include -Iinclude -Irtaudio-4.0.11 -Ilpeg-0.11 -Ihidapi/hidapi -I/usr/local/include/bullet/" - SOURCES="-x c++ av.cpp rgbd.cpp av_audio.cpp rtaudio-4.0.11/RtAudio.cpp -x c lpeg-0.11/*.c http-parser/*.c" # hidapi/mac/hid.c" - # bullet.cpp - - LINK='clang++' - LDFLAGS32="-w -keep_private_externs" - LDFLAGS64="$LDFLAGS32 -pagezero_size 10000 -image_base 100000000" - - LINKERPATHS="-Losx/lib" - LIBRARIES="osx/lib/libluajit.a osx/lib/libfreenect.a osx/lib/libusb-1.0.a -framework Carbon -framework Cocoa -framework CoreAudio -framework GLUT -framework OpenGL -framework IOKit -lBulletDynamics -lBulletCollision -lLinearMath" - - #-framework AudioUnit -framework CoreAudio -framework AudioToolbox" - - #echo compile 32 - #rm -f *.o - #$CC -arch i386 -c $CFLAGS $DEFINES $INCLUDEPATHS $SOURCES - #echo link 32 - #$LINK -arch i386 $LDFLAGS32 $LINKERPATHS $LIBRARIES *.o -o app32 - - echo compile 64 - rm -f *.o - $CC -arch x86_64 -c $CFLAGS $DEFINES $INCLUDEPATHS $SOURCES - echo link 64 - $LINK -arch x86_64 $LDFLAGS64 $LINKERPATHS $LIBRARIES *.o -o app64 - - # join them in fat love: - echo fatten - #lipo -create app32 app64 -output $PRODUCT_NAME - #rm app32 app64 - mv app64 $PRODUCT_NAME - - # documentation: - #./ldoc.lua -v --dir ../docs --output reference ../modules - - echo copy - cp $PRODUCT_NAME ../ - -elif [[ $PLATFORM == 'Linux' ]]; then - - PRODUCT_NAME="av_linux" - rm -f $PRODUCT_NAME - - CC='g++' - CFLAGS="-O3 -Wall -fPIC -ffast-math -Wno-unknown-pragmas -MMD" - DEFINES="-D_GNU_SOURCE -DEV_MULTIPLICITY=1 -DHAVE_GETTIMEOFDAY -D__LINUX_ALSA__" - INCLUDEPATHS="-Ilinux/include -I/usr/local/include/luajit-2.0 -I/usr/include/luajit-2.0 -Irtaudio-4.0.11 -Ilpeg-0.11 -Iinclude" - SOURCES="av.cpp av_audio.cpp rtaudio-4.0.11/RtAudio.cpp" - - LINK=$CC - LDFLAGS="-w -rdynamic -Wl,-E " - LINKERPATHS="-L/usr/lib/nvidia-current/ -L/usr/local/lib -L/usr/lib" - #LIBRARIES="-lluajit-5.1 -lfreeimage -lGLEW -lGLU -lGL -lglut -lasound ../externs/libuv/libuv.a -lrt -lpthread" - LIBRARIES="-lluajit-5.1 -lGLU -lGL -lglut -lasound -lrt -lpthread" # linux/lib64/libfreenect.a -lusb-1.0" - - echo compile - $CC -c $CFLAGS $DEFINES $INCLUDEPATHS $SOURCES - gcc -c $CFLAGS $DEFINES $INCLUDEPATHS lpeg-0.11/*.c http-parser/*.c - echo link - $LINK $LDFLAGS -Wl,-whole-archive *.o -Wl,-no-whole-archive $LINKERPATHS $LIBRARIES -o $PRODUCT_NAME - - echo copy - cp $PRODUCT_NAME ../ - -else - - echo "unknown platform" $PLATFORM - -fi - diff --git a/src/devnotes.txt b/src/devnotes.txt deleted file mode 100644 index c9f6961..0000000 --- a/src/devnotes.txt +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - -Getting crashes (blue screen) on quitting sometimes, sounds like a problem with closing the GLUT window, perhaps a Lua callback that is no longer valid? - -Perhaps for now simplify Window to use lua_pcall instead of FFI callbacks? - -field2D: should it support multi-plane? \ No newline at end of file diff --git a/src/glut32.dll b/src/glut32.dll deleted file mode 100644 index 106646f..0000000 Binary files a/src/glut32.dll and /dev/null differ diff --git a/src/hidapi b/src/hidapi deleted file mode 160000 index 776ec62..0000000 --- a/src/hidapi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 776ec62dfc2cd394a298f03dbf27a96506544410 diff --git a/src/http-parser/AUTHORS b/src/http-parser/AUTHORS deleted file mode 100644 index 92ee45c..0000000 --- a/src/http-parser/AUTHORS +++ /dev/null @@ -1,41 +0,0 @@ -# Authors ordered by first contribution. -Ryan Dahl -Jeremy Hinegardner -Sergey Shepelev -Joe Damato -tomika -Phoenix Sol -Cliff Frey -Ewen Cheslack-Postava -Santiago Gala -Tim Becker -Jeff Terrace -Ben Noordhuis -Nathan Rajlich -Mark Nottingham -Aman Gupta -Tim Becker -Sean Cunningham -Peter Griess -Salman Haq -Cliff Frey -Jon Kolb -Fouad Mardini -Paul Querna -Felix Geisendörfer -koichik -Andre Caron -Ivo Raisr -James McLaughlin -David Gwynne -Thomas LE ROUX -Randy Rizun -Andre Louis Caron -Simon Zimmermann -Erik Dubbelboer -Martell Malone -Bertrand Paquet -BogDan Vatra -Peter Faiman -Corey Richardson -Tóth Tamás diff --git a/src/http-parser/CONTRIBUTIONS b/src/http-parser/CONTRIBUTIONS deleted file mode 100644 index 11ba31e..0000000 --- a/src/http-parser/CONTRIBUTIONS +++ /dev/null @@ -1,4 +0,0 @@ -Contributors must agree to the Contributor License Agreement before patches -can be accepted. - -http://spreadsheets2.google.com/viewform?hl=en&formkey=dDJXOGUwbzlYaWM4cHN1MERwQS1CSnc6MQ diff --git a/src/http-parser/LICENSE-MIT b/src/http-parser/LICENSE-MIT deleted file mode 100644 index 58010b3..0000000 --- a/src/http-parser/LICENSE-MIT +++ /dev/null @@ -1,23 +0,0 @@ -http_parser.c is based on src/http/ngx_http_parse.c from NGINX copyright -Igor Sysoev. - -Additional changes are licensed under the same terms as NGINX and -copyright Joyent, Inc. and other Node contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. diff --git a/src/http-parser/Makefile b/src/http-parser/Makefile deleted file mode 100644 index 64e5c2f..0000000 --- a/src/http-parser/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -CC?=gcc -AR?=ar - -CPPFLAGS += -I. -CPPFLAGS_DEBUG = $(CPPFLAGS) -DHTTP_PARSER_STRICT=1 -CPPFLAGS_DEBUG += $(CPPFLAGS_DEBUG_EXTRA) -CPPFLAGS_FAST = $(CPPFLAGS) -DHTTP_PARSER_STRICT=0 -CPPFLAGS_FAST += $(CPPFLAGS_FAST_EXTRA) - -CFLAGS += -Wall -Wextra -Werror -CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA) -CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA) -CFLAGS_LIB = $(CFLAGS_FAST) -fPIC - -test: test_g test_fast - ./test_g - ./test_fast - -test_g: http_parser_g.o test_g.o - $(CC) $(CFLAGS_DEBUG) $(LDFLAGS) http_parser_g.o test_g.o -o $@ - -test_g.o: test.c http_parser.h Makefile - $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c test.c -o $@ - -http_parser_g.o: http_parser.c http_parser.h Makefile - $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c http_parser.c -o $@ - -test_fast: http_parser.o test.o http_parser.h - $(CC) $(CFLAGS_FAST) $(LDFLAGS) http_parser.o test.o -o $@ - -test.o: test.c http_parser.h Makefile - $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c test.c -o $@ - -http_parser.o: http_parser.c http_parser.h Makefile - $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c http_parser.c - -test-run-timed: test_fast - while(true) do time ./test_fast > /dev/null; done - -test-valgrind: test_g - valgrind ./test_g - -libhttp_parser.o: http_parser.c http_parser.h Makefile - $(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o - -library: libhttp_parser.o - $(CC) -shared -o libhttp_parser.so libhttp_parser.o - -package: http_parser.o - $(AR) rcs libhttp_parser.a http_parser.o - -url_parser: http_parser.o contrib/url_parser.c - $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o $@ - -url_parser_g: http_parser_g.o contrib/url_parser.c - $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o $@ - -parsertrace: http_parser.o contrib/parsertrace.c - $(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o parsertrace - -parsertrace_g: http_parser_g.o contrib/parsertrace.c - $(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o parsertrace_g - -tags: http_parser.c http_parser.h test.c - ctags $^ - -clean: - rm -f *.o *.a tags test test_fast test_g \ - http_parser.tar libhttp_parser.so \ - url_parser url_parser_g parsertrace parsertrace_g - -contrib/url_parser.c: http_parser.h -contrib/parsertrace.c: http_parser.h - -.PHONY: clean package test-run test-run-timed test-valgrind diff --git a/src/http-parser/README.md b/src/http-parser/README.md deleted file mode 100644 index b63418a..0000000 --- a/src/http-parser/README.md +++ /dev/null @@ -1,180 +0,0 @@ -HTTP Parser -=========== - -[![Build Status](https://travis-ci.org/joyent/http-parser.png?branch=master)](https://travis-ci.org/joyent/http-parser) - -This is a parser for HTTP messages written in C. It parses both requests and -responses. The parser is designed to be used in performance HTTP -applications. It does not make any syscalls nor allocations, it does not -buffer data, it can be interrupted at anytime. Depending on your -architecture, it only requires about 40 bytes of data per message -stream (in a web server that is per connection). - -Features: - - * No dependencies - * Handles persistent streams (keep-alive). - * Decodes chunked encoding. - * Upgrade support - * Defends against buffer overflow attacks. - -The parser extracts the following information from HTTP messages: - - * Header fields and values - * Content-Length - * Request method - * Response status code - * Transfer-Encoding - * HTTP version - * Request URL - * Message body - - -Usage ------ - -One `http_parser` object is used per TCP connection. Initialize the struct -using `http_parser_init()` and set the callbacks. That might look something -like this for a request parser: - - http_parser_settings settings; - settings.on_url = my_url_callback; - settings.on_header_field = my_header_field_callback; - /* ... */ - - http_parser *parser = malloc(sizeof(http_parser)); - http_parser_init(parser, HTTP_REQUEST); - parser->data = my_socket; - -When data is received on the socket execute the parser and check for errors. - - size_t len = 80*1024, nparsed; - char buf[len]; - ssize_t recved; - - recved = recv(fd, buf, len, 0); - - if (recved < 0) { - /* Handle error. */ - } - - /* Start up / continue the parser. - * Note we pass recved==0 to signal that EOF has been recieved. - */ - nparsed = http_parser_execute(parser, &settings, buf, recved); - - if (parser->upgrade) { - /* handle new protocol */ - } else if (nparsed != recved) { - /* Handle error. Usually just close the connection. */ - } - -HTTP needs to know where the end of the stream is. For example, sometimes -servers send responses without Content-Length and expect the client to -consume input (for the body) until EOF. To tell http_parser about EOF, give -`0` as the forth parameter to `http_parser_execute()`. Callbacks and errors -can still be encountered during an EOF, so one must still be prepared -to receive them. - -Scalar valued message information such as `status_code`, `method`, and the -HTTP version are stored in the parser structure. This data is only -temporally stored in `http_parser` and gets reset on each new message. If -this information is needed later, copy it out of the structure during the -`headers_complete` callback. - -The parser decodes the transfer-encoding for both requests and responses -transparently. That is, a chunked encoding is decoded before being sent to -the on_body callback. - - -The Special Problem of Upgrade ------------------------------- - -HTTP supports upgrading the connection to a different protocol. An -increasingly common example of this is the Web Socket protocol which sends -a request like - - GET /demo HTTP/1.1 - Upgrade: WebSocket - Connection: Upgrade - Host: example.com - Origin: http://example.com - WebSocket-Protocol: sample - -followed by non-HTTP data. - -(See http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75 for more -information the Web Socket protocol.) - -To support this, the parser will treat this as a normal HTTP message without a -body. Issuing both on_headers_complete and on_message_complete callbacks. However -http_parser_execute() will stop parsing at the end of the headers and return. - -The user is expected to check if `parser->upgrade` has been set to 1 after -`http_parser_execute()` returns. Non-HTTP data begins at the buffer supplied -offset by the return value of `http_parser_execute()`. - - -Callbacks ---------- - -During the `http_parser_execute()` call, the callbacks set in -`http_parser_settings` will be executed. The parser maintains state and -never looks behind, so buffering the data is not necessary. If you need to -save certain data for later usage, you can do that from the callbacks. - -There are two types of callbacks: - -* notification `typedef int (*http_cb) (http_parser*);` - Callbacks: on_message_begin, on_headers_complete, on_message_complete. -* data `typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);` - Callbacks: (requests only) on_uri, - (common) on_header_field, on_header_value, on_body; - -Callbacks must return 0 on success. Returning a non-zero value indicates -error to the parser, making it exit immediately. - -In case you parse HTTP message in chunks (i.e. `read()` request line -from socket, parse, read half headers, parse, etc) your data callbacks -may be called more than once. Http-parser guarantees that data pointer is only -valid for the lifetime of callback. You can also `read()` into a heap allocated -buffer to avoid copying memory around if this fits your application. - -Reading headers may be a tricky task if you read/parse headers partially. -Basically, you need to remember whether last header callback was field or value -and apply following logic: - - (on_header_field and on_header_value shortened to on_h_*) - ------------------------ ------------ -------------------------------------------- - | State (prev. callback) | Callback | Description/action | - ------------------------ ------------ -------------------------------------------- - | nothing (first call) | on_h_field | Allocate new buffer and copy callback data | - | | | into it | - ------------------------ ------------ -------------------------------------------- - | value | on_h_field | New header started. | - | | | Copy current name,value buffers to headers | - | | | list and allocate new buffer for new name | - ------------------------ ------------ -------------------------------------------- - | field | on_h_field | Previous name continues. Reallocate name | - | | | buffer and append callback data to it | - ------------------------ ------------ -------------------------------------------- - | field | on_h_value | Value for current header started. Allocate | - | | | new buffer and copy callback data to it | - ------------------------ ------------ -------------------------------------------- - | value | on_h_value | Value continues. Reallocate value buffer | - | | | and append callback data to it | - ------------------------ ------------ -------------------------------------------- - - -Parsing URLs ------------- - -A simplistic zero-copy URL parser is provided as `http_parser_parse_url()`. -Users of this library may wish to use it to parse URLs constructed from -consecutive `on_url` callbacks. - -See examples of reading in headers: - -* [partial example](http://gist.github.com/155877) in C -* [from http-parser tests](http://github.com/joyent/http-parser/blob/37a0ff8/test.c#L403) in C -* [from Node library](http://github.com/joyent/node/blob/842eaf4/src/http.js#L284) in Javascript diff --git a/src/http-parser/http_parser.c b/src/http-parser/http_parser.c deleted file mode 100644 index ed3a923..0000000 --- a/src/http-parser/http_parser.c +++ /dev/null @@ -1,2175 +0,0 @@ -/* Based on src/http/ngx_http_parse.c from NGINX copyright Igor Sysoev - * - * Additional changes are licensed under the same terms as NGINX and - * copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -#include "http_parser.h" -#include -#include -#include -#include -#include -#include - -#ifndef ULLONG_MAX -# define ULLONG_MAX ((uint64_t) -1) /* 2^64-1 */ -#endif - -#ifndef MIN -# define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - -#ifndef ARRAY_SIZE -# define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) -#endif - -#ifndef BIT_AT -# define BIT_AT(a, i) \ - (!!((unsigned int) (a)[(unsigned int) (i) >> 3] & \ - (1 << ((unsigned int) (i) & 7)))) -#endif - -#ifndef ELEM_AT -# define ELEM_AT(a, i, v) ((unsigned int) (i) < ARRAY_SIZE(a) ? (a)[(i)] : (v)) -#endif - -#define SET_ERRNO(e) \ -do { \ - parser->http_errno = (e); \ -} while(0) - - -/* Run the notify callback FOR, returning ER if it fails */ -#define CALLBACK_NOTIFY_(FOR, ER) \ -do { \ - assert(HTTP_PARSER_ERRNO(parser) == HPE_OK); \ - \ - if (settings->on_##FOR) { \ - if (0 != settings->on_##FOR(parser)) { \ - SET_ERRNO(HPE_CB_##FOR); \ - } \ - \ - /* We either errored above or got paused; get out */ \ - if (HTTP_PARSER_ERRNO(parser) != HPE_OK) { \ - return (ER); \ - } \ - } \ -} while (0) - -/* Run the notify callback FOR and consume the current byte */ -#define CALLBACK_NOTIFY(FOR) CALLBACK_NOTIFY_(FOR, p - data + 1) - -/* Run the notify callback FOR and don't consume the current byte */ -#define CALLBACK_NOTIFY_NOADVANCE(FOR) CALLBACK_NOTIFY_(FOR, p - data) - -/* Run data callback FOR with LEN bytes, returning ER if it fails */ -#define CALLBACK_DATA_(FOR, LEN, ER) \ -do { \ - assert(HTTP_PARSER_ERRNO(parser) == HPE_OK); \ - \ - if (FOR##_mark) { \ - if (settings->on_##FOR) { \ - if (0 != settings->on_##FOR(parser, FOR##_mark, (LEN))) { \ - SET_ERRNO(HPE_CB_##FOR); \ - } \ - \ - /* We either errored above or got paused; get out */ \ - if (HTTP_PARSER_ERRNO(parser) != HPE_OK) { \ - return (ER); \ - } \ - } \ - FOR##_mark = NULL; \ - } \ -} while (0) - -/* Run the data callback FOR and consume the current byte */ -#define CALLBACK_DATA(FOR) \ - CALLBACK_DATA_(FOR, p - FOR##_mark, p - data + 1) - -/* Run the data callback FOR and don't consume the current byte */ -#define CALLBACK_DATA_NOADVANCE(FOR) \ - CALLBACK_DATA_(FOR, p - FOR##_mark, p - data) - -/* Set the mark FOR; non-destructive if mark is already set */ -#define MARK(FOR) \ -do { \ - if (!FOR##_mark) { \ - FOR##_mark = p; \ - } \ -} while (0) - - -#define PROXY_CONNECTION "proxy-connection" -#define CONNECTION "connection" -#define CONTENT_LENGTH "content-length" -#define TRANSFER_ENCODING "transfer-encoding" -#define UPGRADE "upgrade" -#define CHUNKED "chunked" -#define KEEP_ALIVE "keep-alive" -#define CLOSE "close" - - -static const char *method_strings[] = - { -#define XX(num, name, string) #string, - HTTP_METHOD_MAP(XX) -#undef XX - }; - - -/* Tokens as defined by rfc 2616. Also lowercases them. - * token = 1* - * separators = "(" | ")" | "<" | ">" | "@" - * | "," | ";" | ":" | "\" | <"> - * | "/" | "[" | "]" | "?" | "=" - * | "{" | "}" | SP | HT - */ -static const char tokens[256] = { -/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */ - 0, 0, 0, 0, 0, 0, 0, 0, -/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */ - 0, 0, 0, 0, 0, 0, 0, 0, -/* 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb */ - 0, 0, 0, 0, 0, 0, 0, 0, -/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */ - 0, 0, 0, 0, 0, 0, 0, 0, -/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */ - 0, '!', 0, '#', '$', '%', '&', '\'', -/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */ - 0, 0, '*', '+', 0, '-', '.', 0, -/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */ - '0', '1', '2', '3', '4', '5', '6', '7', -/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */ - '8', '9', 0, 0, 0, 0, 0, 0, -/* 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G */ - 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', -/* 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O */ - 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', -/* 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W */ - 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', -/* 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ */ - 'x', 'y', 'z', 0, 0, 0, '^', '_', -/* 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g */ - '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', -/* 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o */ - 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', -/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */ - 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', -/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */ - 'x', 'y', 'z', 0, '|', 0, '~', 0 }; - - -static const int8_t unhex[256] = - {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 - ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 - ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 - , 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1 - ,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1 - ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 - ,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1 - ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 - }; - - -#if HTTP_PARSER_STRICT -# define T(v) 0 -#else -# define T(v) v -#endif - - -static const uint8_t normal_url_char[32] = { -/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */ - 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0, -/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */ - 0 | T(2) | 0 | 0 | T(16) | 0 | 0 | 0, -/* 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb */ - 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0, -/* 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us */ - 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0, -/* 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' */ - 0 | 2 | 4 | 0 | 16 | 32 | 64 | 128, -/* 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, -/* 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, -/* 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 0, -/* 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, -/* 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, -/* 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, -/* 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, -/* 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, -/* 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, -/* 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128, -/* 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del */ - 1 | 2 | 4 | 8 | 16 | 32 | 64 | 0, }; - -#undef T - -enum state - { s_dead = 1 /* important that this is > 0 */ - - , s_start_req_or_res - , s_res_or_resp_H - , s_start_res - , s_res_H - , s_res_HT - , s_res_HTT - , s_res_HTTP - , s_res_first_http_major - , s_res_http_major - , s_res_first_http_minor - , s_res_http_minor - , s_res_first_status_code - , s_res_status_code - , s_res_status - , s_res_line_almost_done - - , s_start_req - - , s_req_method - , s_req_spaces_before_url - , s_req_schema - , s_req_schema_slash - , s_req_schema_slash_slash - , s_req_server_start - , s_req_server - , s_req_server_with_at - , s_req_path - , s_req_query_string_start - , s_req_query_string - , s_req_fragment_start - , s_req_fragment - , s_req_http_start - , s_req_http_H - , s_req_http_HT - , s_req_http_HTT - , s_req_http_HTTP - , s_req_first_http_major - , s_req_http_major - , s_req_first_http_minor - , s_req_http_minor - , s_req_line_almost_done - - , s_header_field_start - , s_header_field - , s_header_value_start - , s_header_value - , s_header_value_lws - - , s_header_almost_done - - , s_chunk_size_start - , s_chunk_size - , s_chunk_parameters - , s_chunk_size_almost_done - - , s_headers_almost_done - , s_headers_done - - /* Important: 's_headers_done' must be the last 'header' state. All - * states beyond this must be 'body' states. It is used for overflow - * checking. See the PARSING_HEADER() macro. - */ - - , s_chunk_data - , s_chunk_data_almost_done - , s_chunk_data_done - - , s_body_identity - , s_body_identity_eof - - , s_message_done - }; - - -#define PARSING_HEADER(state) (state <= s_headers_done) - - -enum header_states - { h_general = 0 - , h_C - , h_CO - , h_CON - - , h_matching_connection - , h_matching_proxy_connection - , h_matching_content_length - , h_matching_transfer_encoding - , h_matching_upgrade - - , h_connection - , h_content_length - , h_transfer_encoding - , h_upgrade - - , h_matching_transfer_encoding_chunked - , h_matching_connection_keep_alive - , h_matching_connection_close - - , h_transfer_encoding_chunked - , h_connection_keep_alive - , h_connection_close - }; - -enum http_host_state - { - s_http_host_dead = 1 - , s_http_userinfo_start - , s_http_userinfo - , s_http_host_start - , s_http_host_v6_start - , s_http_host - , s_http_host_v6 - , s_http_host_v6_end - , s_http_host_port_start - , s_http_host_port -}; - -/* Macros for character classes; depends on strict-mode */ -#define CR '\r' -#define LF '\n' -#define LOWER(c) (unsigned char)(c | 0x20) -#define IS_ALPHA(c) (LOWER(c) >= 'a' && LOWER(c) <= 'z') -#define IS_NUM(c) ((c) >= '0' && (c) <= '9') -#define IS_ALPHANUM(c) (IS_ALPHA(c) || IS_NUM(c)) -#define IS_HEX(c) (IS_NUM(c) || (LOWER(c) >= 'a' && LOWER(c) <= 'f')) -#define IS_MARK(c) ((c) == '-' || (c) == '_' || (c) == '.' || \ - (c) == '!' || (c) == '~' || (c) == '*' || (c) == '\'' || (c) == '(' || \ - (c) == ')') -#define IS_USERINFO_CHAR(c) (IS_ALPHANUM(c) || IS_MARK(c) || (c) == '%' || \ - (c) == ';' || (c) == ':' || (c) == '&' || (c) == '=' || (c) == '+' || \ - (c) == '$' || (c) == ',') - -#if HTTP_PARSER_STRICT -#define TOKEN(c) (tokens[(unsigned char)c]) -#define IS_URL_CHAR(c) (BIT_AT(normal_url_char, (unsigned char)c)) -#define IS_HOST_CHAR(c) (IS_ALPHANUM(c) || (c) == '.' || (c) == '-') -#else -#define TOKEN(c) ((c == ' ') ? ' ' : tokens[(unsigned char)c]) -#define IS_URL_CHAR(c) \ - (BIT_AT(normal_url_char, (unsigned char)c) || ((c) & 0x80)) -#define IS_HOST_CHAR(c) \ - (IS_ALPHANUM(c) || (c) == '.' || (c) == '-' || (c) == '_') -#endif - - -#define start_state (parser->type == HTTP_REQUEST ? s_start_req : s_start_res) - - -#if HTTP_PARSER_STRICT -# define STRICT_CHECK(cond) \ -do { \ - if (cond) { \ - SET_ERRNO(HPE_STRICT); \ - goto error; \ - } \ -} while (0) -# define NEW_MESSAGE() (http_should_keep_alive(parser) ? start_state : s_dead) -#else -# define STRICT_CHECK(cond) -# define NEW_MESSAGE() start_state -#endif - - -/* Map errno values to strings for human-readable output */ -#define HTTP_STRERROR_GEN(n, s) { "HPE_" #n, s }, -static struct { - const char *name; - const char *description; -} http_strerror_tab[] = { - HTTP_ERRNO_MAP(HTTP_STRERROR_GEN) -}; -#undef HTTP_STRERROR_GEN - -int http_message_needs_eof(const http_parser *parser); - -/* Our URL parser. - * - * This is designed to be shared by http_parser_execute() for URL validation, - * hence it has a state transition + byte-for-byte interface. In addition, it - * is meant to be embedded in http_parser_parse_url(), which does the dirty - * work of turning state transitions URL components for its API. - * - * This function should only be invoked with non-space characters. It is - * assumed that the caller cares about (and can detect) the transition between - * URL and non-URL states by looking for these. - */ -static enum state -parse_url_char(enum state s, const char ch) -{ - if (ch == ' ' || ch == '\r' || ch == '\n') { - return s_dead; - } - -#if HTTP_PARSER_STRICT - if (ch == '\t' || ch == '\f') { - return s_dead; - } -#endif - - switch (s) { - case s_req_spaces_before_url: - /* Proxied requests are followed by scheme of an absolute URI (alpha). - * All methods except CONNECT are followed by '/' or '*'. - */ - - if (ch == '/' || ch == '*') { - return s_req_path; - } - - if (IS_ALPHA(ch)) { - return s_req_schema; - } - - break; - - case s_req_schema: - if (IS_ALPHA(ch)) { - return s; - } - - if (ch == ':') { - return s_req_schema_slash; - } - - break; - - case s_req_schema_slash: - if (ch == '/') { - return s_req_schema_slash_slash; - } - - break; - - case s_req_schema_slash_slash: - if (ch == '/') { - return s_req_server_start; - } - - break; - - case s_req_server_with_at: - if (ch == '@') { - return s_dead; - } - - /* FALLTHROUGH */ - case s_req_server_start: - case s_req_server: - if (ch == '/') { - return s_req_path; - } - - if (ch == '?') { - return s_req_query_string_start; - } - - if (ch == '@') { - return s_req_server_with_at; - } - - if (IS_USERINFO_CHAR(ch) || ch == '[' || ch == ']') { - return s_req_server; - } - - break; - - case s_req_path: - if (IS_URL_CHAR(ch)) { - return s; - } - - switch (ch) { - case '?': - return s_req_query_string_start; - - case '#': - return s_req_fragment_start; - } - - break; - - case s_req_query_string_start: - case s_req_query_string: - if (IS_URL_CHAR(ch)) { - return s_req_query_string; - } - - switch (ch) { - case '?': - /* allow extra '?' in query string */ - return s_req_query_string; - - case '#': - return s_req_fragment_start; - } - - break; - - case s_req_fragment_start: - if (IS_URL_CHAR(ch)) { - return s_req_fragment; - } - - switch (ch) { - case '?': - return s_req_fragment; - - case '#': - return s; - } - - break; - - case s_req_fragment: - if (IS_URL_CHAR(ch)) { - return s; - } - - switch (ch) { - case '?': - case '#': - return s; - } - - break; - - default: - break; - } - - /* We should never fall out of the switch above unless there's an error */ - return s_dead; -} - -size_t http_parser_execute (http_parser *parser, - const http_parser_settings *settings, - const char *data, - size_t len) -{ - char c, ch; - int8_t unhex_val; - const char *p = data; - const char *header_field_mark = 0; - const char *header_value_mark = 0; - const char *url_mark = 0; - const char *body_mark = 0; - - /* We're in an error state. Don't bother doing anything. */ - if (HTTP_PARSER_ERRNO(parser) != HPE_OK) { - return 0; - } - - if (len == 0) { - switch (parser->state) { - case s_body_identity_eof: - /* Use of CALLBACK_NOTIFY() here would erroneously return 1 byte read if - * we got paused. - */ - CALLBACK_NOTIFY_NOADVANCE(message_complete); - return 0; - - case s_dead: - case s_start_req_or_res: - case s_start_res: - case s_start_req: - return 0; - - default: - SET_ERRNO(HPE_INVALID_EOF_STATE); - return 1; - } - } - - - if (parser->state == s_header_field) - header_field_mark = data; - if (parser->state == s_header_value) - header_value_mark = data; - switch (parser->state) { - case s_req_path: - case s_req_schema: - case s_req_schema_slash: - case s_req_schema_slash_slash: - case s_req_server_start: - case s_req_server: - case s_req_server_with_at: - case s_req_query_string_start: - case s_req_query_string: - case s_req_fragment_start: - case s_req_fragment: - url_mark = data; - break; - } - - for (p=data; p != data + len; p++) { - ch = *p; - - if (PARSING_HEADER(parser->state)) { - ++parser->nread; - /* Buffer overflow attack */ - if (parser->nread > HTTP_MAX_HEADER_SIZE) { - SET_ERRNO(HPE_HEADER_OVERFLOW); - goto error; - } - } - - reexecute_byte: - switch (parser->state) { - - case s_dead: - /* this state is used after a 'Connection: close' message - * the parser will error out if it reads another message - */ - if (ch == CR || ch == LF) - break; - - SET_ERRNO(HPE_CLOSED_CONNECTION); - goto error; - - case s_start_req_or_res: - { - if (ch == CR || ch == LF) - break; - parser->flags = 0; - parser->content_length = ULLONG_MAX; - - if (ch == 'H') { - parser->state = s_res_or_resp_H; - - CALLBACK_NOTIFY(message_begin); - } else { - parser->type = HTTP_REQUEST; - parser->state = s_start_req; - goto reexecute_byte; - } - - break; - } - - case s_res_or_resp_H: - if (ch == 'T') { - parser->type = HTTP_RESPONSE; - parser->state = s_res_HT; - } else { - if (ch != 'E') { - SET_ERRNO(HPE_INVALID_CONSTANT); - goto error; - } - - parser->type = HTTP_REQUEST; - parser->method = HTTP_HEAD; - parser->index = 2; - parser->state = s_req_method; - } - break; - - case s_start_res: - { - parser->flags = 0; - parser->content_length = ULLONG_MAX; - - switch (ch) { - case 'H': - parser->state = s_res_H; - break; - - case CR: - case LF: - break; - - default: - SET_ERRNO(HPE_INVALID_CONSTANT); - goto error; - } - - CALLBACK_NOTIFY(message_begin); - break; - } - - case s_res_H: - STRICT_CHECK(ch != 'T'); - parser->state = s_res_HT; - break; - - case s_res_HT: - STRICT_CHECK(ch != 'T'); - parser->state = s_res_HTT; - break; - - case s_res_HTT: - STRICT_CHECK(ch != 'P'); - parser->state = s_res_HTTP; - break; - - case s_res_HTTP: - STRICT_CHECK(ch != '/'); - parser->state = s_res_first_http_major; - break; - - case s_res_first_http_major: - if (ch < '0' || ch > '9') { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - parser->http_major = ch - '0'; - parser->state = s_res_http_major; - break; - - /* major HTTP version or dot */ - case s_res_http_major: - { - if (ch == '.') { - parser->state = s_res_first_http_minor; - break; - } - - if (!IS_NUM(ch)) { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - parser->http_major *= 10; - parser->http_major += ch - '0'; - - if (parser->http_major > 999) { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - break; - } - - /* first digit of minor HTTP version */ - case s_res_first_http_minor: - if (!IS_NUM(ch)) { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - parser->http_minor = ch - '0'; - parser->state = s_res_http_minor; - break; - - /* minor HTTP version or end of request line */ - case s_res_http_minor: - { - if (ch == ' ') { - parser->state = s_res_first_status_code; - break; - } - - if (!IS_NUM(ch)) { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - parser->http_minor *= 10; - parser->http_minor += ch - '0'; - - if (parser->http_minor > 999) { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - break; - } - - case s_res_first_status_code: - { - if (!IS_NUM(ch)) { - if (ch == ' ') { - break; - } - - SET_ERRNO(HPE_INVALID_STATUS); - goto error; - } - parser->status_code = ch - '0'; - parser->state = s_res_status_code; - break; - } - - case s_res_status_code: - { - if (!IS_NUM(ch)) { - switch (ch) { - case ' ': - parser->state = s_res_status; - break; - case CR: - parser->state = s_res_line_almost_done; - break; - case LF: - parser->state = s_header_field_start; - break; - default: - SET_ERRNO(HPE_INVALID_STATUS); - goto error; - } - break; - } - - parser->status_code *= 10; - parser->status_code += ch - '0'; - - if (parser->status_code > 999) { - SET_ERRNO(HPE_INVALID_STATUS); - goto error; - } - - break; - } - - case s_res_status: - /* the human readable status. e.g. "NOT FOUND" - * we are not humans so just ignore this */ - if (ch == CR) { - parser->state = s_res_line_almost_done; - break; - } - - if (ch == LF) { - parser->state = s_header_field_start; - break; - } - break; - - case s_res_line_almost_done: - STRICT_CHECK(ch != LF); - parser->state = s_header_field_start; - CALLBACK_NOTIFY(status_complete); - break; - - case s_start_req: - { - if (ch == CR || ch == LF) - break; - parser->flags = 0; - parser->content_length = ULLONG_MAX; - - if (!IS_ALPHA(ch)) { - SET_ERRNO(HPE_INVALID_METHOD); - goto error; - } - - parser->method = (enum http_method) 0; - parser->index = 1; - switch (ch) { - case 'C': parser->method = HTTP_CONNECT; /* or COPY, CHECKOUT */ break; - case 'D': parser->method = HTTP_DELETE; break; - case 'G': parser->method = HTTP_GET; break; - case 'H': parser->method = HTTP_HEAD; break; - case 'L': parser->method = HTTP_LOCK; break; - case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE, M-SEARCH */ break; - case 'N': parser->method = HTTP_NOTIFY; break; - case 'O': parser->method = HTTP_OPTIONS; break; - case 'P': parser->method = HTTP_POST; - /* or PROPFIND|PROPPATCH|PUT|PATCH|PURGE */ - break; - case 'R': parser->method = HTTP_REPORT; break; - case 'S': parser->method = HTTP_SUBSCRIBE; /* or SEARCH */ break; - case 'T': parser->method = HTTP_TRACE; break; - case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE */ break; - default: - SET_ERRNO(HPE_INVALID_METHOD); - goto error; - } - parser->state = s_req_method; - - CALLBACK_NOTIFY(message_begin); - - break; - } - - case s_req_method: - { - const char *matcher; - if (ch == '\0') { - SET_ERRNO(HPE_INVALID_METHOD); - goto error; - } - - matcher = method_strings[parser->method]; - if (ch == ' ' && matcher[parser->index] == '\0') { - parser->state = s_req_spaces_before_url; - } else if (ch == matcher[parser->index]) { - ; /* nada */ - } else if (parser->method == HTTP_CONNECT) { - if (parser->index == 1 && ch == 'H') { - parser->method = HTTP_CHECKOUT; - } else if (parser->index == 2 && ch == 'P') { - parser->method = HTTP_COPY; - } else { - goto error; - } - } else if (parser->method == HTTP_MKCOL) { - if (parser->index == 1 && ch == 'O') { - parser->method = HTTP_MOVE; - } else if (parser->index == 1 && ch == 'E') { - parser->method = HTTP_MERGE; - } else if (parser->index == 1 && ch == '-') { - parser->method = HTTP_MSEARCH; - } else if (parser->index == 2 && ch == 'A') { - parser->method = HTTP_MKACTIVITY; - } else { - goto error; - } - } else if (parser->method == HTTP_SUBSCRIBE) { - if (parser->index == 1 && ch == 'E') { - parser->method = HTTP_SEARCH; - } else { - goto error; - } - } else if (parser->index == 1 && parser->method == HTTP_POST) { - if (ch == 'R') { - parser->method = HTTP_PROPFIND; /* or HTTP_PROPPATCH */ - } else if (ch == 'U') { - parser->method = HTTP_PUT; /* or HTTP_PURGE */ - } else if (ch == 'A') { - parser->method = HTTP_PATCH; - } else { - goto error; - } - } else if (parser->index == 2) { - if (parser->method == HTTP_PUT) { - if (ch == 'R') parser->method = HTTP_PURGE; - } else if (parser->method == HTTP_UNLOCK) { - if (ch == 'S') parser->method = HTTP_UNSUBSCRIBE; - } - } else if (parser->index == 4 && parser->method == HTTP_PROPFIND && ch == 'P') { - parser->method = HTTP_PROPPATCH; - } else { - SET_ERRNO(HPE_INVALID_METHOD); - goto error; - } - - ++parser->index; - break; - } - - case s_req_spaces_before_url: - { - if (ch == ' ') break; - - MARK(url); - if (parser->method == HTTP_CONNECT) { - parser->state = s_req_server_start; - } - - parser->state = parse_url_char((enum state)parser->state, ch); - if (parser->state == s_dead) { - SET_ERRNO(HPE_INVALID_URL); - goto error; - } - - break; - } - - case s_req_schema: - case s_req_schema_slash: - case s_req_schema_slash_slash: - case s_req_server_start: - { - switch (ch) { - /* No whitespace allowed here */ - case ' ': - case CR: - case LF: - SET_ERRNO(HPE_INVALID_URL); - goto error; - default: - parser->state = parse_url_char((enum state)parser->state, ch); - if (parser->state == s_dead) { - SET_ERRNO(HPE_INVALID_URL); - goto error; - } - } - - break; - } - - case s_req_server: - case s_req_server_with_at: - case s_req_path: - case s_req_query_string_start: - case s_req_query_string: - case s_req_fragment_start: - case s_req_fragment: - { - switch (ch) { - case ' ': - parser->state = s_req_http_start; - CALLBACK_DATA(url); - break; - case CR: - case LF: - parser->http_major = 0; - parser->http_minor = 9; - parser->state = (ch == CR) ? - s_req_line_almost_done : - s_header_field_start; - CALLBACK_DATA(url); - break; - default: - parser->state = parse_url_char((enum state)parser->state, ch); - if (parser->state == s_dead) { - SET_ERRNO(HPE_INVALID_URL); - goto error; - } - } - break; - } - - case s_req_http_start: - switch (ch) { - case 'H': - parser->state = s_req_http_H; - break; - case ' ': - break; - default: - SET_ERRNO(HPE_INVALID_CONSTANT); - goto error; - } - break; - - case s_req_http_H: - STRICT_CHECK(ch != 'T'); - parser->state = s_req_http_HT; - break; - - case s_req_http_HT: - STRICT_CHECK(ch != 'T'); - parser->state = s_req_http_HTT; - break; - - case s_req_http_HTT: - STRICT_CHECK(ch != 'P'); - parser->state = s_req_http_HTTP; - break; - - case s_req_http_HTTP: - STRICT_CHECK(ch != '/'); - parser->state = s_req_first_http_major; - break; - - /* first digit of major HTTP version */ - case s_req_first_http_major: - if (ch < '1' || ch > '9') { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - parser->http_major = ch - '0'; - parser->state = s_req_http_major; - break; - - /* major HTTP version or dot */ - case s_req_http_major: - { - if (ch == '.') { - parser->state = s_req_first_http_minor; - break; - } - - if (!IS_NUM(ch)) { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - parser->http_major *= 10; - parser->http_major += ch - '0'; - - if (parser->http_major > 999) { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - break; - } - - /* first digit of minor HTTP version */ - case s_req_first_http_minor: - if (!IS_NUM(ch)) { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - parser->http_minor = ch - '0'; - parser->state = s_req_http_minor; - break; - - /* minor HTTP version or end of request line */ - case s_req_http_minor: - { - if (ch == CR) { - parser->state = s_req_line_almost_done; - break; - } - - if (ch == LF) { - parser->state = s_header_field_start; - break; - } - - /* XXX allow spaces after digit? */ - - if (!IS_NUM(ch)) { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - parser->http_minor *= 10; - parser->http_minor += ch - '0'; - - if (parser->http_minor > 999) { - SET_ERRNO(HPE_INVALID_VERSION); - goto error; - } - - break; - } - - /* end of request line */ - case s_req_line_almost_done: - { - if (ch != LF) { - SET_ERRNO(HPE_LF_EXPECTED); - goto error; - } - - parser->state = s_header_field_start; - break; - } - - case s_header_field_start: - { - if (ch == CR) { - parser->state = s_headers_almost_done; - break; - } - - if (ch == LF) { - /* they might be just sending \n instead of \r\n so this would be - * the second \n to denote the end of headers*/ - parser->state = s_headers_almost_done; - goto reexecute_byte; - } - - c = TOKEN(ch); - - if (!c) { - SET_ERRNO(HPE_INVALID_HEADER_TOKEN); - goto error; - } - - MARK(header_field); - - parser->index = 0; - parser->state = s_header_field; - - switch (c) { - case 'c': - parser->header_state = h_C; - break; - - case 'p': - parser->header_state = h_matching_proxy_connection; - break; - - case 't': - parser->header_state = h_matching_transfer_encoding; - break; - - case 'u': - parser->header_state = h_matching_upgrade; - break; - - default: - parser->header_state = h_general; - break; - } - break; - } - - case s_header_field: - { - c = TOKEN(ch); - - if (c) { - switch (parser->header_state) { - case h_general: - break; - - case h_C: - parser->index++; - parser->header_state = (c == 'o' ? h_CO : h_general); - break; - - case h_CO: - parser->index++; - parser->header_state = (c == 'n' ? h_CON : h_general); - break; - - case h_CON: - parser->index++; - switch (c) { - case 'n': - parser->header_state = h_matching_connection; - break; - case 't': - parser->header_state = h_matching_content_length; - break; - default: - parser->header_state = h_general; - break; - } - break; - - /* connection */ - - case h_matching_connection: - parser->index++; - if (parser->index > sizeof(CONNECTION)-1 - || c != CONNECTION[parser->index]) { - parser->header_state = h_general; - } else if (parser->index == sizeof(CONNECTION)-2) { - parser->header_state = h_connection; - } - break; - - /* proxy-connection */ - - case h_matching_proxy_connection: - parser->index++; - if (parser->index > sizeof(PROXY_CONNECTION)-1 - || c != PROXY_CONNECTION[parser->index]) { - parser->header_state = h_general; - } else if (parser->index == sizeof(PROXY_CONNECTION)-2) { - parser->header_state = h_connection; - } - break; - - /* content-length */ - - case h_matching_content_length: - parser->index++; - if (parser->index > sizeof(CONTENT_LENGTH)-1 - || c != CONTENT_LENGTH[parser->index]) { - parser->header_state = h_general; - } else if (parser->index == sizeof(CONTENT_LENGTH)-2) { - parser->header_state = h_content_length; - } - break; - - /* transfer-encoding */ - - case h_matching_transfer_encoding: - parser->index++; - if (parser->index > sizeof(TRANSFER_ENCODING)-1 - || c != TRANSFER_ENCODING[parser->index]) { - parser->header_state = h_general; - } else if (parser->index == sizeof(TRANSFER_ENCODING)-2) { - parser->header_state = h_transfer_encoding; - } - break; - - /* upgrade */ - - case h_matching_upgrade: - parser->index++; - if (parser->index > sizeof(UPGRADE)-1 - || c != UPGRADE[parser->index]) { - parser->header_state = h_general; - } else if (parser->index == sizeof(UPGRADE)-2) { - parser->header_state = h_upgrade; - } - break; - - case h_connection: - case h_content_length: - case h_transfer_encoding: - case h_upgrade: - if (ch != ' ') parser->header_state = h_general; - break; - - default: - assert(0 && "Unknown header_state"); - break; - } - break; - } - - if (ch == ':') { - parser->state = s_header_value_start; - CALLBACK_DATA(header_field); - break; - } - - if (ch == CR) { - parser->state = s_header_almost_done; - CALLBACK_DATA(header_field); - break; - } - - if (ch == LF) { - parser->state = s_header_field_start; - CALLBACK_DATA(header_field); - break; - } - - SET_ERRNO(HPE_INVALID_HEADER_TOKEN); - goto error; - } - - case s_header_value_start: - { - if (ch == ' ' || ch == '\t') break; - - MARK(header_value); - - parser->state = s_header_value; - parser->index = 0; - - if (ch == CR) { - parser->header_state = h_general; - parser->state = s_header_almost_done; - CALLBACK_DATA(header_value); - break; - } - - if (ch == LF) { - parser->state = s_header_field_start; - CALLBACK_DATA(header_value); - break; - } - - c = LOWER(ch); - - switch (parser->header_state) { - case h_upgrade: - parser->flags |= F_UPGRADE; - parser->header_state = h_general; - break; - - case h_transfer_encoding: - /* looking for 'Transfer-Encoding: chunked' */ - if ('c' == c) { - parser->header_state = h_matching_transfer_encoding_chunked; - } else { - parser->header_state = h_general; - } - break; - - case h_content_length: - if (!IS_NUM(ch)) { - SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); - goto error; - } - - parser->content_length = ch - '0'; - break; - - case h_connection: - /* looking for 'Connection: keep-alive' */ - if (c == 'k') { - parser->header_state = h_matching_connection_keep_alive; - /* looking for 'Connection: close' */ - } else if (c == 'c') { - parser->header_state = h_matching_connection_close; - } else { - parser->header_state = h_general; - } - break; - - default: - parser->header_state = h_general; - break; - } - break; - } - - case s_header_value: - { - - if (ch == CR) { - parser->state = s_header_almost_done; - CALLBACK_DATA(header_value); - break; - } - - if (ch == LF) { - parser->state = s_header_almost_done; - CALLBACK_DATA_NOADVANCE(header_value); - goto reexecute_byte; - } - - c = LOWER(ch); - - switch (parser->header_state) { - case h_general: - break; - - case h_connection: - case h_transfer_encoding: - assert(0 && "Shouldn't get here."); - break; - - case h_content_length: - { - uint64_t t; - - if (ch == ' ') break; - - if (!IS_NUM(ch)) { - SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); - goto error; - } - - t = parser->content_length; - t *= 10; - t += ch - '0'; - - /* Overflow? */ - if (t < parser->content_length || t == ULLONG_MAX) { - SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); - goto error; - } - - parser->content_length = t; - break; - } - - /* Transfer-Encoding: chunked */ - case h_matching_transfer_encoding_chunked: - parser->index++; - if (parser->index > sizeof(CHUNKED)-1 - || c != CHUNKED[parser->index]) { - parser->header_state = h_general; - } else if (parser->index == sizeof(CHUNKED)-2) { - parser->header_state = h_transfer_encoding_chunked; - } - break; - - /* looking for 'Connection: keep-alive' */ - case h_matching_connection_keep_alive: - parser->index++; - if (parser->index > sizeof(KEEP_ALIVE)-1 - || c != KEEP_ALIVE[parser->index]) { - parser->header_state = h_general; - } else if (parser->index == sizeof(KEEP_ALIVE)-2) { - parser->header_state = h_connection_keep_alive; - } - break; - - /* looking for 'Connection: close' */ - case h_matching_connection_close: - parser->index++; - if (parser->index > sizeof(CLOSE)-1 || c != CLOSE[parser->index]) { - parser->header_state = h_general; - } else if (parser->index == sizeof(CLOSE)-2) { - parser->header_state = h_connection_close; - } - break; - - case h_transfer_encoding_chunked: - case h_connection_keep_alive: - case h_connection_close: - if (ch != ' ') parser->header_state = h_general; - break; - - default: - parser->state = s_header_value; - parser->header_state = h_general; - break; - } - break; - } - - case s_header_almost_done: - { - STRICT_CHECK(ch != LF); - - parser->state = s_header_value_lws; - - switch (parser->header_state) { - case h_connection_keep_alive: - parser->flags |= F_CONNECTION_KEEP_ALIVE; - break; - case h_connection_close: - parser->flags |= F_CONNECTION_CLOSE; - break; - case h_transfer_encoding_chunked: - parser->flags |= F_CHUNKED; - break; - default: - break; - } - - break; - } - - case s_header_value_lws: - { - if (ch == ' ' || ch == '\t') - parser->state = s_header_value_start; - else - { - parser->state = s_header_field_start; - goto reexecute_byte; - } - break; - } - - case s_headers_almost_done: - { - STRICT_CHECK(ch != LF); - - if (parser->flags & F_TRAILING) { - /* End of a chunked request */ - parser->state = NEW_MESSAGE(); - CALLBACK_NOTIFY(message_complete); - break; - } - - parser->state = s_headers_done; - - /* Set this here so that on_headers_complete() callbacks can see it */ - parser->upgrade = - (parser->flags & F_UPGRADE || parser->method == HTTP_CONNECT); - - /* Here we call the headers_complete callback. This is somewhat - * different than other callbacks because if the user returns 1, we - * will interpret that as saying that this message has no body. This - * is needed for the annoying case of recieving a response to a HEAD - * request. - * - * We'd like to use CALLBACK_NOTIFY_NOADVANCE() here but we cannot, so - * we have to simulate it by handling a change in errno below. - */ - if (settings->on_headers_complete) { - switch (settings->on_headers_complete(parser)) { - case 0: - break; - - case 1: - parser->flags |= F_SKIPBODY; - break; - - default: - SET_ERRNO(HPE_CB_headers_complete); - return p - data; /* Error */ - } - } - - if (HTTP_PARSER_ERRNO(parser) != HPE_OK) { - return p - data; - } - - goto reexecute_byte; - } - - case s_headers_done: - { - STRICT_CHECK(ch != LF); - - parser->nread = 0; - - /* Exit, the rest of the connect is in a different protocol. */ - if (parser->upgrade) { - parser->state = NEW_MESSAGE(); - CALLBACK_NOTIFY(message_complete); - return (p - data) + 1; - } - - if (parser->flags & F_SKIPBODY) { - parser->state = NEW_MESSAGE(); - CALLBACK_NOTIFY(message_complete); - } else if (parser->flags & F_CHUNKED) { - /* chunked encoding - ignore Content-Length header */ - parser->state = s_chunk_size_start; - } else { - if (parser->content_length == 0) { - /* Content-Length header given but zero: Content-Length: 0\r\n */ - parser->state = NEW_MESSAGE(); - CALLBACK_NOTIFY(message_complete); - } else if (parser->content_length != ULLONG_MAX) { - /* Content-Length header given and non-zero */ - parser->state = s_body_identity; - } else { - if (parser->type == HTTP_REQUEST || - !http_message_needs_eof(parser)) { - /* Assume content-length 0 - read the next */ - parser->state = NEW_MESSAGE(); - CALLBACK_NOTIFY(message_complete); - } else { - /* Read body until EOF */ - parser->state = s_body_identity_eof; - } - } - } - - break; - } - - case s_body_identity: - { - uint64_t to_read = MIN(parser->content_length, - (uint64_t) ((data + len) - p)); - - assert(parser->content_length != 0 - && parser->content_length != ULLONG_MAX); - - /* The difference between advancing content_length and p is because - * the latter will automaticaly advance on the next loop iteration. - * Further, if content_length ends up at 0, we want to see the last - * byte again for our message complete callback. - */ - MARK(body); - parser->content_length -= to_read; - p += to_read - 1; - - if (parser->content_length == 0) { - parser->state = s_message_done; - - /* Mimic CALLBACK_DATA_NOADVANCE() but with one extra byte. - * - * The alternative to doing this is to wait for the next byte to - * trigger the data callback, just as in every other case. The - * problem with this is that this makes it difficult for the test - * harness to distinguish between complete-on-EOF and - * complete-on-length. It's not clear that this distinction is - * important for applications, but let's keep it for now. - */ - CALLBACK_DATA_(body, p - body_mark + 1, p - data); - goto reexecute_byte; - } - - break; - } - - /* read until EOF */ - case s_body_identity_eof: - MARK(body); - p = data + len - 1; - - break; - - case s_message_done: - parser->state = NEW_MESSAGE(); - CALLBACK_NOTIFY(message_complete); - break; - - case s_chunk_size_start: - { - assert(parser->nread == 1); - assert(parser->flags & F_CHUNKED); - - unhex_val = unhex[(unsigned char)ch]; - if (unhex_val == -1) { - SET_ERRNO(HPE_INVALID_CHUNK_SIZE); - goto error; - } - - parser->content_length = unhex_val; - parser->state = s_chunk_size; - break; - } - - case s_chunk_size: - { - uint64_t t; - - assert(parser->flags & F_CHUNKED); - - if (ch == CR) { - parser->state = s_chunk_size_almost_done; - break; - } - - unhex_val = unhex[(unsigned char)ch]; - - if (unhex_val == -1) { - if (ch == ';' || ch == ' ') { - parser->state = s_chunk_parameters; - break; - } - - SET_ERRNO(HPE_INVALID_CHUNK_SIZE); - goto error; - } - - t = parser->content_length; - t *= 16; - t += unhex_val; - - /* Overflow? */ - if (t < parser->content_length || t == ULLONG_MAX) { - SET_ERRNO(HPE_INVALID_CONTENT_LENGTH); - goto error; - } - - parser->content_length = t; - break; - } - - case s_chunk_parameters: - { - assert(parser->flags & F_CHUNKED); - /* just ignore this shit. TODO check for overflow */ - if (ch == CR) { - parser->state = s_chunk_size_almost_done; - break; - } - break; - } - - case s_chunk_size_almost_done: - { - assert(parser->flags & F_CHUNKED); - STRICT_CHECK(ch != LF); - - parser->nread = 0; - - if (parser->content_length == 0) { - parser->flags |= F_TRAILING; - parser->state = s_header_field_start; - } else { - parser->state = s_chunk_data; - } - break; - } - - case s_chunk_data: - { - uint64_t to_read = MIN(parser->content_length, - (uint64_t) ((data + len) - p)); - - assert(parser->flags & F_CHUNKED); - assert(parser->content_length != 0 - && parser->content_length != ULLONG_MAX); - - /* See the explanation in s_body_identity for why the content - * length and data pointers are managed this way. - */ - MARK(body); - parser->content_length -= to_read; - p += to_read - 1; - - if (parser->content_length == 0) { - parser->state = s_chunk_data_almost_done; - } - - break; - } - - case s_chunk_data_almost_done: - assert(parser->flags & F_CHUNKED); - assert(parser->content_length == 0); - STRICT_CHECK(ch != CR); - parser->state = s_chunk_data_done; - CALLBACK_DATA(body); - break; - - case s_chunk_data_done: - assert(parser->flags & F_CHUNKED); - STRICT_CHECK(ch != LF); - parser->nread = 0; - parser->state = s_chunk_size_start; - break; - - default: - assert(0 && "unhandled state"); - SET_ERRNO(HPE_INVALID_INTERNAL_STATE); - goto error; - } - } - - /* Run callbacks for any marks that we have leftover after we ran our of - * bytes. There should be at most one of these set, so it's OK to invoke - * them in series (unset marks will not result in callbacks). - * - * We use the NOADVANCE() variety of callbacks here because 'p' has already - * overflowed 'data' and this allows us to correct for the off-by-one that - * we'd otherwise have (since CALLBACK_DATA() is meant to be run with a 'p' - * value that's in-bounds). - */ - - assert(((header_field_mark ? 1 : 0) + - (header_value_mark ? 1 : 0) + - (url_mark ? 1 : 0) + - (body_mark ? 1 : 0)) <= 1); - - CALLBACK_DATA_NOADVANCE(header_field); - CALLBACK_DATA_NOADVANCE(header_value); - CALLBACK_DATA_NOADVANCE(url); - CALLBACK_DATA_NOADVANCE(body); - - return len; - -error: - if (HTTP_PARSER_ERRNO(parser) == HPE_OK) { - SET_ERRNO(HPE_UNKNOWN); - } - - return (p - data); -} - - -/* Does the parser need to see an EOF to find the end of the message? */ -int -http_message_needs_eof (const http_parser *parser) -{ - if (parser->type == HTTP_REQUEST) { - return 0; - } - - /* See RFC 2616 section 4.4 */ - if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */ - parser->status_code == 204 || /* No Content */ - parser->status_code == 304 || /* Not Modified */ - parser->flags & F_SKIPBODY) { /* response to a HEAD request */ - return 0; - } - - if ((parser->flags & F_CHUNKED) || parser->content_length != ULLONG_MAX) { - return 0; - } - - return 1; -} - - -int -http_should_keep_alive (const http_parser *parser) -{ - if (parser->http_major > 0 && parser->http_minor > 0) { - /* HTTP/1.1 */ - if (parser->flags & F_CONNECTION_CLOSE) { - return 0; - } - } else { - /* HTTP/1.0 or earlier */ - if (!(parser->flags & F_CONNECTION_KEEP_ALIVE)) { - return 0; - } - } - - return !http_message_needs_eof(parser); -} - - -const char * -http_method_str (enum http_method m) -{ - return ELEM_AT(method_strings, m, ""); -} - - -void -http_parser_init (http_parser *parser, enum http_parser_type t) -{ - void *data = parser->data; /* preserve application data */ - memset(parser, 0, sizeof(*parser)); - parser->data = data; - parser->type = t; - parser->state = (t == HTTP_REQUEST ? s_start_req : (t == HTTP_RESPONSE ? s_start_res : s_start_req_or_res)); - parser->http_errno = HPE_OK; -} - -const char * -http_errno_name(enum http_errno err) { - assert(err < (sizeof(http_strerror_tab)/sizeof(http_strerror_tab[0]))); - return http_strerror_tab[err].name; -} - -const char * -http_errno_description(enum http_errno err) { - assert(err < (sizeof(http_strerror_tab)/sizeof(http_strerror_tab[0]))); - return http_strerror_tab[err].description; -} - -static enum http_host_state -http_parse_host_char(enum http_host_state s, const char ch) { - switch(s) { - case s_http_userinfo: - case s_http_userinfo_start: - if (ch == '@') { - return s_http_host_start; - } - - if (IS_USERINFO_CHAR(ch)) { - return s_http_userinfo; - } - break; - - case s_http_host_start: - if (ch == '[') { - return s_http_host_v6_start; - } - - if (IS_HOST_CHAR(ch)) { - return s_http_host; - } - - break; - - case s_http_host: - if (IS_HOST_CHAR(ch)) { - return s_http_host; - } - - /* FALLTHROUGH */ - case s_http_host_v6_end: - if (ch == ':') { - return s_http_host_port_start; - } - - break; - - case s_http_host_v6: - if (ch == ']') { - return s_http_host_v6_end; - } - - /* FALLTHROUGH */ - case s_http_host_v6_start: - if (IS_HEX(ch) || ch == ':' || ch == '.') { - return s_http_host_v6; - } - - break; - - case s_http_host_port: - case s_http_host_port_start: - if (IS_NUM(ch)) { - return s_http_host_port; - } - - break; - - default: - break; - } - return s_http_host_dead; -} - -static int -http_parse_host(const char * buf, struct http_parser_url *u, int found_at) { - enum http_host_state s; - - const char *p; - size_t buflen = u->field_data[UF_HOST].off + u->field_data[UF_HOST].len; - - u->field_data[UF_HOST].len = 0; - - s = found_at ? s_http_userinfo_start : s_http_host_start; - - for (p = buf + u->field_data[UF_HOST].off; p < buf + buflen; p++) { - enum http_host_state new_s = http_parse_host_char(s, *p); - - if (new_s == s_http_host_dead) { - return 1; - } - - switch(new_s) { - case s_http_host: - if (s != s_http_host) { - u->field_data[UF_HOST].off = p - buf; - } - u->field_data[UF_HOST].len++; - break; - - case s_http_host_v6: - if (s != s_http_host_v6) { - u->field_data[UF_HOST].off = p - buf; - } - u->field_data[UF_HOST].len++; - break; - - case s_http_host_port: - if (s != s_http_host_port) { - u->field_data[UF_PORT].off = p - buf; - u->field_data[UF_PORT].len = 0; - u->field_set |= (1 << UF_PORT); - } - u->field_data[UF_PORT].len++; - break; - - case s_http_userinfo: - if (s != s_http_userinfo) { - u->field_data[UF_USERINFO].off = p - buf ; - u->field_data[UF_USERINFO].len = 0; - u->field_set |= (1 << UF_USERINFO); - } - u->field_data[UF_USERINFO].len++; - break; - - default: - break; - } - s = new_s; - } - - /* Make sure we don't end somewhere unexpected */ - switch (s) { - case s_http_host_start: - case s_http_host_v6_start: - case s_http_host_v6: - case s_http_host_port_start: - case s_http_userinfo: - case s_http_userinfo_start: - return 1; - default: - break; - } - - return 0; -} - -int -http_parser_parse_url(const char *buf, size_t buflen, int is_connect, - struct http_parser_url *u) -{ - enum state s; - const char *p; - enum http_parser_url_fields uf, old_uf; - int found_at = 0; - - u->port = u->field_set = 0; - s = is_connect ? s_req_server_start : s_req_spaces_before_url; - uf = old_uf = UF_MAX; - - for (p = buf; p < buf + buflen; p++) { - s = parse_url_char(s, *p); - - /* Figure out the next field that we're operating on */ - switch (s) { - case s_dead: - return 1; - - /* Skip delimeters */ - case s_req_schema_slash: - case s_req_schema_slash_slash: - case s_req_server_start: - case s_req_query_string_start: - case s_req_fragment_start: - continue; - - case s_req_schema: - uf = UF_SCHEMA; - break; - - case s_req_server_with_at: - found_at = 1; - - /* FALLTROUGH */ - case s_req_server: - uf = UF_HOST; - break; - - case s_req_path: - uf = UF_PATH; - break; - - case s_req_query_string: - uf = UF_QUERY; - break; - - case s_req_fragment: - uf = UF_FRAGMENT; - break; - - default: - assert(!"Unexpected state"); - return 1; - } - - /* Nothing's changed; soldier on */ - if (uf == old_uf) { - u->field_data[uf].len++; - continue; - } - - u->field_data[uf].off = p - buf; - u->field_data[uf].len = 1; - - u->field_set |= (1 << uf); - old_uf = uf; - } - - /* host must be present if there is a schema */ - /* parsing http:///toto will fail */ - if ((u->field_set & ((1 << UF_SCHEMA) | (1 << UF_HOST))) != 0) { - if (http_parse_host(buf, u, found_at) != 0) { - return 1; - } - } - - /* CONNECT requests can only contain "hostname:port" */ - if (is_connect && u->field_set != ((1 << UF_HOST)|(1 << UF_PORT))) { - return 1; - } - - if (u->field_set & (1 << UF_PORT)) { - /* Don't bother with endp; we've already validated the string */ - unsigned long v = strtoul(buf + u->field_data[UF_PORT].off, NULL, 10); - - /* Ports have a max value of 2^16 */ - if (v > 0xffff) { - return 1; - } - - u->port = (uint16_t) v; - } - - return 0; -} - -void -http_parser_pause(http_parser *parser, int paused) { - /* Users should only be pausing/unpausing a parser that is not in an error - * state. In non-debug builds, there's not much that we can do about this - * other than ignore it. - */ - if (HTTP_PARSER_ERRNO(parser) == HPE_OK || - HTTP_PARSER_ERRNO(parser) == HPE_PAUSED) { - SET_ERRNO((paused) ? HPE_PAUSED : HPE_OK); - } else { - assert(0 && "Attempting to pause parser in error state"); - } -} - -int -http_body_is_final(const struct http_parser *parser) { - return parser->state == s_message_done; -} diff --git a/src/http-parser/http_parser.gyp b/src/http-parser/http_parser.gyp deleted file mode 100644 index ef34eca..0000000 --- a/src/http-parser/http_parser.gyp +++ /dev/null @@ -1,111 +0,0 @@ -# This file is used with the GYP meta build system. -# http://code.google.com/p/gyp/ -# To build try this: -# svn co http://gyp.googlecode.com/svn/trunk gyp -# ./gyp/gyp -f make --depth=`pwd` http_parser.gyp -# ./out/Debug/test -{ - 'target_defaults': { - 'default_configuration': 'Debug', - 'configurations': { - # TODO: hoist these out and put them somewhere common, because - # RuntimeLibrary MUST MATCH across the entire project - 'Debug': { - 'defines': [ 'DEBUG', '_DEBUG' ], - 'cflags': [ '-Wall', '-Wextra', '-O0', '-g', '-ftrapv' ], - 'msvs_settings': { - 'VCCLCompilerTool': { - 'RuntimeLibrary': 1, # static debug - }, - }, - }, - 'Release': { - 'defines': [ 'NDEBUG' ], - 'cflags': [ '-Wall', '-Wextra', '-O3' ], - 'msvs_settings': { - 'VCCLCompilerTool': { - 'RuntimeLibrary': 0, # static release - }, - }, - } - }, - 'msvs_settings': { - 'VCCLCompilerTool': { - }, - 'VCLibrarianTool': { - }, - 'VCLinkerTool': { - 'GenerateDebugInformation': 'true', - }, - }, - 'conditions': [ - ['OS == "win"', { - 'defines': [ - 'WIN32' - ], - }] - ], - }, - - 'targets': [ - { - 'target_name': 'http_parser', - 'type': 'static_library', - 'include_dirs': [ '.' ], - 'direct_dependent_settings': { - 'defines': [ 'HTTP_PARSER_STRICT=0' ], - 'include_dirs': [ '.' ], - }, - 'defines': [ 'HTTP_PARSER_STRICT=0' ], - 'sources': [ './http_parser.c', ], - 'conditions': [ - ['OS=="win"', { - 'msvs_settings': { - 'VCCLCompilerTool': { - # Compile as C++. http_parser.c is actually C99, but C++ is - # close enough in this case. - 'CompileAs': 2, - }, - }, - }] - ], - }, - - { - 'target_name': 'http_parser_strict', - 'type': 'static_library', - 'include_dirs': [ '.' ], - 'direct_dependent_settings': { - 'defines': [ 'HTTP_PARSER_STRICT=1' ], - 'include_dirs': [ '.' ], - }, - 'defines': [ 'HTTP_PARSER_STRICT=1' ], - 'sources': [ './http_parser.c', ], - 'conditions': [ - ['OS=="win"', { - 'msvs_settings': { - 'VCCLCompilerTool': { - # Compile as C++. http_parser.c is actually C99, but C++ is - # close enough in this case. - 'CompileAs': 2, - }, - }, - }] - ], - }, - - { - 'target_name': 'test-nonstrict', - 'type': 'executable', - 'dependencies': [ 'http_parser' ], - 'sources': [ 'test.c' ] - }, - - { - 'target_name': 'test-strict', - 'type': 'executable', - 'dependencies': [ 'http_parser_strict' ], - 'sources': [ 'test.c' ] - } - ] -} diff --git a/src/http-parser/http_parser.h b/src/http-parser/http_parser.h deleted file mode 100644 index f7030c4..0000000 --- a/src/http-parser/http_parser.h +++ /dev/null @@ -1,304 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -#ifndef http_parser_h -#define http_parser_h -#ifdef __cplusplus -extern "C" { -#endif - -#define HTTP_PARSER_VERSION_MAJOR 2 -#define HTTP_PARSER_VERSION_MINOR 1 - -#include -#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600) -#include -#include -typedef __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -#include -#endif - -/* Compile with -DHTTP_PARSER_STRICT=0 to make less checks, but run - * faster - */ -#ifndef HTTP_PARSER_STRICT -# define HTTP_PARSER_STRICT 1 -#endif - -/* Maximium header size allowed */ -#define HTTP_MAX_HEADER_SIZE (80*1024) - - -typedef struct http_parser http_parser; -typedef struct http_parser_settings http_parser_settings; - - -/* Callbacks should return non-zero to indicate an error. The parser will - * then halt execution. - * - * The one exception is on_headers_complete. In a HTTP_RESPONSE parser - * returning '1' from on_headers_complete will tell the parser that it - * should not expect a body. This is used when receiving a response to a - * HEAD request which may contain 'Content-Length' or 'Transfer-Encoding: - * chunked' headers that indicate the presence of a body. - * - * http_data_cb does not return data chunks. It will be call arbitrarally - * many times for each string. E.G. you might get 10 callbacks for "on_url" - * each providing just a few characters more data. - */ -typedef int (*http_data_cb) (http_parser*, const char *at, size_t length); -typedef int (*http_cb) (http_parser*); - - -/* Request Methods */ -#define HTTP_METHOD_MAP(XX) \ - XX(0, DELETE, DELETE) \ - XX(1, GET, GET) \ - XX(2, HEAD, HEAD) \ - XX(3, POST, POST) \ - XX(4, PUT, PUT) \ - /* pathological */ \ - XX(5, CONNECT, CONNECT) \ - XX(6, OPTIONS, OPTIONS) \ - XX(7, TRACE, TRACE) \ - /* webdav */ \ - XX(8, COPY, COPY) \ - XX(9, LOCK, LOCK) \ - XX(10, MKCOL, MKCOL) \ - XX(11, MOVE, MOVE) \ - XX(12, PROPFIND, PROPFIND) \ - XX(13, PROPPATCH, PROPPATCH) \ - XX(14, SEARCH, SEARCH) \ - XX(15, UNLOCK, UNLOCK) \ - /* subversion */ \ - XX(16, REPORT, REPORT) \ - XX(17, MKACTIVITY, MKACTIVITY) \ - XX(18, CHECKOUT, CHECKOUT) \ - XX(19, MERGE, MERGE) \ - /* upnp */ \ - XX(20, MSEARCH, M-SEARCH) \ - XX(21, NOTIFY, NOTIFY) \ - XX(22, SUBSCRIBE, SUBSCRIBE) \ - XX(23, UNSUBSCRIBE, UNSUBSCRIBE) \ - /* RFC-5789 */ \ - XX(24, PATCH, PATCH) \ - XX(25, PURGE, PURGE) \ - -enum http_method - { -#define XX(num, name, string) HTTP_##name = num, - HTTP_METHOD_MAP(XX) -#undef XX - }; - - -enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH }; - - -/* Flag values for http_parser.flags field */ -enum flags - { F_CHUNKED = 1 << 0 - , F_CONNECTION_KEEP_ALIVE = 1 << 1 - , F_CONNECTION_CLOSE = 1 << 2 - , F_TRAILING = 1 << 3 - , F_UPGRADE = 1 << 4 - , F_SKIPBODY = 1 << 5 - }; - - -/* Map for errno-related constants - * - * The provided argument should be a macro that takes 2 arguments. - */ -#define HTTP_ERRNO_MAP(XX) \ - /* No error */ \ - XX(OK, "success") \ - \ - /* Callback-related errors */ \ - XX(CB_message_begin, "the on_message_begin callback failed") \ - XX(CB_status_complete, "the on_status_complete callback failed") \ - XX(CB_url, "the on_url callback failed") \ - XX(CB_header_field, "the on_header_field callback failed") \ - XX(CB_header_value, "the on_header_value callback failed") \ - XX(CB_headers_complete, "the on_headers_complete callback failed") \ - XX(CB_body, "the on_body callback failed") \ - XX(CB_message_complete, "the on_message_complete callback failed") \ - \ - /* Parsing-related errors */ \ - XX(INVALID_EOF_STATE, "stream ended at an unexpected time") \ - XX(HEADER_OVERFLOW, \ - "too many header bytes seen; overflow detected") \ - XX(CLOSED_CONNECTION, \ - "data received after completed connection: close message") \ - XX(INVALID_VERSION, "invalid HTTP version") \ - XX(INVALID_STATUS, "invalid HTTP status code") \ - XX(INVALID_METHOD, "invalid HTTP method") \ - XX(INVALID_URL, "invalid URL") \ - XX(INVALID_HOST, "invalid host") \ - XX(INVALID_PORT, "invalid port") \ - XX(INVALID_PATH, "invalid path") \ - XX(INVALID_QUERY_STRING, "invalid query string") \ - XX(INVALID_FRAGMENT, "invalid fragment") \ - XX(LF_EXPECTED, "LF character expected") \ - XX(INVALID_HEADER_TOKEN, "invalid character in header") \ - XX(INVALID_CONTENT_LENGTH, \ - "invalid character in content-length header") \ - XX(INVALID_CHUNK_SIZE, \ - "invalid character in chunk size header") \ - XX(INVALID_CONSTANT, "invalid constant string") \ - XX(INVALID_INTERNAL_STATE, "encountered unexpected internal state")\ - XX(STRICT, "strict mode assertion failed") \ - XX(PAUSED, "parser is paused") \ - XX(UNKNOWN, "an unknown error occurred") - - -/* Define HPE_* values for each errno value above */ -#define HTTP_ERRNO_GEN(n, s) HPE_##n, -enum http_errno { - HTTP_ERRNO_MAP(HTTP_ERRNO_GEN) -}; -#undef HTTP_ERRNO_GEN - - -/* Get an http_errno value from an http_parser */ -#define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno) - - -struct http_parser { - /** PRIVATE **/ - unsigned char type : 2; /* enum http_parser_type */ - unsigned char flags : 6; /* F_* values from 'flags' enum; semi-public */ - unsigned char state; /* enum state from http_parser.c */ - unsigned char header_state; /* enum header_state from http_parser.c */ - unsigned char index; /* index into current matcher */ - - uint32_t nread; /* # bytes read in various scenarios */ - uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */ - - /** READ-ONLY **/ - unsigned short http_major; - unsigned short http_minor; - unsigned short status_code; /* responses only */ - unsigned char method; /* requests only */ - unsigned char http_errno : 7; - - /* 1 = Upgrade header was present and the parser has exited because of that. - * 0 = No upgrade header present. - * Should be checked when http_parser_execute() returns in addition to - * error checking. - */ - unsigned char upgrade : 1; - - /** PUBLIC **/ - void *data; /* A pointer to get hook to the "connection" or "socket" object */ -}; - - -struct http_parser_settings { - http_cb on_message_begin; - http_data_cb on_url; - http_cb on_status_complete; - http_data_cb on_header_field; - http_data_cb on_header_value; - http_cb on_headers_complete; - http_data_cb on_body; - http_cb on_message_complete; -}; - - -enum http_parser_url_fields - { UF_SCHEMA = 0 - , UF_HOST = 1 - , UF_PORT = 2 - , UF_PATH = 3 - , UF_QUERY = 4 - , UF_FRAGMENT = 5 - , UF_USERINFO = 6 - , UF_MAX = 7 - }; - - -/* Result structure for http_parser_parse_url(). - * - * Callers should index into field_data[] with UF_* values iff field_set - * has the relevant (1 << UF_*) bit set. As a courtesy to clients (and - * because we probably have padding left over), we convert any port to - * a uint16_t. - */ -struct http_parser_url { - uint16_t field_set; /* Bitmask of (1 << UF_*) values */ - uint16_t port; /* Converted UF_PORT string */ - - struct { - uint16_t off; /* Offset into buffer in which field starts */ - uint16_t len; /* Length of run in buffer */ - } field_data[UF_MAX]; -}; - - -void http_parser_init(http_parser *parser, enum http_parser_type type); - - -size_t http_parser_execute(http_parser *parser, - const http_parser_settings *settings, - const char *data, - size_t len); - - -/* If http_should_keep_alive() in the on_headers_complete or - * on_message_complete callback returns 0, then this should be - * the last message on the connection. - * If you are the server, respond with the "Connection: close" header. - * If you are the client, close the connection. - */ -int http_should_keep_alive(const http_parser *parser); - -/* Returns a string version of the HTTP method. */ -const char *http_method_str(enum http_method m); - -/* Return a string name of the given error */ -const char *http_errno_name(enum http_errno err); - -/* Return a string description of the given error */ -const char *http_errno_description(enum http_errno err); - -/* Parse a URL; return nonzero on failure */ -int http_parser_parse_url(const char *buf, size_t buflen, - int is_connect, - struct http_parser_url *u); - -/* Pause or un-pause the parser; a nonzero value pauses */ -void http_parser_pause(http_parser *parser, int paused); - -/* Checks if this is the final chunk of the body. */ -int http_body_is_final(const http_parser *parser); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/http-parser/lua-http-parser.c b/src/http-parser/lua-http-parser.c deleted file mode 100644 index c81ec20..0000000 --- a/src/http-parser/lua-http-parser.c +++ /dev/null @@ -1,548 +0,0 @@ -#include -#include -#include -#include "http_parser.h" - -#define PARSER_MT "http.parser{parser}" - -#define check_parser(L, narg) \ - ((lhttp_parser*)luaL_checkudata((L), (narg), PARSER_MT)) - -/* The Lua stack indices */ -#define ST_FENV_IDX 3 -#define ST_BUFFER_IDX 4 -#define ST_LEN ST_BUFFER_IDX - -/* Callback identifiers are indices into the fenv table where the - * callback is saved. If you add/remove/change anything about these, - * be sure to update lhp_callback_names and FLAG_GET_BUF_CB_ID. - */ -#define CB_ON_MESSAGE_BEGIN 1 -#define CB_ON_URL 2 -#define CB_ON_HEADER 3 -#define CB_ON_HEADERS_COMPLETE 4 -#define CB_ON_BODY 5 -#define CB_ON_MESSAGE_COMPLETE 6 -#define CB_LEN (sizeof(lhp_callback_names)/sizeof(*lhp_callback_names)) - -static const char *lhp_callback_names[] = { - /* The MUST be in the same order as the above callbacks */ - "on_message_begin", - "on_url", - "on_header", - "on_headers_complete", - "on_body", - "on_message_complete", -}; - -/* Non-callback FENV indices. */ -#define FENV_BUFFER_IDX CB_LEN + 1 -#define FENV_LEN FENV_BUFFER_IDX - -#define FLAGS_BUF_CB_ID_BITS 3 -#define FLAGS_BUF_CB_ID_MASK ((1<<(FLAGS_BUF_CB_ID_BITS))-1) -/* Get the cb_id that has information stored in buff */ -#define FLAG_GET_BUF_CB_ID(flags) ((flags) & FLAGS_BUF_CB_ID_MASK) - -#define FLAGS_CB_ID_FIRST_BIT (1<<(FLAGS_BUF_CB_ID_BITS)) -#define CB_ID_TO_CB_BIT(cb_id) ((FLAGS_CB_ID_FIRST_BIT)<<(cb_id)) - -/* Test/set/remove a bit from the flags field of lhttp_parser. The - * FLAG_*_CB() macros test/set/remove the bit that signifies that a - * callback with that id has been registered in the FENV. - * - * The FLAG_*_BUF() macros test/set/remove the bit that signifies that - * data is buffered for that callback. - * - * The FLAG_*_HFIELD() macros test/set/remove the bit that signifies - * that the first element of the buffer is the header field key. - */ -#define FLAG_HAS_CB(flags, cb_id) ( (flags) & CB_ID_TO_CB_BIT(cb_id) ) -#define FLAG_SET_CB(flags, cb_id) ( (flags) |= CB_ID_TO_CB_BIT(cb_id) ) -#define FLAG_RM_CB(flags, cb_id) ( (flags) &= ~CB_ID_TO_CB_BIT(cb_id) ) - -#define FLAG_HAS_BUF(flags, cb_id) ( FLAG_GET_BUF_CB_ID(flags) == cb_id ) -#define FLAG_SET_BUF(flags, cb_id) ( (flags) = (((flags) & ~FLAGS_BUF_CB_ID_MASK) \ - | ((cb_id) & FLAGS_BUF_CB_ID_MASK)) ) -#define FLAG_RM_BUF(flags, cb_id) ( (flags) &= ~FLAGS_BUF_CB_ID_MASK ) - -#define FLAG_HAS_HFIELD(flags) ( ((flags) & FLAGS_CB_ID_FIRST_BIT) >> FLAGS_BUF_CB_ID_BITS ) -#define FLAG_SET_HFIELD(flags) ( (flags) |= FLAGS_CB_ID_FIRST_BIT ) -#define FLAG_RM_HFIELD(flags) ( (flags) &= ~FLAGS_CB_ID_FIRST_BIT ) - -typedef struct lhttp_parser { - http_parser parser; /* embedded http_parser. */ - int flags; /* See above flag test/set/remove macros. */ - int buf_len; /* number of buffered chunks for current callback. */ -} lhttp_parser; - -/* Concatinate and remove elements from the table at idx starting at - * element begin and going to length len. The final concatinated string - * is on the top of the stack. - */ -static int lhp_table_concat_and_clear(lua_State *L, int idx, int begin, int len) { - luaL_Buffer buff; - int real_len = len-begin+1; - - /* Empty table? */ - if ( !real_len ) { - lua_pushliteral(L, ""); - return 0; - } - - /* One element? */ - if ( 1 == real_len ) { - lua_rawgeti(L, idx, begin); - /* remove values from buffer. */ - lua_pushnil(L); - lua_rawseti(L, idx, begin); - return 0; - } - /* do a table concat. */ - luaL_buffinit(L, &buff); - for(; begin <= len; begin++) { - lua_rawgeti(L, idx, begin); - luaL_addvalue(&buff); - /* remove values from buffer. */ - lua_pushnil(L); - lua_rawseti(L, idx, begin); - } - luaL_pushresult(&buff); - return 0; -} - -/* "Flush" the buffer for the callback identified by cb_id. The - * CB_ON_HEADER cb_id is flushed by inspecting FLAG_HAS_HFIELD(). - * If that bit is not set, then the buffer is concatinated into - * a single string element in the buffer and nothing is pushed - * on the Lua stack. Otherwise the buffer table is cleared after - * pushing the following onto the Lua stack: - * - * CB_ON_HEADER function, - * first element of the buffer, - * second - length element of the buffer concatinated - * - * If cb_id is not CB_ON_HEADER then the buffer table is cleared after - * pushing the following onto the Lua stack: - * - * cb_id function, - * first - length elements of the buffer concatinated - * - */ -static int lhp_flush(lhttp_parser* lparser, int cb_id) { - lua_State* L = (lua_State*)lparser->parser.data; - int begin, len, result, top, save; - - assert(cb_id); - assert(FLAG_HAS_BUF(lparser->flags, cb_id)); - - if ( ! lua_checkstack(L, 7) ) return -1; - - len = lparser->buf_len; - begin = 1; - top = lua_gettop(L); - - FLAG_RM_BUF(lparser->flags, cb_id); - if ( CB_ON_HEADER == cb_id ) { - if ( FLAG_HAS_HFIELD(lparser->flags) ) { - /* Push , [, ] */ - lua_rawgeti(L, ST_FENV_IDX, cb_id); - lua_rawgeti(L, ST_BUFFER_IDX, 1); - lua_pushnil(L); - lua_rawseti(L, ST_BUFFER_IDX, 1); - - begin = 2; - save = 0; - lparser->buf_len = 0; - FLAG_RM_HFIELD(lparser->flags); - } else { - /* Save */ - begin = 1; - save = 1; - lparser->buf_len = 1; - } - } else { - /* Push [, */ - lua_rawgeti(L, ST_FENV_IDX, cb_id); - - begin = 1; - save = 0; - lparser->buf_len = 0; - } - - result = lhp_table_concat_and_clear(L, ST_BUFFER_IDX, begin, len); - if ( 0 != result ) { - lua_settop(L, top); - return result; - } - - if ( save ) lua_rawseti(L, ST_BUFFER_IDX, 1); - - return 0; -} - -/* Puts the str of length len into the buffer table and - * updates buf_len. It also sets the buf flag for cb_id. - */ -static int lhp_buffer(lhttp_parser* lparser, int cb_id, const char* str, size_t len, int hfield) { - lua_State* L = (lua_State*)lparser->parser.data; - - assert(cb_id); - assert(FLAG_HAS_CB(lparser->flags, cb_id)); - - /* insert event chunk into buffer. */ - FLAG_SET_BUF(lparser->flags, cb_id); - if ( hfield ) { - FLAG_SET_HFIELD(lparser->flags); - } - - lua_pushlstring(L, str, len); - lua_rawseti(L, ST_BUFFER_IDX, ++(lparser->buf_len)); - - return 0; -} - -/* Push the zero argument event for cb_id. Post condition: - * Lua stack contains , nil - */ -static int lhp_push_nil_event(lhttp_parser* lparser, int cb_id) { - lua_State* L = (lua_State*)lparser->parser.data; - - assert(FLAG_HAS_CB(lparser->flags, cb_id)); - - if ( ! lua_checkstack(L, 5) ) return -1; - - lua_rawgeti(L, ST_FENV_IDX, cb_id); - lua_pushnil(L); - - return 0; -} - -/* Flush the buffer as long as it is not the except_cb_id being buffered. - */ -static int lhp_flush_except(lhttp_parser* lparser, int except_cb_id, int hfield) { - int flush = 0; - int cb_id = FLAG_GET_BUF_CB_ID(lparser->flags); - - /* flush previous event and/or url */ - if ( cb_id ) { - if ( cb_id == CB_ON_HEADER ) { - flush = hfield ^ FLAG_HAS_HFIELD(lparser->flags); - } else if ( cb_id != except_cb_id ) { - flush = 1; - } - } - - if ( flush ) { - int result = lhp_flush(lparser, cb_id); - if ( 0 != result ) return result; - } - return 0; -} - -/* The event for cb_id where cb_id takes a string argument. - */ -static int lhp_http_data_cb(http_parser* parser, int cb_id, const char* str, size_t len, int hfield) { - lhttp_parser* lparser = (lhttp_parser*)parser; - - int result = lhp_flush_except(lparser, cb_id, hfield); - if ( 0 != result ) return result; - - if ( ! FLAG_HAS_CB(lparser->flags, cb_id) ) return 0; - - return lhp_buffer(lparser, cb_id, str, len, hfield); -} - -static int lhp_http_cb(http_parser* parser, int cb_id) { - lhttp_parser* lparser = (lhttp_parser*)parser; - - int result = lhp_flush_except(lparser, cb_id, 0); - if ( 0 != result ) return result; - - if ( ! FLAG_HAS_CB(lparser->flags, cb_id) ) return 0; - - return lhp_push_nil_event(lparser, cb_id); -} - -static int lhp_message_begin_cb(http_parser* parser) { - return lhp_http_cb(parser, CB_ON_MESSAGE_BEGIN); -} - -static int lhp_url_cb(http_parser* parser, const char* str, size_t len) { - return lhp_http_data_cb(parser, CB_ON_URL, str, len, 0); -} - -static int lhp_header_field_cb(http_parser* parser, const char* str, size_t len) { - return lhp_http_data_cb(parser, CB_ON_HEADER, str, len, 0); -} - -static int lhp_header_value_cb(http_parser* parser, const char* str, size_t len) { - return lhp_http_data_cb(parser, CB_ON_HEADER, str, len, 1); -} - -static int lhp_headers_complete_cb(http_parser* parser) { - return lhp_http_cb(parser, CB_ON_HEADERS_COMPLETE); -} - -static int lhp_body_cb(http_parser* parser, const char* str, size_t len) { - /* on_headers_complete did any flushing, so just push the cb */ - lhttp_parser* lparser = (lhttp_parser*)parser; - lua_State* L = (lua_State*)lparser->parser.data; - - if ( ! FLAG_HAS_CB(lparser->flags, CB_ON_BODY) ) return 0; - - if ( ! lua_checkstack(L, 5) ) return -1; - - lua_rawgeti(L, ST_FENV_IDX, CB_ON_BODY); - lua_pushlstring(L, str, len); - - return 0; -} - -static int lhp_message_complete_cb(http_parser* parser) { - /* Send on_body(nil) message to comply with LTN12 */ - int result = lhp_push_nil_event((lhttp_parser*)parser, CB_ON_BODY); - if ( 0 != result ) return result; - - return lhp_http_cb(parser, CB_ON_MESSAGE_COMPLETE); -} - -static int lhp_init(lua_State* L, enum http_parser_type type) { - int cb_id; - luaL_checktype(L, 1, LUA_TTABLE); - /* Stack: callbacks */ - - lhttp_parser* lparser = (lhttp_parser*)lua_newuserdata(L, sizeof(lhttp_parser)); - http_parser* parser = &(lparser->parser); - assert(NULL != parser); - /* Stack: callbacks, userdata */ - - lparser->flags = 0; - lparser->buf_len = 0; - - /* Get the metatable: */ - luaL_getmetatable(L, PARSER_MT); - assert(!lua_isnil(L, -1)/* PARSER_MT found? */); - /* Stack: callbacks, userdata, metatable */ - - /* Copy functions to new fenv table */ - lua_createtable(L, FENV_LEN, 0); - /* Stack: callbacks, userdata, metatable, fenv */ - for (cb_id = 1; cb_id <= CB_LEN; cb_id++ ) { - lua_getfield(L, 1, lhp_callback_names[cb_id-1]); - if ( lua_isfunction(L, -1) ) { - lua_rawseti(L, -2, cb_id); /* fenv[cb_id] = callback */ - FLAG_SET_CB(lparser->flags, cb_id); - } else { - lua_pop(L, 1); /* pop non-function value. */ - } - } - /* Create buffer table and add it to the fenv table. */ - lua_createtable(L, 1, 0); - lua_rawseti(L, -2, FENV_BUFFER_IDX); - /* Stack: callbacks, userdata, metatable, fenv */ - lua_setfenv(L, -3); - /* Stack: callbacks, userdata, metatable */ - - http_parser_init(parser, type); - parser->data = NULL; - - lua_setmetatable(L, -2); - - return 1; -} - -static int lhp_request(lua_State* L) { - return lhp_init(L, HTTP_REQUEST); -} -static int lhp_response(lua_State* L) { - return lhp_init(L, HTTP_RESPONSE); -} - -static int lhp_execute(lua_State* L) { - lhttp_parser* lparser = check_parser(L, 1); - http_parser* parser = &(lparser->parser); - size_t len; - size_t result; - const char* str = luaL_checklstring(L, 2, &len); - - static const http_parser_settings settings = { - .on_message_begin = lhp_message_begin_cb, - .on_url = lhp_url_cb, - .on_header_field = lhp_header_field_cb, - .on_header_value = lhp_header_value_cb, - .on_headers_complete = lhp_headers_complete_cb, - .on_body = lhp_body_cb, - .on_message_complete = lhp_message_complete_cb - }; - - /* truncate stack to (userdata, string) */ - lua_settop(L, 2); - - lua_getfenv(L, 1); - assert(lua_istable(L, -1)); - assert(lua_gettop(L) == ST_FENV_IDX); - - lua_rawgeti(L, ST_FENV_IDX, FENV_BUFFER_IDX); - assert(lua_istable(L, -1)); - assert(lua_gettop(L) == ST_BUFFER_IDX); - - assert(lua_gettop(L) == ST_LEN); - lua_pushnil(L); - - /* Stack: (userdata, string, fenv, buffer, url, nil) */ - parser->data = L; - - result = http_parser_execute(parser, &settings, str, len); - - parser->data = NULL; - - /* replace nil place-holder with 'result' code. */ - lua_pushnumber(L, result); - lua_replace(L, ST_LEN+1); - /* Transform the stack into a table: */ - len = lua_gettop(L) - ST_LEN; - - return len; -} - -static int lhp_should_keep_alive(lua_State* L) { - lhttp_parser* lparser = check_parser(L, 1); - lua_pushboolean(L, http_should_keep_alive(&lparser->parser)); - return 1; -} - -static int lhp_is_upgrade(lua_State* L) { - lhttp_parser* lparser = check_parser(L, 1); - lua_pushboolean(L, lparser->parser.upgrade); - return 1; -} - -static int lhp_method(lua_State* L) { - lhttp_parser* lparser = check_parser(L, 1); - switch(lparser->parser.method) { - case HTTP_DELETE: lua_pushliteral(L, "DELETE"); break; - case HTTP_GET: lua_pushliteral(L, "GET"); break; - case HTTP_HEAD: lua_pushliteral(L, "HEAD"); break; - case HTTP_POST: lua_pushliteral(L, "POST"); break; - case HTTP_PUT: lua_pushliteral(L, "PUT"); break; - case HTTP_CONNECT: lua_pushliteral(L, "CONNECT"); break; - case HTTP_OPTIONS: lua_pushliteral(L, "OPTIONS"); break; - case HTTP_TRACE: lua_pushliteral(L, "TRACE"); break; - case HTTP_COPY: lua_pushliteral(L, "COPY"); break; - case HTTP_LOCK: lua_pushliteral(L, "LOCK"); break; - case HTTP_MKCOL: lua_pushliteral(L, "MKCOL"); break; - case HTTP_MOVE: lua_pushliteral(L, "MOVE"); break; - case HTTP_PROPFIND: lua_pushliteral(L, "PROPFIND"); break; - case HTTP_PROPPATCH: lua_pushliteral(L, "PROPPATCH"); break; - case HTTP_UNLOCK: lua_pushliteral(L, "UNLOCK"); break; - default: - lua_pushnumber(L, lparser->parser.method); - } - return 1; -} - -static int lhp_version(lua_State* L) { - lhttp_parser* lparser = check_parser(L, 1); - lua_pushnumber(L, lparser->parser.http_major); - lua_pushnumber(L, lparser->parser.http_minor); - return 2; -} - -static int lhp_status_code(lua_State* L) { - lhttp_parser* lparser = check_parser(L, 1); - lua_pushnumber(L, lparser->parser.status_code); - return 1; -} - -static int lhp_error(lua_State* L) { - lhttp_parser* lparser = check_parser(L, 1); - enum http_errno http_errno = lparser->parser.http_errno; - lua_pushnumber(L, http_errno); - lua_pushstring(L, http_errno_name(http_errno)); - lua_pushstring(L, http_errno_description(http_errno)); - return 3; -} - -static int lhp_is_function(lua_State* L) { - lua_pushboolean(L, lua_isfunction(L, 1)); - return 1; -} - -/* The execute method has a "lua based stub" so that callbacks - * can yield without having to apply the CoCo patch to Lua. */ -static const char* lhp_execute_lua = - "local c_execute, is_function = ...\n" - "local type = type\n" - "local function execute(result, cb, arg1, arg2, ...)\n" - " if ( not cb ) then\n" - " return result\n" - " end\n" - " if ( is_function(arg2) ) then\n" - " cb(arg1)\n" - " return execute(result, arg2, ...)" - " end\n" - " cb(arg1, arg2)\n" - " return execute(result, ...)\n" - "end\n" - "return function(...)\n" - " return execute(c_execute(...))\n" - "end"; -static void lhp_push_execute_fn(lua_State* L) { -#ifndef NDEBUG - int top = lua_gettop(L); -#endif - int err = luaL_loadstring(L, lhp_execute_lua); - - if ( err ) lua_error(L); - - lua_pushcfunction(L, lhp_execute); - lua_pushcfunction(L, lhp_is_function); - lua_call(L, 2, 1); - - /* Compiled lua function should be at the top of the stack now. */ - assert(lua_gettop(L) == top + 1); - assert(lua_isfunction(L, -1)); -} - -LUALIB_API int luaopen_http_parser(lua_State* L) { - /* parser metatable init */ - luaL_newmetatable(L, PARSER_MT); - - lua_pushvalue(L, -1); - lua_setfield(L, -2, "__index"); - - lua_pushcfunction(L, lhp_is_upgrade); - lua_setfield(L, -2, "is_upgrade"); - - lua_pushcfunction(L, lhp_method); - lua_setfield(L, -2, "method"); - - lua_pushcfunction(L, lhp_version); - lua_setfield(L, -2, "version"); - - lua_pushcfunction(L, lhp_status_code); - lua_setfield(L, -2, "status_code"); - - lua_pushcfunction(L, lhp_error); - lua_setfield(L, -2, "error"); - - lua_pushcfunction(L, lhp_should_keep_alive); - lua_setfield(L, -2, "should_keep_alive"); - - lhp_push_execute_fn(L); - lua_setfield(L, -2, "execute"); - - lua_pop(L, 1); - - /* export http.parser */ - lua_newtable(L); /* Stack: table */ - - lua_pushcfunction(L, lhp_request); - lua_setfield(L, -2, "request"); - - lua_pushcfunction(L, lhp_response); - lua_setfield(L, -2, "response"); - - return 1; -} \ No newline at end of file diff --git a/src/include/glm/CMakeLists.txt b/src/include/glm/CMakeLists.txt deleted file mode 100755 index d3165df..0000000 --- a/src/include/glm/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -set(NAME glm) - -file(GLOB ROOT_SOURCE *.cpp) -file(GLOB ROOT_INLINE *.inl) -file(GLOB ROOT_HEADER *.hpp) - -file(GLOB_RECURSE CORE_SOURCE ./core/*.cpp) -file(GLOB_RECURSE CORE_INLINE ./core/*.inl) -file(GLOB_RECURSE CORE_HEADER ./core/*.hpp) - -file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) -file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) -file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) - -file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) -file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) -file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) - -file(GLOB_RECURSE VIRTREV_SOURCE ./virtrev/*.cpp) -file(GLOB_RECURSE VIRTREV_INLINE ./virtrev/*.inl) -file(GLOB_RECURSE VIRTREV_HEADER ./virtrev/*.hpp) - -source_group("Core Files" FILES ${CORE_SOURCE}) -source_group("Core Files" FILES ${CORE_INLINE}) -source_group("Core Files" FILES ${CORE_HEADER}) -source_group("GTC Files" FILES ${GTC_SOURCE}) -source_group("GTC Files" FILES ${GTC_INLINE}) -source_group("GTC Files" FILES ${GTC_HEADER}) -source_group("GTX Files" FILES ${GTX_SOURCE}) -source_group("GTX Files" FILES ${GTX_INLINE}) -source_group("GTX Files" FILES ${GTX_HEADER}) -source_group("VIRTREV Files" FILES ${VIRTREV_SOURCE}) -source_group("VIRTREV Files" FILES ${VIRTREV_INLINE}) -source_group("VIRTREV Files" FILES ${VIRTREV_HEADER}) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) - -add_executable(${NAME} - ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} - ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} - ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} - ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} - ${VIRTREV_SOURCE} ${VIRTREV_INLINE} ${VIRTREV_HEADER}) diff --git a/src/include/glm/core/_detail.hpp b/src/include/glm/core/_detail.hpp deleted file mode 100755 index 9ff5c52..0000000 --- a/src/include/glm/core/_detail.hpp +++ /dev/null @@ -1,468 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/_detail.hpp -/// @date 2008-07-24 / 2011-06-14 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_detail -#define glm_core_detail - -#include "setup.hpp" -#include -#if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -#include -#endif - -namespace glm{ -namespace detail -{ - class half; - -#if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available - typedef int64_t sint64; - typedef uint64_t uint64; -#elif(GLM_COMPILER & GLM_COMPILER_VC) - typedef signed __int64 sint64; - typedef unsigned __int64 uint64; -#elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC | GLM_COMPILER_CLANG)) - __extension__ typedef signed long long sint64; - __extension__ typedef unsigned long long uint64; -#elif(GLM_COMPILER & GLM_COMPILER_BC) - typedef Int64 sint64; - typedef Uint64 uint64; -#else//unknown compiler - typedef signed long long sint64; - typedef unsigned long long uint64; -#endif//GLM_COMPILER - - template - struct If - { - template - static GLM_FUNC_QUALIFIER T apply(F functor, const T& val) - { - return functor(val); - } - }; - - template<> - struct If - { - template - static GLM_FUNC_QUALIFIER T apply(F, const T& val) - { - return val; - } - }; - - //template - //struct traits - //{ - // static const bool is_signed = false; - // static const bool is_float = false; - // static const bool is_vector = false; - // static const bool is_matrix = false; - // static const bool is_genType = false; - // static const bool is_genIType = false; - // static const bool is_genUType = false; - //}; - - //template <> - //struct traits - //{ - // static const bool is_float = true; - // static const bool is_genType = true; - //}; - - //template <> - //struct traits - //{ - // static const bool is_float = true; - // static const bool is_genType = true; - //}; - - //template <> - //struct traits - //{ - // static const bool is_float = true; - // static const bool is_genType = true; - //}; - - //template - //struct desc - //{ - // typedef genType type; - // typedef genType * pointer; - // typedef genType const* const_pointer; - // typedef genType const *const const_pointer_const; - // typedef genType *const pointer_const; - // typedef genType & reference; - // typedef genType const& const_reference; - // typedef genType const& param_type; - - // typedef typename genType::value_type value_type; - // typedef typename genType::size_type size_type; - // static const typename size_type value_size; - //}; - - //template - //const typename desc::size_type desc::value_size = genType::value_size(); - - union uif32 - { - GLM_FUNC_QUALIFIER uif32() : - i(0) - {} - - GLM_FUNC_QUALIFIER uif32(float f) : - f(f) - {} - - GLM_FUNC_QUALIFIER uif32(unsigned int i) : - i(i) - {} - - float f; - unsigned int i; - }; - - union uif64 - { - GLM_FUNC_QUALIFIER uif64() : - i(0) - {} - - GLM_FUNC_QUALIFIER uif64(double f) : - f(f) - {} - - GLM_FUNC_QUALIFIER uif64(uint64 i) : - i(i) - {} - - double f; - uint64 i; - }; - - typedef uif32 uif; - - ////////////////// - // int - - template - struct is_int - { - enum is_int_enum - { - _YES = 0, - _NO = 1 - }; - }; - -#define GLM_DETAIL_IS_INT(T) \ - template <> \ - struct is_int \ - { \ - enum is_int_enum \ - { \ - _YES = 1, \ - _NO = 0 \ - }; \ - } - - ////////////////// - // uint - - template - struct is_uint - { - enum is_uint_enum - { - _YES = 0, - _NO = 1 - }; - }; - -#define GLM_DETAIL_IS_UINT(T) \ - template <> \ - struct is_uint \ - { \ - enum is_uint_enum \ - { \ - _YES = 1, \ - _NO = 0 \ - }; \ - } - - //GLM_DETAIL_IS_UINT(unsigned long long) - - ////////////////// - // float - - template - struct is_float - { - enum is_float_enum - { - _YES = 0, - _NO = 1 - }; - }; - -#define GLM_DETAIL_IS_FLOAT(T) \ - template <> \ - struct is_float \ - { \ - enum is_float_enum \ - { \ - _YES = 1, \ - _NO = 0 \ - }; \ - } - - GLM_DETAIL_IS_FLOAT(detail::half); - GLM_DETAIL_IS_FLOAT(float); - GLM_DETAIL_IS_FLOAT(double); - GLM_DETAIL_IS_FLOAT(long double); - - ////////////////// - // bool - - template - struct is_bool - { - enum is_bool_enum - { - _YES = 0, - _NO = 1 - }; - }; - - template <> - struct is_bool - { - enum is_bool_enum - { - _YES = 1, - _NO = 0 - }; - }; - - ////////////////// - // vector - - template - struct is_vector - { - enum is_vector_enum - { - _YES = 0, - _NO = 1 - }; - }; - -# define GLM_DETAIL_IS_VECTOR(TYPE) \ - template \ - struct is_vector > \ - { \ - enum is_vector_enum \ - { \ - _YES = 1, \ - _NO = 0 \ - }; \ - } - - ////////////////// - // matrix - - template - struct is_matrix - { - enum is_matrix_enum - { - _YES = 0, - _NO = 1 - }; - }; - -#define GLM_DETAIL_IS_MATRIX(T) \ - template <> \ - struct is_matrix \ - { \ - enum is_matrix_enum \ - { \ - _YES = 1, \ - _NO = 0 \ - }; \ - } - - ////////////////// - // type - - template - struct type - { - enum type_enum - { - is_float = is_float::_YES, - is_int = is_int::_YES, - is_uint = is_uint::_YES, - is_bool = is_bool::_YES - }; - }; - - ////////////////// - // type - - typedef signed char int8; - typedef signed short int16; - typedef signed int int32; - typedef detail::sint64 int64; - - typedef unsigned char uint8; - typedef unsigned short uint16; - typedef unsigned int uint32; - typedef detail::uint64 uint64; - - typedef detail::half float16; - typedef float float32; - typedef double float64; - - ////////////////// - // float_or_int_trait - - struct float_or_int_value - { - enum - { - GLM_ERROR, - GLM_FLOAT, - GLM_INT - }; - }; - - template - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_ERROR}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_FLOAT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_FLOAT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_FLOAT}; - }; - -}//namespace detail -}//namespace glm - -#if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005)) -# define GLM_DEPRECATED __declspec(deprecated) -# define GLM_ALIGN(x) __declspec(align(x)) -# define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct -# define GLM_RESTRICT __declspec(restrict) -# define GLM_RESTRICT_VAR __restrict -#elif((GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC)) && (GLM_COMPILER >= GLM_COMPILER_GCC31)) -# define GLM_DEPRECATED __attribute__((__deprecated__)) -# define GLM_ALIGN(x) __attribute__((aligned(x))) -# define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x))) -# if(GLM_COMPILER >= GLM_COMPILER_GCC33) -# define GLM_RESTRICT __restrict__ -# define GLM_RESTRICT_VAR __restrict__ -# else -# define GLM_RESTRICT -# define GLM_RESTRICT_VAR -# endif -# define GLM_RESTRICT __restrict__ -# define GLM_RESTRICT_VAR __restrict__ -#else -# define GLM_DEPRECATED -# define GLM_ALIGN -# define GLM_ALIGNED_STRUCT(x) -# define GLM_RESTRICT -# define GLM_RESTRICT_VAR -#endif//GLM_COMPILER - -#endif//glm_core_detail diff --git a/src/include/glm/core/_fixes.hpp b/src/include/glm/core/_fixes.hpp deleted file mode 100755 index 420a322..0000000 --- a/src/include/glm/core/_fixes.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/_fixes.hpp -/// @date 2011-02-21 / 2011-11-22 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#include - -//! Workaround for compatibility with other libraries -#ifdef max -#undef max -#endif - -//! Workaround for compatibility with other libraries -#ifdef min -#undef min -#endif - -//! Workaround for Android -#ifdef isnan -#undef isnan -#endif - -//! Workaround for Android -#ifdef isinf -#undef isinf -#endif - -//! Workaround for Chrone Native Client -#ifdef log2 -#undef log2 -#endif - diff --git a/src/include/glm/core/_swizzle.hpp b/src/include/glm/core/_swizzle.hpp deleted file mode 100755 index 1ef27c2..0000000 --- a/src/include/glm/core/_swizzle.hpp +++ /dev/null @@ -1,837 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/_swizzle.hpp -/// @date 2006-04-20 / 2011-02-16 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_swizzle -#define glm_core_swizzle - -#include "_swizzle_func.hpp" - -namespace glm -{ - enum comp - { - X = 0, - R = 0, - S = 0, - Y = 1, - G = 1, - T = 1, - Z = 2, - B = 2, - P = 2, - W = 3, - A = 3, - Q = 3 - }; -}//namespace glm - -namespace glm{ -namespace detail -{ - // Internal class for implementing swizzle operators - template - struct _swizzle_base0 - { - typedef T value_type; - - protected: - value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } - const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; } - - // Use an opaque buffer to *ensure* the compiler doesn't call a constructor. - // The size 1 buffer is assumed to aligned to the actual members so that the - // elem() - char _buffer[1]; - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - V operator ()() const { return V(this->elem(E0), this->elem(E1)); } - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } - }; - - // Internal class for implementing swizzle operators - /* - Template parameters: - - ValueType = type of scalar values (e.g. float, double) - VecType = class the swizzle is applies to (e.g. tvec3) - N = number of components in the vector (e.g. 3) - E0...3 = what index the n-th element of this swizzle refers to in the unswizzled vec - - DUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles - containing duplicate elements so that they cannot be used as r-values). - */ - template - struct _swizzle_base2 : public _swizzle_base1 - { - typedef VecType vec_type; - typedef ValueType value_type; - - _swizzle_base2& operator= (const ValueType& t) - { - for (int i = 0; i < N; ++i) - (*this)[i] = t; - return *this; - } - - _swizzle_base2& operator= (const VecType& that) - { - struct op { - void operator() (value_type& e, value_type& t) { e = t; } - }; - _apply_op(that, op()); - return *this; - } - - void operator -= (const VecType& that) - { - struct op { - void operator() (value_type& e, value_type& t) { e -= t; } - }; - _apply_op(that, op()); - } - - void operator += (const VecType& that) - { - struct op { - void operator() (value_type& e, value_type& t) { e += t; } - }; - _apply_op(that, op()); - } - - void operator *= (const VecType& that) - { - struct op { - void operator() (value_type& e, value_type& t) { e *= t; } - }; - _apply_op(that, op()); - } - - void operator /= (const VecType& that) - { - struct op { - void operator() (value_type& e, value_type& t) { e /= t; } - }; - _apply_op(that, op()); - } - - value_type& operator[] (size_t i) - { - static const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - value_type operator[] (size_t i) const - { - static const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - protected: - template - void _apply_op(const VecType& that, T op) - { - // Make a copy of the data in this == &that. - // The copier should optimize out the copy in cases where the function is - // properly inlined and the copy is not necessary. - ValueType t[N]; - for (int i = 0; i < N; ++i) - t[i] = that[i]; - for (int i = 0; i < N; ++i) - op( (*this)[i], t[i] ); - } - }; - - // Specialization for swizzles containing duplicate elements. These cannot be modified. - template - struct _swizzle_base2 : public _swizzle_base1 - { - typedef VecType vec_type; - typedef ValueType value_type; - - struct Stub {}; - _swizzle_base2& operator= (Stub const &) {} - - value_type operator[] (size_t i) const - { - static const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - }; - - template - struct swizzle : public _swizzle_base2 - { - typedef _swizzle_base2 base_type; - - using base_type::operator=; - - operator VecType () const { return (*this)(); } - }; - -// -// To prevent the C++ syntax from getting entirely overwhelming, define some alias macros -// -#define _GLM_SWIZZLE_TEMPLATE1 template -#define _GLM_SWIZZLE_TEMPLATE2 template -#define _GLM_SWIZZLE_TYPE1 glm::detail::swizzle -#define _GLM_SWIZZLE_TYPE2 glm::detail::swizzle - -// -// Wrapper for a binary operator (e.g. u.yy + v.zy) -// -#define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ - _GLM_SWIZZLE_TEMPLATE2 \ - V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ - { \ - return a() OPERAND b(); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ - { \ - return a() OPERAND b; \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return a OPERAND b(); \ - } - -// -// Wrapper for a operand between a swizzle and a binary (e.g. 1.0f - u.xyz) -// -#define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ - _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ - { \ - return a() OPERAND b; \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return a OPERAND b(); \ - } - -// -// Macro for wrapping a function taking one argument (e.g. abs()) -// -#define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \ - _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ - { \ - return FUNCTION(a()); \ - } - -// -// Macro for wrapping a function taking two vector arguments (e.g. dot()). -// -#define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \ - _GLM_SWIZZLE_TEMPLATE2 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ - { \ - return FUNCTION(a(), b()); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return FUNCTION(a(), b()); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ - { \ - return FUNCTION(a(), b); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return FUNCTION(a, b()); \ - } - -// -// Macro for wrapping a function take 2 vec arguments followed by a scalar (e.g. mix()). -// -#define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \ - _GLM_SWIZZLE_TEMPLATE2 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ - { \ - return FUNCTION(a(), b(), c); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ - { \ - return FUNCTION(a(), b(), c); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ - { \ - return FUNCTION(a(), b, c); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ - { \ - return FUNCTION(a, b(), c); \ - } - -}//namespace detail -}//namespace glm - -namespace glm -{ - namespace detail - { - _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(-) - _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(*) - - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(+) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(-) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(*) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(/) - } - - // - // Swizzles are distinct types from the unswizzled type. The below macros will - // provide template specializations for the swizzle types for the given functions - // so that the compiler does not have any ambiguity to choosing how to handle - // the function. - // - // The alternative is to use the operator()() when calling the function in order - // to explicitly convert the swizzled type to the unswizzled type. - // - - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any); - - //_GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot); - //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross); - //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step); - //_GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix); -} - -#define _GLM_SWIZZLE2_2_MEMBERS(T,P,E0,E1) \ - struct { glm::detail::swizzle<2,T,P,0,0,-1,-2> E0 ## E0; }; \ - struct { glm::detail::swizzle<2,T,P,0,1,-1,-2> E0 ## E1; }; \ - struct { glm::detail::swizzle<2,T,P,1,0,-1,-2> E1 ## E0; }; \ - struct { glm::detail::swizzle<2,T,P,1,1,-1,-2> E1 ## E1; }; - -#define _GLM_SWIZZLE2_3_MEMBERS(T,P2,E0,E1) \ - struct { glm::detail::swizzle<3,T,P2,0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P2,0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P2,0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P2,0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P2,1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P2,1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P2,1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P2,1,1,1,-1> E1 ## E1 ## E1; }; - -#define _GLM_SWIZZLE2_4_MEMBERS(T,P2,E0,E1) \ - struct { glm::detail::swizzle<4,T,P2,0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,1,1> E1 ## E1 ## E1 ## E1; }; - -#define _GLM_SWIZZLE3_2_MEMBERS(T,P2,E0,E1,E2) \ - struct { glm::detail::swizzle<2,T,P2,0,0,-1,-2> E0 ## E0; }; \ - struct { glm::detail::swizzle<2,T,P2,0,1,-1,-2> E0 ## E1; }; \ - struct { glm::detail::swizzle<2,T,P2,0,2,-1,-2> E0 ## E2; }; \ - struct { glm::detail::swizzle<2,T,P2,1,0,-1,-2> E1 ## E0; }; \ - struct { glm::detail::swizzle<2,T,P2,1,1,-1,-2> E1 ## E1; }; \ - struct { glm::detail::swizzle<2,T,P2,1,2,-1,-2> E1 ## E2; }; \ - struct { glm::detail::swizzle<2,T,P2,2,0,-1,-2> E2 ## E0; }; \ - struct { glm::detail::swizzle<2,T,P2,2,1,-1,-2> E2 ## E1; }; \ - struct { glm::detail::swizzle<2,T,P2,2,2,-1,-2> E2 ## E2; }; - -#define _GLM_SWIZZLE3_3_MEMBERS(T,P,E0,E1,E2) \ - struct { glm::detail::swizzle<3,T,P,0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,0,0,2,-1> E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,0,1,2,-1> E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,0,2,0,-1> E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,0,2,1,-1> E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,0,2,2,-1> E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,1,0,2,-1> E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,1,1,1,-1> E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,1,1,2,-1> E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,1,2,0,-1> E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,1,2,1,-1> E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,1,2,2,-1> E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,2,0,0,-1> E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,2,0,1,-1> E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,2,0,2,-1> E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,2,1,0,-1> E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,2,1,1,-1> E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,2,1,2,-1> E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,2,2,0,-1> E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,2,2,1,-1> E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,2,2,2,-1> E2 ## E2 ## E2; }; - -#define _GLM_SWIZZLE3_4_MEMBERS(T,P2,E0,E1,E2) \ - struct { glm::detail::swizzle<4,T,P2,0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P2,2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P2,2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P2,2,2,2,2> E2 ## E2 ## E2 ## E2; }; - -#define _GLM_SWIZZLE4_2_MEMBERS(T,P,E0,E1,E2,E3) \ - struct { glm::detail::swizzle<2,T,P,0,0,-1,-2> E0 ## E0; }; \ - struct { glm::detail::swizzle<2,T,P,0,1,-1,-2> E0 ## E1; }; \ - struct { glm::detail::swizzle<2,T,P,0,2,-1,-2> E0 ## E2; }; \ - struct { glm::detail::swizzle<2,T,P,0,3,-1,-2> E0 ## E3; }; \ - struct { glm::detail::swizzle<2,T,P,1,0,-1,-2> E1 ## E0; }; \ - struct { glm::detail::swizzle<2,T,P,1,1,-1,-2> E1 ## E1; }; \ - struct { glm::detail::swizzle<2,T,P,1,2,-1,-2> E1 ## E2; }; \ - struct { glm::detail::swizzle<2,T,P,1,3,-1,-2> E1 ## E3; }; \ - struct { glm::detail::swizzle<2,T,P,2,0,-1,-2> E2 ## E0; }; \ - struct { glm::detail::swizzle<2,T,P,2,1,-1,-2> E2 ## E1; }; \ - struct { glm::detail::swizzle<2,T,P,2,2,-1,-2> E2 ## E2; }; \ - struct { glm::detail::swizzle<2,T,P,2,3,-1,-2> E2 ## E3; }; \ - struct { glm::detail::swizzle<2,T,P,3,0,-1,-2> E3 ## E0; }; \ - struct { glm::detail::swizzle<2,T,P,3,1,-1,-2> E3 ## E1; }; \ - struct { glm::detail::swizzle<2,T,P,3,2,-1,-2> E3 ## E2; }; \ - struct { glm::detail::swizzle<2,T,P,3,3,-1,-2> E3 ## E3; }; - -#define _GLM_SWIZZLE4_3_MEMBERS(T,P,E0,E1,E2,E3) \ - struct { glm::detail::swizzle<3,T,P,0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,0,0,2,-1> E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,0,0,3,-1> E0 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,0,1,2,-1> E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,0,1,3,-1> E0 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,0,2,0,-1> E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,0,2,1,-1> E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,0,2,2,-1> E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,0,2,3,-1> E0 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,0,3,0,-1> E0 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,0,3,1,-1> E0 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,0,3,2,-1> E0 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,0,3,3,-1> E0 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,1,0,2,-1> E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,1,0,3,-1> E1 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,1,1,1,-1> E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,1,1,2,-1> E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,1,1,3,-1> E1 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,1,2,0,-1> E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,1,2,1,-1> E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,1,2,2,-1> E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,1,2,3,-1> E1 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,1,3,0,-1> E1 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,1,3,1,-1> E1 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,1,3,2,-1> E1 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,1,3,3,-1> E1 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,2,0,0,-1> E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,2,0,1,-1> E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,2,0,2,-1> E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,2,0,3,-1> E2 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,2,1,0,-1> E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,2,1,1,-1> E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,2,1,2,-1> E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,2,1,3,-1> E2 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,2,2,0,-1> E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,2,2,1,-1> E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,2,2,2,-1> E2 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,2,2,3,-1> E2 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,2,3,0,-1> E2 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,2,3,1,-1> E2 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,2,3,2,-1> E2 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,2,3,3,-1> E2 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,3,0,0,-1> E3 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,3,0,1,-1> E3 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,3,0,2,-1> E3 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,3,0,3,-1> E3 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,3,1,0,-1> E3 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,3,1,1,-1> E3 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,3,1,2,-1> E3 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,3,1,3,-1> E3 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,3,2,0,-1> E3 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,3,2,1,-1> E3 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,3,2,2,-1> E3 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,3,2,3,-1> E3 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<3,T,P,3,3,0,-1> E3 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<3,T,P,3,3,1,-1> E3 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<3,T,P,3,3,2,-1> E3 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<3,T,P,3,3,3,-1> E3 ## E3 ## E3; }; - -#define _GLM_SWIZZLE4_4_MEMBERS(T,P,E0,E1,E2,E3) \ - struct { glm::detail::swizzle<4,T,P,0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,0,3> E0 ## E0 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,1,3> E0 ## E0 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,2,3> E0 ## E0 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,3,0> E0 ## E0 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,3,1> E0 ## E0 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,3,2> E0 ## E0 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,0,3,3> E0 ## E0 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,0,3> E0 ## E1 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,1,3> E0 ## E1 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,2,3> E0 ## E1 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,3,0> E0 ## E1 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,3,1> E0 ## E1 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,3,2> E0 ## E1 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,1,3,3> E0 ## E1 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,0,3> E0 ## E2 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,1,3> E0 ## E2 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,2,3> E0 ## E2 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,3,0> E0 ## E2 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,3,1> E0 ## E2 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,3,2> E0 ## E2 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,0,2,3,3> E0 ## E2 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,0,3> E1 ## E0 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,1,3> E1 ## E0 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,2,3> E1 ## E0 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,3,0> E1 ## E0 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,3,1> E1 ## E0 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,3,2> E1 ## E0 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,0,3,3> E1 ## E0 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,0,3> E1 ## E1 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,1,3> E1 ## E1 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,2,3> E1 ## E1 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,3,0> E1 ## E1 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,3,1> E1 ## E1 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,3,2> E1 ## E1 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,1,3,3> E1 ## E1 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,0,3> E1 ## E2 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,1,3> E1 ## E2 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,2,3> E1 ## E2 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,3,0> E1 ## E2 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,3,1> E1 ## E2 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,3,2> E1 ## E2 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,2,3,3> E1 ## E2 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,0,0> E1 ## E3 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,0,1> E1 ## E3 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,0,2> E1 ## E3 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,0,3> E1 ## E3 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,1,0> E1 ## E3 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,1,1> E1 ## E3 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,1,2> E1 ## E3 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,1,3> E1 ## E3 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,2,0> E1 ## E3 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,2,1> E1 ## E3 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,2,2> E1 ## E3 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,2,3> E1 ## E3 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,3,0> E1 ## E3 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,3,1> E1 ## E3 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,3,2> E1 ## E3 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,1,3,3,3> E1 ## E3 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,0,3> E2 ## E0 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,1,3> E2 ## E0 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,2,3> E2 ## E0 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,3,0> E2 ## E0 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,3,1> E2 ## E0 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,3,2> E2 ## E0 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,0,3,3> E2 ## E0 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,0,3> E2 ## E1 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,1,3> E2 ## E1 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,2,3> E2 ## E1 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,3,0> E2 ## E1 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,3,1> E2 ## E1 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,3,2> E2 ## E1 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,1,3,3> E2 ## E1 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,0,3> E2 ## E2 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,1,3> E2 ## E2 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,2,2> E2 ## E2 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,2,3> E2 ## E2 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,3,0> E2 ## E2 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,3,1> E2 ## E2 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,3,2> E2 ## E2 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,2,3,3> E2 ## E2 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,0,0> E2 ## E3 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,0,1> E2 ## E3 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,0,2> E2 ## E3 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,0,3> E2 ## E3 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,1,0> E2 ## E3 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,1,1> E2 ## E3 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,1,2> E2 ## E3 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,1,3> E2 ## E3 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,2,0> E2 ## E3 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,2,1> E2 ## E3 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,2,2> E2 ## E3 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,2,3> E2 ## E3 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,3,0> E2 ## E3 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,3,1> E2 ## E3 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,3,2> E2 ## E3 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,2,3,3,3> E2 ## E3 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,0,0> E3 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,0,1> E3 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,0,2> E3 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,0,3> E3 ## E0 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,1,0> E3 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,1,1> E3 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,1,2> E3 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,1,3> E3 ## E0 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,2,0> E3 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,2,1> E3 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,2,2> E3 ## E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,2,3> E3 ## E0 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,3,0> E3 ## E0 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,3,1> E3 ## E0 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,3,2> E3 ## E0 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,0,3,3> E3 ## E0 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,0,0> E3 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,0,1> E3 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,0,2> E3 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,0,3> E3 ## E1 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,1,0> E3 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,1,1> E3 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,1,2> E3 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,1,3> E3 ## E1 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,2,0> E3 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,2,1> E3 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,2,2> E3 ## E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,2,3> E3 ## E1 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,3,0> E3 ## E1 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,3,1> E3 ## E1 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,3,2> E3 ## E1 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,1,3,3> E3 ## E1 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,0,0> E3 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,0,1> E3 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,0,2> E3 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,0,3> E3 ## E2 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,1,0> E3 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,1,1> E3 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,1,2> E3 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,1,3> E3 ## E2 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,2,0> E3 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,2,1> E3 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,2,2> E3 ## E2 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,2,3> E3 ## E2 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,3,0> E3 ## E2 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,3,1> E3 ## E2 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,3,2> E3 ## E2 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,2,3,3> E3 ## E2 ## E3 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,0,0> E3 ## E3 ## E0 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,0,1> E3 ## E3 ## E0 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,0,2> E3 ## E3 ## E0 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,0,3> E3 ## E3 ## E0 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,1,0> E3 ## E3 ## E1 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,1,1> E3 ## E3 ## E1 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,1,2> E3 ## E3 ## E1 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,1,3> E3 ## E3 ## E1 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,2,0> E3 ## E3 ## E2 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,2,1> E3 ## E3 ## E2 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,2,2> E3 ## E3 ## E2 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,2,3> E3 ## E3 ## E2 ## E3; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,3,0> E3 ## E3 ## E3 ## E0; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ - struct { glm::detail::swizzle<4,T,P,3,3,3,3> E3 ## E3 ## E3 ## E3; }; - -#endif//glm_core_swizzle diff --git a/src/include/glm/core/_swizzle_func.hpp b/src/include/glm/core/_swizzle_func.hpp deleted file mode 100755 index 90a895d..0000000 --- a/src/include/glm/core/_swizzle_func.hpp +++ /dev/null @@ -1,787 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/_swizzle_func.hpp -/// @date 2011-10-16 / 2011-10-16 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_swizzle_func -#define glm_core_swizzle_func - -#define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ - SWIZZLED_TYPE A ## B() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B); \ - } - -#define GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C) \ - SWIZZLED_TYPE A ## B ## C() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C); \ - } - -#define GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C, D) \ - SWIZZLED_TYPE A ## B ## C ## D() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C, this->D); \ - } - -#define GLM_SWIZZLE_GEN_VEC2_ENTRY_DEF(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ - template \ - SWIZZLED_TYPE CLASS_TYPE::A ## B() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B); \ - } - -#define GLM_SWIZZLE_GEN_VEC3_ENTRY_DEF(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C) \ - template \ - SWIZZLED_TYPE CLASS_TYPE::A ## B ## C() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C); \ - } - -#define GLM_SWIZZLE_GEN_VEC4_ENTRY_DEF(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C, D) \ - template \ - SWIZZLED_TYPE CLASS_TYPE::A ## B ## C ## D() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C, this->D); \ - } - -#define GLM_MUTABLE - -#define GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC2(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, x, y) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, r, g) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, s, t) - -//GLM_SWIZZLE_GEN_REF_FROM_VEC2(valType, detail::vec2, detail::ref2) - -#define GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B) - -#define GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B, A) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC3(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, x, y, z) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, r, g, b) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, s, t, q) - -//GLM_SWIZZLE_GEN_REF_FROM_VEC3(valType, detail::vec3, detail::ref2, detail::ref3) - -#define GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, C) - -#define GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, C, B) - -#define GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , B, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , C, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, , D, B, C, A) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC4(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, q, p) - -//GLM_SWIZZLE_GEN_REF_FROM_VEC4(valType, detail::vec4, detail::ref2, detail::ref3, detail::ref4) - -#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) - -#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) - -#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t) - -//GLM_SWIZZLE_GEN_VEC_FROM_VEC2(valType, detail::vec2, detail::vec2, detail::vec3, detail::vec4) - -#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C) - -#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C) - -#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, C) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, q) - -//GLM_SWIZZLE_GEN_VEC_FROM_VEC3(valType, detail::vec3, detail::vec2, detail::vec3, detail::vec4) - -#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D) - -#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D) - -#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, D) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, q, p) - -//GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4) - -#endif//glm_core_swizzle_func diff --git a/src/include/glm/core/_vectorize.hpp b/src/include/glm/core/_vectorize.hpp deleted file mode 100755 index 01b49a8..0000000 --- a/src/include/glm/core/_vectorize.hpp +++ /dev/null @@ -1,159 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/_vectorize.hpp -/// @date 2011-10-14 / 2011-10-14 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#define VECTORIZE2_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec2 func( \ - detail::tvec2 const & v) \ - { \ - return detail::tvec2( \ - func(v.x), \ - func(v.y)); \ - } - -#define VECTORIZE3_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec3 func( \ - detail::tvec3 const & v) \ - { \ - return detail::tvec3( \ - func(v.x), \ - func(v.y), \ - func(v.z)); \ - } - -#define VECTORIZE4_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec4 func( \ - detail::tvec4 const & v) \ - { \ - return detail::tvec4( \ - func(v.x), \ - func(v.y), \ - func(v.z), \ - func(v.w)); \ - } - -#define VECTORIZE_VEC(func) \ - VECTORIZE2_VEC(func) \ - VECTORIZE3_VEC(func) \ - VECTORIZE4_VEC(func) - -#define VECTORIZE2_VEC_SCA(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec2 func \ - ( \ - detail::tvec2 const & x, \ - typename detail::tvec2::value_type const & y \ - ) \ - { \ - return detail::tvec2( \ - func(x.x, y), \ - func(x.y, y)); \ - } - -#define VECTORIZE3_VEC_SCA(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec3 func \ - ( \ - detail::tvec3 const & x, \ - typename detail::tvec3::value_type const & y \ - ) \ - { \ - return detail::tvec3( \ - func(x.x, y), \ - func(x.y, y), \ - func(x.z, y)); \ - } - -#define VECTORIZE4_VEC_SCA(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec4 func \ - ( \ - detail::tvec4 const & x, \ - typename detail::tvec4::value_type const & y \ - ) \ - { \ - return detail::tvec4( \ - func(x.x, y), \ - func(x.y, y), \ - func(x.z, y), \ - func(x.w, y)); \ - } - -#define VECTORIZE_VEC_SCA(func) \ - VECTORIZE2_VEC_SCA(func) \ - VECTORIZE3_VEC_SCA(func) \ - VECTORIZE4_VEC_SCA(func) - -#define VECTORIZE2_VEC_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec2 func \ - ( \ - detail::tvec2 const & x, \ - detail::tvec2 const & y \ - ) \ - { \ - return detail::tvec2( \ - func(x.x, y.x), \ - func(x.y, y.y)); \ - } - -#define VECTORIZE3_VEC_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec3 func \ - ( \ - detail::tvec3 const & x, \ - detail::tvec3 const & y \ - ) \ - { \ - return detail::tvec3( \ - func(x.x, y.x), \ - func(x.y, y.y), \ - func(x.z, y.z)); \ - } - -#define VECTORIZE4_VEC_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec4 func \ - ( \ - detail::tvec4 const & x, \ - detail::tvec4 const & y \ - ) \ - { \ - return detail::tvec4( \ - func(x.x, y.x), \ - func(x.y, y.y), \ - func(x.z, y.z), \ - func(x.w, y.w)); \ - } - -#define VECTORIZE_VEC_VEC(func) \ - VECTORIZE2_VEC_VEC(func) \ - VECTORIZE3_VEC_VEC(func) \ - VECTORIZE4_VEC_VEC(func) diff --git a/src/include/glm/core/dummy.cpp b/src/include/glm/core/dummy.cpp deleted file mode 100755 index f4df718..0000000 --- a/src/include/glm/core/dummy.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/dummy.cpp -/// @date 2011-01-19 / 2011-06-15 -/// @author Christophe Riccio -/// -/// GLM is a header only library. There is nothing to compile. -/// dummy.cpp exist only a wordaround for CMake file. -/////////////////////////////////////////////////////////////////////////////////// - -#define GLM_MESSAGES -#include "../glm.hpp" -#include "../ext.hpp" - -//#error "GLM is a header only library" - -int main() -{ - -} diff --git a/src/include/glm/core/func_common.hpp b/src/include/glm/core/func_common.hpp deleted file mode 100755 index 4a696e3..0000000 --- a/src/include/glm/core/func_common.hpp +++ /dev/null @@ -1,428 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_common.hpp -/// @date 2008-03-08 / 2010-01-26 -/// @author Christophe Riccio -/// -/// @see GLSL 4.20.8 specification, section 8.3 Common Functions -/// -/// @defgroup core_func_common Common functions -/// @ingroup core -/// -/// These all operate component-wise. The description is per component. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef GLM_CORE_func_common -#define GLM_CORE_func_common GLM_VERSION - -#include "_fixes.hpp" - -namespace glm -{ - /// @addtogroup core_func_common - /// @{ - - /// Returns x if x >= 0; otherwise, it returns -x. - /// - /// @tparam genType floating-point or signed integer; scalar or vector types. - /// - /// @see GLSL abs man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType abs(genType const & x); - - /// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. - /// - /// @tparam genType Floating-point or signed integer; scalar or vector types. - /// - /// @see GLSL sign man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType sign(genType const & x); - - /// Returns a value equal to the nearest integer that is less then or equal to x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL floor man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType floor(genType const & x); - - /// Returns a value equal to the nearest integer to x - /// whose absolute value is not larger than the absolute value of x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL trunc man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType trunc(genType const & x); - - /// Returns a value equal to the nearest integer to x. - /// The fraction 0.5 will round in a direction chosen by the - /// implementation, presumably the direction that is fastest. - /// This includes the possibility that round(x) returns the - /// same value as roundEven(x) for all values of x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL round man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType round(genType const & x); - - /// Returns a value equal to the nearest integer to x. - /// A fractional part of 0.5 will round toward the nearest even - /// integer. (Both 3.5 and 4.5 for x will return 4.0.) - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL roundEven man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - /// @see New round to even technique - template - genType roundEven(genType const & x); - - /// Returns a value equal to the nearest integer - /// that is greater than or equal to x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL ceil man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType ceil(genType const & x); - - /// Return x - floor(x). - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL fract man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType fract(genType const & x); - - /// Modulus. Returns x - y * floor(x / y) - /// for each component in x using the floating point value y. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL mod man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType mod( - genType const & x, - genType const & y); - - /// Modulus. Returns x - y * floor(x / y) - /// for each component in x using the floating point value y. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL mod man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType mod( - genType const & x, - typename genType::value_type const & y); - - /// Returns the fractional part of x and sets i to the integer - /// part (as a whole number floating point value). Both the - /// return value and the output parameter will have the same - /// sign as x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL modf man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType modf( - genType const & x, - genType & i); - - /// Returns y if y < x; otherwise, it returns x. - /// - /// @tparam genType Floating-point or integer; scalar or vector types. - /// - /// @see GLSL min man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType min( - genType const & x, - genType const & y); - - template - genType min( - genType const & x, - typename genType::value_type const & y); - - /// Returns y if x < y; otherwise, it returns x. - /// - /// @tparam genType Floating-point or integer; scalar or vector types. - /// - /// @see GLSL max man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType max( - genType const & x, - genType const & y); - - template - genType max( - genType const & x, - typename genType::value_type const & y); - - /// Returns min(max(x, minVal), maxVal) for each component in x - /// using the floating-point values minVal and maxVal. - /// - /// @tparam genType Floating-point or integer; scalar or vector types. - /// - /// @see GLSL clamp man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType clamp( - genType const & x, - genType const & minVal, - genType const & maxVal); - - template - genType clamp( - genType const & x, - typename genType::value_type const & minVal, - typename genType::value_type const & maxVal); - - //! @return If genTypeU is a floating scalar or vector: - //! Returns x * (1.0 - a) + y * a, i.e., the linear blend of - //! x and y using the floating-point value a. - //! The value for a is not restricted to the range [0, 1]. - //! - //! @return If genTypeU is a boolean scalar or vector: - //! Selects which vector each returned component comes - //! from. For a component of a that is false, the - //! corresponding component of x is returned. For a - //! component of a that is true, the corresponding - //! component of y is returned. Components of x and y that - //! are not selected are allowed to be invalid floating point - //! values and will have no effect on the results. Thus, this - //! provides different functionality than - //! genType mix(genType x, genType y, genType(a)) - //! where a is a Boolean vector. - /// - /// @see GLSL mix man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - /// - /// @param[in] x Value to interpolate. - /// @param[in] y Value to interpolate. - /// @param[in] a Interpolant. - /// - /// @tparam genTypeT Floating point scalar or vector. - /// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT. - /// - /// @code - /// #include - /// ... - /// float a; - /// bool b; - /// glm::dvec3 e; - /// glm::dvec3 f; - /// glm::vec4 g; - /// glm::vec4 h; - /// ... - /// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors. - /// glm::vec4 s = glm::mix(g, h, b); // Teturns g or h; - /// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second. - /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter. - /// @endcode - template - genTypeT mix(genTypeT const & x, genTypeT const & y, genTypeU const & a); - - //! Returns 0.0 if x < edge, otherwise it returns 1.0. - //! - /// @see GLSL step man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType step( - genType const & edge, - genType const & x); - - template - genType step( - typename genType::value_type const & edge, - genType const & x); - - /// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and - /// performs smooth Hermite interpolation between 0 and 1 - /// when edge0 < x < edge1. This is useful in cases where - /// you would want a threshold function with a smooth - /// transition. This is equivalent to: - /// genType t; - /// t = clamp ((x – edge0) / (edge1 – edge0), 0, 1); - /// return t * t * (3 – 2 * t); - /// Results are undefined if edge0 >= edge1. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL smoothstep man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType smoothstep( - genType const & edge0, - genType const & edge1, - genType const & x); - - template - genType smoothstep( - typename genType::value_type const & edge0, - typename genType::value_type const & edge1, - genType const & x); - - /// Returns true if x holds a NaN (not a number) - /// representation in the underlying implementation's set of - /// floating point representations. Returns false otherwise, - /// including for implementations with no NaN - /// representations. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL isnan man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - typename genType::bool_type isnan(genType const & x); - - /// Returns true if x holds a positive infinity or negative - /// infinity representation in the underlying implementation's - /// set of floating point representations. Returns false - /// otherwise, including for implementations with no infinity - /// representations. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL isinf man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - typename genType::bool_type isinf(genType const & x); - - /// Returns a signed integer value representing - /// the encoding of a floating-point value. The floatingpoint - /// value's bit-level representation is preserved. - /// - /// @tparam genType Single-precision floating-point scalar or vector types. - /// @tparam genIType Signed integer scalar or vector types. - /// - /// @see GLSL floatBitsToInt man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genIType floatBitsToInt(genType const & value); - - /// Returns a unsigned integer value representing - /// the encoding of a floating-point value. The floatingpoint - /// value's bit-level representation is preserved. - /// - /// @tparam genType Single-precision floating-point scalar or vector types. - /// @tparam genUType Unsigned integer scalar or vector types. - /// - /// @see GLSL floatBitsToUint man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genUType floatBitsToUint(genType const & value); - - /// Returns a floating-point value corresponding to a signed - /// integer encoding of a floating-point value. - /// If an inf or NaN is passed in, it will not signal, and the - /// resulting floating point value is unspecified. Otherwise, - /// the bit-level representation is preserved. - /// - /// @tparam genType Single-precision floating-point scalar or vector types. - /// @tparam genIType Signed integer scalar or vector types. - /// - /// @see GLSL intBitsToFloat man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - /// - /// @todo Clarify this declaration, we don't need to actually specify the return type - template - genType intBitsToFloat(genIType const & value); - - /// Returns a floating-point value corresponding to a - /// unsigned integer encoding of a floating-point value. - /// If an inf or NaN is passed in, it will not signal, and the - /// resulting floating point value is unspecified. Otherwise, - /// the bit-level representation is preserved. - /// - /// @tparam genType Single-precision floating-point scalar or vector types. - /// @tparam genUType Unsigned integer scalar or vector types. - /// - /// @see GLSL uintBitsToFloat man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - /// - /// @todo Clarify this declaration, we don't need to actually specify the return type - template - genType uintBitsToFloat(genUType const & value); - - /// Computes and returns a * b + c. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL fma man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType fma(genType const & a, genType const & b, genType const & c); - - /// Splits x into a floating-point significand in the range - /// [0.5, 1.0) and an integral exponent of two, such that: - /// x = significand * exp(2, exponent) - /// - /// The significand is returned by the function and the - /// exponent is returned in the parameter exp. For a - /// floating-point value of zero, the significant and exponent - /// are both zero. For a floating-point value that is an - /// infinity or is not a number, the results are undefined. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL frexp man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType frexp(genType const & x, genIType & exp); - - /// Builds a floating-point number from x and the - /// corresponding integral exponent of two in exp, returning: - /// significand * exp(2, exponent) - /// - /// If this product is too large to be represented in the - /// floating-point type, the result is undefined. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL ldexp man page; - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - genType ldexp(genType const & x, genIType const & exp); - - /// @} -}//namespace glm - -#include "func_common.inl" - -#endif//GLM_CORE_func_common diff --git a/src/include/glm/core/func_common.inl b/src/include/glm/core/func_common.inl deleted file mode 100755 index 5599cb4..0000000 --- a/src/include/glm/core/func_common.inl +++ /dev/null @@ -1,1187 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_common.inl -/// @date 2008-08-03 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#include "_vectorize.hpp" - -namespace glm{ -namespace detail -{ - template - struct Abs_ - {}; - - template - struct Abs_ - { - static genFIType get(genFIType const & x) - { - GLM_STATIC_ASSERT( - detail::type::is_float || - detail::type::is_int, "'abs' only accept floating-point and integer inputs"); - return x >= genFIType(0) ? x : -x; - // TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff; - } - }; - - template - struct Abs_ - { - static genFIType get(genFIType const & x) - { - GLM_STATIC_ASSERT( - detail::type::is_uint, "'abs' only accept floating-point and integer inputs"); - return x; - } - }; -}//namespace detail - - // abs - template - GLM_FUNC_QUALIFIER genFIType abs - ( - genFIType const & x - ) - { - return detail::Abs_::is_signed>::get(x); - } - - VECTORIZE_VEC(abs) - - // sign - //Try something like based on x >> 31 to get the sign bit - template - GLM_FUNC_QUALIFIER genFIType sign - ( - genFIType const & x - ) - { - GLM_STATIC_ASSERT( - detail::type::is_float || - detail::type::is_int, "'sign' only accept signed inputs"); - - genFIType result; - if(x > genFIType(0)) - result = genFIType(1); - else if(x < genFIType(0)) - result = genFIType(-1); - else - result = genFIType(0); - return result; - } - - VECTORIZE_VEC(sign) - - // floor - template <> - GLM_FUNC_QUALIFIER detail::half floor(detail::half const & x) - { - return detail::half(::std::floor(float(x))); - } - - template - GLM_FUNC_QUALIFIER genType floor(genType const & x) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'floor' only accept floating-point inputs"); - - return ::std::floor(x); - } - - VECTORIZE_VEC(floor) - - // trunc - template - GLM_FUNC_QUALIFIER genType trunc(genType const & x) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'trunc' only accept floating-point inputs"); - return x < 0 ? -floor(-x) : floor(x); - } - - VECTORIZE_VEC(trunc) - - // round - template - GLM_FUNC_QUALIFIER genType round(genType const& x) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'round' only accept floating-point inputs"); - - if(x < 0) - return genType(int(x - genType(0.5))); - return genType(int(x + genType(0.5))); - } - - VECTORIZE_VEC(round) - -/* - // roundEven - template - GLM_FUNC_QUALIFIER genType roundEven(genType const& x) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'roundEven' only accept floating-point inputs"); - - return genType(int(x + genType(int(x) % 2))); - } -*/ - - // roundEven - template - GLM_FUNC_QUALIFIER genType roundEven(genType const & x) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'roundEven' only accept floating-point inputs"); - - int Integer = int(x); - genType IntegerPart = genType(Integer); - genType FractionalPart = fract(x); - - if(FractionalPart > genType(0.5) || FractionalPart < genType(0.5)) - { - return round(x); - } - else if((Integer % 2) == 0) - { - return IntegerPart; - } - else if(x <= genType(0)) // Work around... - { - return IntegerPart - 1; - } - else - { - return IntegerPart + 1; - } - //else // Bug on MinGW 4.5.2 - //{ - // return mix(IntegerPart + genType(-1), IntegerPart + genType(1), x <= genType(0)); - //} - } - - VECTORIZE_VEC(roundEven) - - // ceil - template - GLM_FUNC_QUALIFIER genType ceil(genType const & x) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'ceil' only accept floating-point inputs"); - - return ::std::ceil(x); - } - - VECTORIZE_VEC(ceil) - - // fract - template - GLM_FUNC_QUALIFIER genType fract - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'fract' only accept floating-point inputs"); - - return x - ::std::floor(x); - } - - VECTORIZE_VEC(fract) - - // mod - template - GLM_FUNC_QUALIFIER genType mod - ( - genType const & x, - genType const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'mod' only accept floating-point inputs"); - - return x - y * floor(x / y); - } - - VECTORIZE_VEC_SCA(mod) - VECTORIZE_VEC_VEC(mod) - - // modf - template - GLM_FUNC_QUALIFIER genType modf - ( - genType const & x, - genType & i - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'modf' only accept floating-point inputs"); - - return std::modf(x, &i); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 modf - ( - detail::tvec2 const & x, - detail::tvec2 & i - ) - { - return detail::tvec2( - modf(x.x, i.x), - modf(x.y, i.y)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 modf - ( - detail::tvec3 const & x, - detail::tvec3 & i - ) - { - return detail::tvec3( - modf(x.x, i.x), - modf(x.y, i.y), - modf(x.z, i.z)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 modf - ( - detail::tvec4 const & x, - detail::tvec4 & i - ) - { - return detail::tvec4( - modf(x.x, i.x), - modf(x.y, i.y), - modf(x.z, i.z), - modf(x.w, i.w)); - } - - //// Only valid if (INT_MIN <= x-y <= INT_MAX) - //// min(x,y) - //r = y + ((x - y) & ((x - y) >> (sizeof(int) * - //CHAR_BIT – 1))); - //// max(x,y) - //r = x - ((x - y) & ((x - y) >> (sizeof(int) * - //CHAR_BIT - 1))); - - // min - template - GLM_FUNC_QUALIFIER genType min - ( - genType const & x, - genType const & y - ) - { - GLM_STATIC_ASSERT( - detail::type::is_float || - detail::type::is_int || - detail::type::is_uint, "'min' only accept numbers"); - - return x < y ? x : y; - } - - VECTORIZE_VEC_SCA(min) - VECTORIZE_VEC_VEC(min) - - // max - template - GLM_FUNC_QUALIFIER genType max - ( - genType const & x, - genType const & y - ) - { - GLM_STATIC_ASSERT( - detail::type::is_float || - detail::type::is_int || - detail::type::is_uint, "'max' only accept numbers"); - - return x > y ? x : y; - } - - VECTORIZE_VEC_SCA(max) - VECTORIZE_VEC_VEC(max) - - // clamp - template - GLM_FUNC_QUALIFIER valType clamp - ( - valType const & x, - valType const & minVal, - valType const & maxVal - ) - { - GLM_STATIC_ASSERT( - detail::type::is_float || - detail::type::is_int || - detail::type::is_uint, "'clamp' only accept numbers"); - - // Old implementation, less predictable branching - //if(x >= maxVal) return maxVal; - //if(x <= minVal) return minVal; - //return x; - return max(min(x, maxVal), minVal); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 clamp - ( - detail::tvec2 const & x, - typename detail::tvec2::value_type const & minVal, - typename detail::tvec2::value_type const & maxVal - ) - { - return detail::tvec2( - clamp(x.x, minVal, maxVal), - clamp(x.y, minVal, maxVal)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 clamp - ( - detail::tvec3 const & x, - typename detail::tvec3::value_type const & minVal, - typename detail::tvec3::value_type const & maxVal - ) - { - return detail::tvec3( - clamp(x.x, minVal, maxVal), - clamp(x.y, minVal, maxVal), - clamp(x.z, minVal, maxVal)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 clamp - ( - detail::tvec4 const & x, - typename detail::tvec4::value_type const & minVal, - typename detail::tvec4::value_type const & maxVal - ) - { - return detail::tvec4( - clamp(x.x, minVal, maxVal), - clamp(x.y, minVal, maxVal), - clamp(x.z, minVal, maxVal), - clamp(x.w, minVal, maxVal)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 clamp - ( - detail::tvec2 const & x, - detail::tvec2 const & minVal, - detail::tvec2 const & maxVal - ) - { - return detail::tvec2( - clamp(x.x, minVal.x, maxVal.x), - clamp(x.y, minVal.y, maxVal.y)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 clamp - ( - detail::tvec3 const & x, - detail::tvec3 const & minVal, - detail::tvec3 const & maxVal - ) - { - return detail::tvec3( - clamp(x.x, minVal.x, maxVal.x), - clamp(x.y, minVal.y, maxVal.y), - clamp(x.z, minVal.z, maxVal.z)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 clamp - ( - detail::tvec4 const & x, - detail::tvec4 const & minVal, - detail::tvec4 const & maxVal - ) - { - return detail::tvec4( - clamp(x.x, minVal.x, maxVal.x), - clamp(x.y, minVal.y, maxVal.y), - clamp(x.z, minVal.z, maxVal.z), - clamp(x.w, minVal.w, maxVal.w)); - } - - // mix - template - GLM_FUNC_QUALIFIER genTypeT mix - ( - genTypeT const & x, - genTypeT const & y, - genTypeU const & a - ) - { - // It could be a vector too - //GLM_STATIC_ASSERT( - // detail::type::is_float && - // detail::type::is_float); - - //return x + a * (y - x); - return genTypeT(genTypeU(x) + a * genTypeU(y - x)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 mix - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - valTypeB const & a - ) - { - return detail::tvec2( - detail::tvec2(x) + a * detail::tvec2(y - x)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 mix - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - valTypeB const & a - ) - { - return detail::tvec3( - detail::tvec3(x) + a * detail::tvec3(y - x)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 mix - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - valTypeB const & a - ) - { - return detail::tvec4( - detail::tvec4(x) + a * detail::tvec4(y - x)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 mix - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 const & a - ) - { - return detail::tvec2( - detail::tvec2(x) + a * detail::tvec2(y - x)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 mix - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 const & a - ) - { - return detail::tvec3( - detail::tvec3(x) + a * detail::tvec3(y - x)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 mix - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 const & a - ) - { - return detail::tvec4( - detail::tvec4(x) + a * detail::tvec4(y - x)); - } - - //template - //GLM_FUNC_QUALIFIER genTypeT mix - //( - // genTypeT const & x, - // genTypeT const & y, - // float const & a - //) - //{ - // // It could be a vector too - // //GLM_STATIC_ASSERT( - // // detail::type::is_float && - // // detail::type::is_float); - - // return x + a * (y - x); - //} - - template - GLM_FUNC_QUALIFIER genType mix - ( - genType const & x, - genType const & y, - bool const & a - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); - - return a ? y : x; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 mix - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - typename detail::tvec2::bool_type a - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); - - detail::tvec2 result; - for - ( - typename detail::tvec2::size_type i = 0; - i < detail::tvec2::value_size(); - ++i - ) - { - result[i] = a[i] ? y[i] : x[i]; - } - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 mix - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - typename detail::tvec3::bool_type a - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); - - detail::tvec3 result; - for - ( - typename detail::tvec3::size_type i = 0; - i < detail::tvec3::value_size(); - ++i - ) - { - result[i] = a[i] ? y[i] : x[i]; - } - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 mix - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - typename detail::tvec4::bool_type a - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); - - detail::tvec4 result; - for - ( - typename detail::tvec4::size_type i = 0; - i < detail::tvec4::value_size(); - ++i - ) - { - result[i] = a[i] ? y[i] : x[i]; - } - return result; - } - - // step - template - GLM_FUNC_QUALIFIER genType step - ( - genType const & edge, - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); - - return x < edge ? genType(0) : genType(1); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 step - ( - typename detail::tvec2::value_type const & edge, - detail::tvec2 const & x - ) - { - return detail::tvec2( - x.x < edge ? T(0) : T(1), - x.y < edge ? T(0) : T(1)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 step - ( - typename detail::tvec3::value_type const & edge, - detail::tvec3 const & x - ) - { - return detail::tvec3( - x.x < edge ? T(0) : T(1), - x.y < edge ? T(0) : T(1), - x.z < edge ? T(0) : T(1)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 step - ( - typename detail::tvec4::value_type const & edge, - detail::tvec4 const & x - ) - { - return detail::tvec4( - x.x < edge ? T(0) : T(1), - x.y < edge ? T(0) : T(1), - x.z < edge ? T(0) : T(1), - x.w < edge ? T(0) : T(1)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 step - ( - detail::tvec2 const & edge, - detail::tvec2 const & x - ) - { - return detail::tvec2( - x.x < edge.x ? T(0) : T(1), - x.y < edge.y ? T(0) : T(1)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 step - ( - detail::tvec3 const & edge, - detail::tvec3 const & x - ) - { - return detail::tvec3( - x.x < edge.x ? T(0) : T(1), - x.y < edge.y ? T(0) : T(1), - x.z < edge.z ? T(0) : T(1)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 step - ( - detail::tvec4 const & edge, - detail::tvec4 const & x - ) - { - return detail::tvec4( - x.x < edge.x ? T(0) : T(1), - x.y < edge.y ? T(0) : T(1), - x.z < edge.z ? T(0) : T(1), - x.w < edge.w ? T(0) : T(1)); - } - - // smoothstep - template - GLM_FUNC_QUALIFIER genType smoothstep - ( - genType const & edge0, - genType const & edge1, - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); - - genType tmp = clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1)); - return tmp * tmp * (genType(3) - genType(2) * tmp); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 smoothstep - ( - typename detail::tvec2::value_type const & edge0, - typename detail::tvec2::value_type const & edge1, - detail::tvec2 const & x - ) - { - return detail::tvec2( - smoothstep(edge0, edge1, x.x), - smoothstep(edge0, edge1, x.y)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 smoothstep - ( - typename detail::tvec3::value_type const & edge0, - typename detail::tvec3::value_type const & edge1, - detail::tvec3 const & x - ) - { - return detail::tvec3( - smoothstep(edge0, edge1, x.x), - smoothstep(edge0, edge1, x.y), - smoothstep(edge0, edge1, x.z)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 smoothstep - ( - typename detail::tvec4::value_type const & edge0, - typename detail::tvec4::value_type const & edge1, - detail::tvec4 const & x - ) - { - return detail::tvec4( - smoothstep(edge0, edge1, x.x), - smoothstep(edge0, edge1, x.y), - smoothstep(edge0, edge1, x.z), - smoothstep(edge0, edge1, x.w)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 smoothstep - ( - detail::tvec2 const & edge0, - detail::tvec2 const & edge1, - detail::tvec2 const & x - ) - { - return detail::tvec2( - smoothstep(edge0.x, edge1.x, x.x), - smoothstep(edge0.y, edge1.y, x.y)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 smoothstep - ( - detail::tvec3 const & edge0, - detail::tvec3 const & edge1, - detail::tvec3 const & x - ) - { - return detail::tvec3( - smoothstep(edge0.x, edge1.x, x.x), - smoothstep(edge0.y, edge1.y, x.y), - smoothstep(edge0.z, edge1.z, x.z)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 smoothstep - ( - detail::tvec4 const & edge0, - detail::tvec4 const & edge1, - detail::tvec4 const & x - ) - { - return detail::tvec4( - smoothstep(edge0.x, edge1.x, x.x), - smoothstep(edge0.y, edge1.y, x.y), - smoothstep(edge0.z, edge1.z, x.z), - smoothstep(edge0.w, edge1.w, x.w)); - } - - template - GLM_FUNC_QUALIFIER bool isnan(genType const & x) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'isnan' only accept floating-point inputs"); - -# if(GLM_COMPILER & GLM_COMPILER_VC) - return _isnan(x) != 0; -# elif(GLM_COMPILER & GLM_COMPILER_GCC) -# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) - return _isnan(x) != 0; -# else - return std::isnan(x) != 0; -# endif -# else - return std::isnan(x) != 0; -# endif - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec2::bool_type isnan - ( - detail::tvec2 const & x - ) - { - return typename detail::tvec2::bool_type( - isnan(x.x), - isnan(x.y)); - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec3::bool_type isnan - ( - detail::tvec3 const & x - ) - { - return typename detail::tvec3::bool_type( - isnan(x.x), - isnan(x.y), - isnan(x.z)); - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec4::bool_type isnan - ( - detail::tvec4 const & x - ) - { - return typename detail::tvec4::bool_type( - isnan(x.x), - isnan(x.y), - isnan(x.z), - isnan(x.w)); - } - - template - GLM_FUNC_QUALIFIER bool isinf( - genType const & x) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'isinf' only accept floating-point inputs"); - -# if(GLM_COMPILER & GLM_COMPILER_VC) - return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; -# elif(GLM_COMPILER & GLM_COMPILER_GCC) -# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) - return _isinf(x) != 0; -# else - return std::isinf(x) != 0; -# endif -# else - return std::isinf(x) != 0; -# endif - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec2::bool_type isinf - ( - detail::tvec2 const & x - ) - { - return typename detail::tvec2::bool_type( - isinf(x.x), - isinf(x.y)); - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec3::bool_type isinf - ( - detail::tvec3 const & x - ) - { - return typename detail::tvec3::bool_type( - isinf(x.x), - isinf(x.y), - isinf(x.z)); - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec4::bool_type isinf - ( - detail::tvec4 const & x - ) - { - return typename detail::tvec4::bool_type( - isinf(x.x), - isinf(x.y), - isinf(x.z), - isinf(x.w)); - } - - GLM_FUNC_QUALIFIER int floatBitsToInt(float const & value) - { - union - { - float f; - int i; - } fi; - - fi.f = value; - return fi.i; - } - - GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToInt - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - floatBitsToInt(value.x), - floatBitsToInt(value.y)); - } - - GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToInt - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - floatBitsToInt(value.x), - floatBitsToInt(value.y), - floatBitsToInt(value.z)); - } - - GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToInt - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - floatBitsToInt(value.x), - floatBitsToInt(value.y), - floatBitsToInt(value.z), - floatBitsToInt(value.w)); - } - - GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & value) - { - union - { - float f; - uint u; - } fu; - - fu.f = value; - return fu.u; - } - - GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToUint - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - floatBitsToUint(value.x), - floatBitsToUint(value.y)); - } - - GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToUint - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - floatBitsToUint(value.x), - floatBitsToUint(value.y), - floatBitsToUint(value.z)); - } - - GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToUint - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - floatBitsToUint(value.x), - floatBitsToUint(value.y), - floatBitsToUint(value.z), - floatBitsToUint(value.w)); - } - - GLM_FUNC_QUALIFIER float intBitsToFloat(int const & value) - { - union - { - float f; - int i; - } fi; - - fi.i = value; - return fi.f; - } - - GLM_FUNC_QUALIFIER detail::tvec2 intBitsToFloat - - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - intBitsToFloat(value.x), - intBitsToFloat(value.y)); - } - - GLM_FUNC_QUALIFIER detail::tvec3 intBitsToFloat - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - intBitsToFloat(value.x), - intBitsToFloat(value.y), - intBitsToFloat(value.z)); - } - - GLM_FUNC_QUALIFIER detail::tvec4 intBitsToFloat - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - intBitsToFloat(value.x), - intBitsToFloat(value.y), - intBitsToFloat(value.z), - intBitsToFloat(value.w)); - } - - GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & value) - { - union - { - float f; - uint u; - } fu; - - fu.u = value; - return fu.f; - } - - GLM_FUNC_QUALIFIER detail::tvec2 uintBitsToFloat - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - uintBitsToFloat(value.x), - uintBitsToFloat(value.y)); - } - - GLM_FUNC_QUALIFIER detail::tvec3 uintBitsToFloat - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - uintBitsToFloat(value.x), - uintBitsToFloat(value.y), - uintBitsToFloat(value.z)); - } - - GLM_FUNC_QUALIFIER detail::tvec4 uintBitsToFloat - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - uintBitsToFloat(value.x), - uintBitsToFloat(value.y), - uintBitsToFloat(value.z), - uintBitsToFloat(value.w)); - } - - template - GLM_FUNC_QUALIFIER genType fma - ( - genType const & a, - genType const & b, - genType const & c - ) - { - return a * b + c; - } - - template - GLM_FUNC_QUALIFIER genType frexp - ( - genType const & x, - int & exp - ) - { - return std::frexp(x, exp); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 frexp - ( - detail::tvec2 const & x, - detail::tvec2 & exp - ) - { - return std::frexp(x, exp); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 frexp - ( - detail::tvec3 const & x, - detail::tvec3 & exp - ) - { - return std::frexp(x, exp); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 frexp - ( - detail::tvec4 const & x, - detail::tvec4 & exp - ) - { - return std::frexp(x, exp); - } - - template - GLM_FUNC_QUALIFIER genType ldexp - ( - genType const & x, - int const & exp - ) - { - return std::frexp(x, exp); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 ldexp - ( - detail::tvec2 const & x, - detail::tvec2 const & exp - ) - { - return std::frexp(x, exp); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 ldexp - ( - detail::tvec3 const & x, - detail::tvec3 const & exp - ) - { - return std::frexp(x, exp); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 ldexp - ( - detail::tvec4 const & x, - detail::tvec4 const & exp - ) - { - return std::frexp(x, exp); - } - -}//namespace glm diff --git a/src/include/glm/core/func_exponential.hpp b/src/include/glm/core/func_exponential.hpp deleted file mode 100755 index b37c1f4..0000000 --- a/src/include/glm/core/func_exponential.hpp +++ /dev/null @@ -1,123 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_exponential.hpp -/// @date 2008-08-08 / 2011-06-14 -/// @author Christophe Riccio -/// -/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions -/// -/// @defgroup core_func_exponential Exponential functions -/// @ingroup core -/// -/// These all operate component-wise. The description is per component. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_func_exponential -#define glm_core_func_exponential GLM_VERSION - -namespace glm -{ - /// @addtogroup core_func_exponential - /// @{ - - /// Returns x raised to the y power. - /// - /// @param x pow function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision. - /// @param y - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL pow man page - /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions - template - genType pow(genType const & x, genType const & y); - - /// Returns the natural exponentiation of x, i.e., e^x. - /// - /// @param x exp function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision. - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL exp man page - /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions - template - genType exp(genType const & x); - - /// Returns the natural logarithm of x, i.e., - /// returns the value y which satisfies the equation x = e^y. - /// Results are undefined if x <= 0. - /// - /// @param x log function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision. - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL log man page - /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions - template - genType log(genType const & x); - - /// Returns 2 raised to the x power. - /// - /// @param x exp2 function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision. - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL exp2 man page - /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions - template - genType exp2(genType const & x); - - /// Returns the base 2 log of x, i.e., returns the value y, - /// which satisfies the equation x = 2 ^ y. - /// - /// @param x log2 function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision. - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL log2 man page - /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions - template - genType log2(genType const & x); - - /// Returns the positive square root of x. - /// - /// @param x sqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision. - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL sqrt man page - /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions - template - genType sqrt(genType const & x); - - /// Returns the reciprocal of the positive square root of x. - /// - /// @param x inversesqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision. - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL inversesqrt man page - /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions - template - genType inversesqrt(genType const & x); - - /// @} -}//namespace glm - -#include "func_exponential.inl" - -#endif//glm_core_func_exponential diff --git a/src/include/glm/core/func_exponential.inl b/src/include/glm/core/func_exponential.inl deleted file mode 100755 index f609214..0000000 --- a/src/include/glm/core/func_exponential.inl +++ /dev/null @@ -1,157 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_exponential.inl -/// @date 2008-08-03 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#include "_vectorize.hpp" - -namespace glm -{ - // pow - template - GLM_FUNC_QUALIFIER genType pow - ( - genType const & x, - genType const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'pow' only accept floating-point input"); - - return ::std::pow(x, y); - } - - VECTORIZE_VEC_VEC(pow) - - // exp - template - GLM_FUNC_QUALIFIER genType exp - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'exp' only accept floating-point input"); - - return ::std::exp(x); - } - - VECTORIZE_VEC(exp) - - // log - template - GLM_FUNC_QUALIFIER genType log - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'log' only accept floating-point input"); - - return ::std::log(x); - } - - VECTORIZE_VEC(log) - - //exp2, ln2 = 0.69314718055994530941723212145818f - template - GLM_FUNC_QUALIFIER genType exp2 - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'exp2' only accept floating-point input"); - - return ::std::exp(genType(0.69314718055994530941723212145818) * x); - } - - VECTORIZE_VEC(exp2) - -namespace _detail -{ - template - struct _compute_log2 - { - template - T operator() (T const & Value) const; -/* - { - GLM_STATIC_ASSERT(0, "'log2' parameter has an invalid template parameter type. GLM core features only supports floating-point types, include for integer types support. Others types are not supported."); - return Value; - } -*/ - }; - - template <> - struct _compute_log2 - { - template - T operator() (T const & Value) const - { - return T(::std::log(Value)) / T(0.69314718055994530941723212145818); - } - }; - -}//namespace _detail - - // log2, ln2 = 0.69314718055994530941723212145818f - template - GLM_FUNC_QUALIFIER genType log2 - ( - genType const & x - ) - { - assert(x > genType(0)); // log2 is only defined on the range (0, inf] - return _detail::_compute_log2::ID>()(x); - } - - VECTORIZE_VEC(log2) - - // sqrt - template - GLM_FUNC_QUALIFIER genType sqrt - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'sqrt' only accept floating-point input"); - - return genType(::std::sqrt(x)); - } - - VECTORIZE_VEC(sqrt) - - template - GLM_FUNC_QUALIFIER genType inversesqrt - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'inversesqrt' only accept floating-point input"); - - return genType(1) / ::std::sqrt(x); - } - - VECTORIZE_VEC(inversesqrt) - -}//namespace glm diff --git a/src/include/glm/core/func_geometric.hpp b/src/include/glm/core/func_geometric.hpp deleted file mode 100755 index c8b5295..0000000 --- a/src/include/glm/core/func_geometric.hpp +++ /dev/null @@ -1,138 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_geometric.hpp -/// @date 2008-08-03 / 2011-06-14 -/// @author Christophe Riccio -/// -/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions -/// -/// @defgroup core_func_geometric Geometric functions -/// @ingroup core -/// -/// These operate on vectors as vectors, not component-wise. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_func_geometric -#define glm_core_func_geometric GLM_VERSION - -namespace glm -{ - /// @addtogroup core_func_geometric - /// @{ - - /// Returns the length of x, i.e., sqrt(x * x). - /// - /// @tparam genType Floating-point vector types. - /// - /// @see GLSL length man page - /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions - template - typename genType::value_type length( - genType const & x); - - /// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1). - /// - /// @tparam genType Floating-point vector types. - /// - /// @see GLSL distance man page - /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions - template - typename genType::value_type distance( - genType const & p0, - genType const & p1); - - /// Returns the dot product of x and y, i.e., result = x * y. - /// - /// @tparam genType Floating-point vector types. - /// - /// @see GLSL dot man page - /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions - template - typename genType::value_type dot( - genType const & x, - genType const & y); - - /// Returns the cross product of x and y. - /// - /// @tparam valType Floating-point scalar types. - /// - /// @see GLSL cross man page - /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions - template - detail::tvec3 cross( - detail::tvec3 const & x, - detail::tvec3 const & y); - - /// Returns a vector in the same direction as x but with length of 1. - /// - /// @see GLSL normalize man page - /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions - template - genType normalize( - genType const & x); - - /// If dot(Nref, I) < 0.0, return N, otherwise, return -N. - /// - /// @tparam genType Floating-point vector types. - /// - /// @see GLSL faceforward man page - /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions - template - genType faceforward( - genType const & N, - genType const & I, - genType const & Nref); - - /// For the incident vector I and surface orientation N, - /// returns the reflection direction : result = I - 2.0 * dot(N, I) * N. - /// - /// @tparam genType Floating-point vector types. - /// - /// @see GLSL reflect man page - /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions - template - genType reflect( - genType const & I, - genType const & N); - - /// For the incident vector I and surface normal N, - /// and the ratio of indices of refraction eta, - /// return the refraction vector. - /// - /// @tparam genType Floating-point vector types. - /// - /// @see GLSL refract man page - /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions - template - genType refract( - genType const & I, - genType const & N, - typename genType::value_type const & eta); - - /// @} -}//namespace glm - -#include "func_geometric.inl" - -#endif//glm_core_func_geometric diff --git a/src/include/glm/core/func_geometric.inl b/src/include/glm/core/func_geometric.inl deleted file mode 100755 index caa4f29..0000000 --- a/src/include/glm/core/func_geometric.inl +++ /dev/null @@ -1,324 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_geometric.inl -/// @date 2008-08-03 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#include "_vectorize.hpp" - -namespace glm -{ - // length - template - GLM_FUNC_QUALIFIER genType length - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - - genType sqr = x * x; - return sqrt(sqr); - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec2::value_type length - ( - detail::tvec2 const & v - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - - typename detail::tvec2::value_type sqr = v.x * v.x + v.y * v.y; - return sqrt(sqr); - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec3::value_type length - ( - detail::tvec3 const & v - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - - typename detail::tvec3::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z; - return sqrt(sqr); - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec4::value_type length - ( - detail::tvec4 const & v - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - - typename detail::tvec4::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w; - return sqrt(sqr); - } - - // distance - template - GLM_FUNC_QUALIFIER genType distance - ( - genType const & p0, - genType const & p1 - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); - - return length(p1 - p0); - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec2::value_type distance - ( - detail::tvec2 const & p0, - detail::tvec2 const & p1 - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); - - return length(p1 - p0); - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec3::value_type distance - ( - detail::tvec3 const & p0, - detail::tvec3 const & p1 - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); - - return length(p1 - p0); - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec4::value_type distance - ( - detail::tvec4 const & p0, - detail::tvec4 const & p1 - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); - - return length(p1 - p0); - } - - // dot - template - GLM_FUNC_QUALIFIER genType dot - ( - genType const & x, - genType const & y - - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); - - return x * y; - } - - template - GLM_FUNC_QUALIFIER typename detail::tvec2::value_type dot - ( - detail::tvec2 const & x, - detail::tvec2 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); - - return x.x * y.x + x.y * y.y; - } - - template - GLM_FUNC_QUALIFIER T dot - ( - detail::tvec3 const & x, - detail::tvec3 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); - - return x.x * y.x + x.y * y.y + x.z * y.z; - } -/* // SSE3 - GLM_FUNC_QUALIFIER float dot(const tvec4& x, const tvec4& y) - { - float Result; - __asm - { - mov esi, x - mov edi, y - movaps xmm0, [esi] - mulps xmm0, [edi] - haddps( _xmm0, _xmm0 ) - haddps( _xmm0, _xmm0 ) - movss Result, xmm0 - } - return Result; - } -*/ - template - GLM_FUNC_QUALIFIER T dot - ( - detail::tvec4 const & x, - detail::tvec4 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); - - return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; - } - - // cross - template - GLM_FUNC_QUALIFIER detail::tvec3 cross - ( - detail::tvec3 const & x, - detail::tvec3 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'cross' only accept floating-point inputs"); - - return detail::tvec3( - x.y * y.z - y.y * x.z, - x.z * y.x - y.z * x.x, - x.x * y.y - y.x * x.y); - } - - // normalize - template - GLM_FUNC_QUALIFIER genType normalize - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); - - return x < genType(0) ? genType(-1) : genType(1); - } - - // According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefine and generate an error - template - GLM_FUNC_QUALIFIER detail::tvec2 normalize - ( - detail::tvec2 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); - - typename detail::tvec2::value_type sqr = x.x * x.x + x.y * x.y; - return x * inversesqrt(sqr); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 normalize - ( - detail::tvec3 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); - - typename detail::tvec3::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z; - return x * inversesqrt(sqr); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 normalize - ( - detail::tvec4 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); - - typename detail::tvec4::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; - return x * inversesqrt(sqr); - } - - // faceforward - template - GLM_FUNC_QUALIFIER genType faceforward - ( - genType const & N, - genType const & I, - genType const & Nref - ) - { - return dot(Nref, I) < 0 ? N : -N; - } - - // reflect - template - genType reflect - ( - genType const & I, - genType const & N - ) - { - return I - N * dot(N, I) * genType(2); - } - - // refract - template - GLM_FUNC_QUALIFIER genType refract - ( - genType const & I, - genType const & N, - genType const & eta - ) - { - //It could be a vector - //GLM_STATIC_ASSERT(detail::type::is_float); - - genType dotValue = dot(N, I); - genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue); - if(k < genType(0)) - return genType(0); - else - return eta * I - (eta * dotValue + sqrt(k)) * N; - } - - template - GLM_FUNC_QUALIFIER genType refract - ( - genType const & I, - genType const & N, - typename genType::value_type const & eta - ) - { - //It could be a vector - //GLM_STATIC_ASSERT(detail::type::is_float); - - typename genType::value_type dotValue = dot(N, I); - typename genType::value_type k = typename genType::value_type(1) - eta * eta * (typename genType::value_type(1) - dotValue * dotValue); - if(k < typename genType::value_type(0)) - return genType(0); - else - return eta * I - (eta * dotValue + sqrt(k)) * N; - } - -}//namespace glm diff --git a/src/include/glm/core/func_integer.hpp b/src/include/glm/core/func_integer.hpp deleted file mode 100755 index e97a8f9..0000000 --- a/src/include/glm/core/func_integer.hpp +++ /dev/null @@ -1,201 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_integer.hpp -/// @date 2010-03-17 / 2011-06-18 -/// @author Christophe Riccio -/// -/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions -/// -/// @defgroup core_func_integer Integer functions -/// @ingroup core -/// -/// These all operate component-wise. The description is per component. -/// The notation [a, b] means the set of bits from bit-number a through bit-number -/// b, inclusive. The lowest-order bit is bit 0. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_func_integer -#define glm_core_func_integer GLM_VERSION - -namespace glm -{ - /// @addtogroup core_func_integer - /// @{ - - /// Adds 32-bit unsigned integer x and y, returning the sum - /// modulo pow(2, 32). The value carry is set to 0 if the sum was - /// less than pow(2, 32), or to 1 otherwise. - /// - /// @tparam genUType Unsigned integer scalar or vector types. - /// - /// @see GLSL uaddCarry man page - /// @see GLSL 4.20.8 specification, section 8.8 Integer Functions - template - genUType uaddCarry( - genUType const & x, - genUType const & y, - genUType & carry); - - /// Subtracts the 32-bit unsigned integer y from x, returning - /// the difference if non-negative, or pow(2, 32) plus the difference - /// otherwise. The value borrow is set to 0 if x >= y, or to 1 otherwise. - /// - /// @tparam genUType Unsigned integer scalar or vector types. - /// - /// @see GLSL usubBorrow man page - /// @see GLSL 4.20.8 specification, section 8.8 Integer Functions - template - genUType usubBorrow( - genUType const & x, - genUType const & y, - genUType & borrow); - - /// Multiplies 32-bit integers x and y, producing a 64-bit - /// result. The 32 least-significant bits are returned in lsb. - /// The 32 most-significant bits are returned in msb. - /// - /// @tparam genUType Unsigned integer scalar or vector types. - /// - /// @see GLSL umulExtended man page - /// @see GLSL 4.20.8 specification, section 8.8 Integer Functions - template - void umulExtended( - genUType const & x, - genUType const & y, - genUType & msb, - genUType & lsb); - - /// Multiplies 32-bit integers x and y, producing a 64-bit - /// result. The 32 least-significant bits are returned in lsb. - /// The 32 most-significant bits are returned in msb. - /// - /// @tparam genIType Signed integer scalar or vector types. - /// - /// @see GLSL imulExtended man page - /// @see GLSL 4.20.8 specification, section 8.8 Integer Functions - template - void imulExtended( - genIType const & x, - genIType const & y, - genIType & msb, - genIType & lsb); - - /// Extracts bits [offset, offset + bits - 1] from value, - /// returning them in the least significant bits of the result. - /// For unsigned data types, the most significant bits of the - /// result will be set to zero. For signed data types, the - /// most significant bits will be set to the value of bit offset + base – 1. - /// - /// If bits is zero, the result will be zero. The result will be - /// undefined if offset or bits is negative, or if the sum of - /// offset and bits is greater than the number of bits used - /// to store the operand. - /// - /// @tparam genIUType Signed or unsigned integer scalar or vector types. - /// - /// @see GLSL bitfieldExtract man page - /// @see GLSL 4.20.8 specification, section 8.8 Integer Functions - template - genIUType bitfieldExtract( - genIUType const & Value, - int const & Offset, - int const & Bits); - - /// Returns the insertion the bits least-significant bits of insert into base. - /// - /// The result will have bits [offset, offset + bits - 1] taken - /// from bits [0, bits – 1] of insert, and all other bits taken - /// directly from the corresponding bits of base. If bits is - /// zero, the result will simply be base. The result will be - /// undefined if offset or bits is negative, or if the sum of - /// offset and bits is greater than the number of bits used to - /// store the operand. - /// - /// @tparam genIUType Signed or unsigned integer scalar or vector types. - /// - /// @see GLSL bitfieldInsert man page - /// @see GLSL 4.20.8 specification, section 8.8 Integer Functions - template - genIUType bitfieldInsert( - genIUType const & Base, - genIUType const & Insert, - int const & Offset, - int const & Bits); - - /// Returns the reversal of the bits of value. - /// The bit numbered n of the result will be taken from bit (bits - 1) - n of value, - /// where bits is the total number of bits used to represent value. - /// - /// @tparam genIUType Signed or unsigned integer scalar or vector types. - /// - /// @see GLSL bitfieldReverse man page - /// @see GLSL 4.20.8 specification, section 8.8 Integer Functions - template - genIUType bitfieldReverse(genIUType const & value); - - /// Returns the number of bits set to 1 in the binary representation of value. - /// - /// @tparam genIUType Signed or unsigned integer scalar or vector types. - /// - /// @see GLSL bitCount man page - /// @see GLSL 4.20.8 specification, section 8.8 Integer Functions - /// - /// @todo Clarify the declaration to specify that scalars are suported. - template class genIUType> - typename genIUType::signed_type bitCount(genIUType const & Value); - - /// Returns the bit number of the least significant bit set to - /// 1 in the binary representation of value. - /// If value is zero, -1 will be returned. - /// - /// @tparam genIUType Signed or unsigned integer scalar or vector types. - /// - /// @see GLSL findLSB man page - /// @see GLSL 4.20.8 specification, section 8.8 Integer Functions - /// - /// @todo Clarify the declaration to specify that scalars are suported. - template class genIUType> - typename genIUType::signed_type findLSB(genIUType const & Value); - - /// Returns the bit number of the most significant bit in the binary representation of value. - /// For positive integers, the result will be the bit number of the most significant bit set to 1. - /// For negative integers, the result will be the bit number of the most significant - /// bit set to 0. For a value of zero or negative one, -1 will be returned. - /// - /// @tparam genIUType Signed or unsigned integer scalar or vector types. - /// - /// @see GLSL findMSB man page - /// @see GLSL 4.20.8 specification, section 8.8 Integer Functions - /// - /// @todo Clarify the declaration to specify that scalars are suported. - template class genIUType> - typename genIUType::signed_type findMSB(genIUType const & Value); - - /// @} -}//namespace glm - -#include "func_integer.inl" - -#endif//glm_core_func_integer - diff --git a/src/include/glm/core/func_integer.inl b/src/include/glm/core/func_integer.inl deleted file mode 100755 index 934f5ec..0000000 --- a/src/include/glm/core/func_integer.inl +++ /dev/null @@ -1,602 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_integer.inl -/// @date 2010-03-17 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#include "_vectorize.hpp" -#if(GLM_COMPILER & GLM_COMPILER_VC) -#include -#pragma intrinsic(_BitScanReverse) -#endif - -namespace glm -{ - // uaddCarry - template - GLM_FUNC_QUALIFIER genUType uaddCarry - ( - genUType const & x, - genUType const & y, - genUType & Carry - ) - { - detail::highp_uint_t Value64 = detail::highp_uint_t(x) + detail::highp_uint_t(y); - genUType Result = genUType(Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32))); - Carry = (Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32))) > 1 ? 1 : 0; - return Result; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 uaddCarry - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 & Carry - ) - { - return detail::tvec2( - uaddCarry(x[0], y[0], Carry[0]), - uaddCarry(x[1], y[1], Carry[1])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 uaddCarry - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 & Carry - ) - { - return detail::tvec3( - uaddCarry(x[0], y[0], Carry[0]), - uaddCarry(x[1], y[1], Carry[1]), - uaddCarry(x[2], y[2], Carry[2])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 uaddCarry - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 & Carry - ) - { - return detail::tvec4( - uaddCarry(x[0], y[0], Carry[0]), - uaddCarry(x[1], y[1], Carry[1]), - uaddCarry(x[2], y[2], Carry[2]), - uaddCarry(x[3], y[3], Carry[3])); - } - - // usubBorrow - template - GLM_FUNC_QUALIFIER genUType usubBorrow - ( - genUType const & x, - genUType const & y, - genUType & Borrow - ) - { - Borrow = x >= y ? 0 : 1; - if(x > y) - return genUType(detail::highp_int_t(x) - detail::highp_int_t(y)); - else - return genUType(detail::highp_int_t(1) << detail::highp_int_t(32) + detail::highp_int_t(x) - detail::highp_int_t(y)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 usubBorrow - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 & Borrow - ) - { - return detail::tvec2( - usubBorrow(x[0], y[0], Borrow[0]), - usubBorrow(x[1], y[1], Borrow[1])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 usubBorrow - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 & Borrow - ) - { - return detail::tvec3( - usubBorrow(x[0], y[0], Borrow[0]), - usubBorrow(x[1], y[1], Borrow[1]), - usubBorrow(x[2], y[2], Borrow[2])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 usubBorrow - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 & Borrow - ) - { - return detail::tvec4( - usubBorrow(x[0], y[0], Borrow[0]), - usubBorrow(x[1], y[1], Borrow[1]), - usubBorrow(x[2], y[2], Borrow[2]), - usubBorrow(x[3], y[3], Borrow[3])); - } - - // umulExtended - template - GLM_FUNC_QUALIFIER void umulExtended - ( - genUType const & x, - genUType const & y, - genUType & msb, - genUType & lsb - ) - { - detail::highp_uint_t ValueX64 = x; - detail::highp_uint_t ValueY64 = y; - detail::highp_uint_t Value64 = ValueX64 * ValueY64; - msb = *(genUType*)&genUType(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1))); - lsb = *(genUType*)&genUType(Value64 >> detail::highp_uint_t(32)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 umulExtended - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 & msb, - detail::tvec2 & lsb - ) - { - return detail::tvec2( - umulExtended(x[0], y[0], msb, lsb), - umulExtended(x[1], y[1], msb, lsb)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 umulExtended - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 & msb, - detail::tvec3 & lsb - ) - { - return detail::tvec3( - umulExtended(x[0], y[0], msb, lsb), - umulExtended(x[1], y[1], msb, lsb), - umulExtended(x[2], y[2], msb, lsb)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 umulExtended - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 & msb, - detail::tvec4 & lsb - ) - { - return detail::tvec4( - umulExtended(x[0], y[0], msb, lsb), - umulExtended(x[1], y[1], msb, lsb), - umulExtended(x[2], y[2], msb, lsb), - umulExtended(x[3], y[3], msb, lsb)); - } - - // imulExtended - template - GLM_FUNC_QUALIFIER void imulExtended - ( - genIType const & x, - genIType const & y, - genIType & msb, - genIType & lsb - ) - { - detail::highp_int_t ValueX64 = x; - detail::highp_int_t ValueY64 = y; - detail::highp_int_t Value64 = ValueX64 * ValueY64; - msb = *(genIType*)&genIType(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1))); - lsb = *(genIType*)&genIType(Value64 >> detail::highp_uint_t(32)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 imulExtended - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 & msb, - detail::tvec2 & lsb - ) - { - return detail::tvec2( - imulExtended(x[0], y[0], msb, lsb), - imulExtended(x[1], y[1], msb, lsb)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 imulExtended - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 & msb, - detail::tvec3 & lsb - ) - { - return detail::tvec3( - imulExtended(x[0], y[0], msb, lsb), - imulExtended(x[1], y[1], msb, lsb), - imulExtended(x[2], y[2], msb, lsb)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 imulExtended - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 & msb, - detail::tvec4 & lsb - ) - { - return detail::tvec4( - imulExtended(x[0], y[0], msb, lsb), - imulExtended(x[1], y[1], msb, lsb), - imulExtended(x[2], y[2], msb, lsb), - imulExtended(x[3], y[3], msb, lsb)); - } - - // bitfieldExtract - template - GLM_FUNC_QUALIFIER genIUType bitfieldExtract - ( - genIUType const & Value, - int const & Offset, - int const & Bits - ) - { - int GenSize = int(sizeof(genIUType)) << int(3); - - assert(Offset + Bits <= GenSize); - - genIUType ShiftLeft = Bits ? Value << (GenSize - (Bits + Offset)) : genIUType(0); - genIUType ShiftBack = ShiftLeft >> genIUType(GenSize - Bits); - - return ShiftBack; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 bitfieldExtract - ( - detail::tvec2 const & Value, - int const & Offset, - int const & Bits - ) - { - return detail::tvec2( - bitfieldExtract(Value[0], Offset, Bits), - bitfieldExtract(Value[1], Offset, Bits)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 bitfieldExtract - ( - detail::tvec3 const & Value, - int const & Offset, - int const & Bits - ) - { - return detail::tvec3( - bitfieldExtract(Value[0], Offset, Bits), - bitfieldExtract(Value[1], Offset, Bits), - bitfieldExtract(Value[2], Offset, Bits)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 bitfieldExtract - ( - detail::tvec4 const & Value, - int const & Offset, - int const & Bits - ) - { - return detail::tvec4( - bitfieldExtract(Value[0], Offset, Bits), - bitfieldExtract(Value[1], Offset, Bits), - bitfieldExtract(Value[2], Offset, Bits), - bitfieldExtract(Value[3], Offset, Bits)); - } - - // bitfieldInsert - template - GLM_FUNC_QUALIFIER genIUType bitfieldInsert - ( - genIUType const & Base, - genIUType const & Insert, - int const & Offset, - int const & Bits - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldInsert' only accept integer values"); - assert(Offset + Bits <= sizeof(genIUType)); - - if(Bits == 0) - return Base; - - genIUType Mask = 0; - for(int Bit = Offset; Bit < Offset + Bits; ++Bit) - Mask |= (1 << Bit); - - return (Base & ~Mask) | (Insert & Mask); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 bitfieldInsert - ( - detail::tvec2 const & Base, - detail::tvec2 const & Insert, - int const & Offset, - int const & Bits - ) - { - return detail::tvec2( - bitfieldInsert(Base[0], Insert[0], Offset, Bits), - bitfieldInsert(Base[1], Insert[1], Offset, Bits)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 bitfieldInsert - ( - detail::tvec3 const & Base, - detail::tvec3 const & Insert, - int const & Offset, - int const & Bits - ) - { - return detail::tvec3( - bitfieldInsert(Base[0], Insert[0], Offset, Bits), - bitfieldInsert(Base[1], Insert[1], Offset, Bits), - bitfieldInsert(Base[2], Insert[2], Offset, Bits)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 bitfieldInsert - ( - detail::tvec4 const & Base, - detail::tvec4 const & Insert, - int const & Offset, - int const & Bits - ) - { - return detail::tvec4( - bitfieldInsert(Base[0], Insert[0], Offset, Bits), - bitfieldInsert(Base[1], Insert[1], Offset, Bits), - bitfieldInsert(Base[2], Insert[2], Offset, Bits), - bitfieldInsert(Base[3], Insert[3], Offset, Bits)); - } - - // bitfieldReverse - template - GLM_FUNC_QUALIFIER genIUType bitfieldReverse(genIUType const & Value) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldReverse' only accept integer values"); - - genIUType Out = 0; - std::size_t BitSize = sizeof(genIUType) * 8; - for(std::size_t i = 0; i < BitSize; ++i) - if(Value & (genIUType(1) << i)) - Out |= genIUType(1) << (BitSize - 1 - i); - return Out; - } - - VECTORIZE_VEC(bitfieldReverse) - - // bitCount - template - GLM_FUNC_QUALIFIER int bitCount(genIUType const & Value) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitCount' only accept integer values"); - - int Count = 0; - for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i) - { - if(Value & (1 << i)) - ++Count; - } - return Count; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 bitCount - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - bitCount(value[0]), - bitCount(value[1])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 bitCount - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - bitCount(value[0]), - bitCount(value[1]), - bitCount(value[2])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 bitCount - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - bitCount(value[0]), - bitCount(value[1]), - bitCount(value[2]), - bitCount(value[3])); - } - - // findLSB - template - GLM_FUNC_QUALIFIER int findLSB - ( - genIUType const & Value - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findLSB' only accept integer values"); - if(Value == 0) - return -1; - - genIUType Bit; - for(Bit = genIUType(0); !(Value & (1 << Bit)); ++Bit){} - return Bit; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 findLSB - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - findLSB(value[0]), - findLSB(value[1])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 findLSB - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - findLSB(value[0]), - findLSB(value[1]), - findLSB(value[2])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 findLSB - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - findLSB(value[0]), - findLSB(value[1]), - findLSB(value[2]), - findLSB(value[3])); - } - - // findMSB -#if((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_VC)) - - template - GLM_FUNC_QUALIFIER int findMSB - ( - genIUType const & Value - ) - { - unsigned long Result(0); - _BitScanReverse(&Result, Value); - return int(Result); - } - -#elif((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC40)) - - template - GLM_FUNC_QUALIFIER int findMSB - ( - genIUType const & Value - ) - { - return __builtin_clz(Value); - } - -#else - - template - GLM_FUNC_QUALIFIER int findMSB - ( - genIUType const & Value - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findMSB' only accept integer values"); - if(Value == 0) - return -1; - - genIUType bit = genIUType(-1); - for(genIUType tmp = Value; tmp; tmp >>= 1, ++bit){} - return bit; - } -#endif//(GLM_COMPILER) - - template - GLM_FUNC_QUALIFIER detail::tvec2 findMSB - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - findMSB(value[0]), - findMSB(value[1])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 findMSB - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - findMSB(value[0]), - findMSB(value[1]), - findMSB(value[2])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 findMSB - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - findMSB(value[0]), - findMSB(value[1]), - findMSB(value[2]), - findMSB(value[3])); - } -}//namespace glm diff --git a/src/include/glm/core/func_matrix.hpp b/src/include/glm/core/func_matrix.hpp deleted file mode 100755 index 4eb348c..0000000 --- a/src/include/glm/core/func_matrix.hpp +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_matrix.hpp -/// @date 2008-08-03 / 2011-06-15 -/// @author Christophe Riccio -/// -/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions -/// -/// @defgroup core_func_matrix Matrix functions -/// @ingroup core -/// -/// For each of the following built-in matrix functions, there is both a -/// single-precision floating point version, where all arguments and return values -/// are single precision, and a double-precision floating version, where all -/// arguments and return values are double precision. Only the single-precision -/// floating point version is shown. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef GLM_CORE_func_matrix -#define GLM_CORE_func_matrix GLM_VERSION - -namespace glm -{ - /// @addtogroup core_func_matrix - /// @{ - - /// Multiply matrix x by matrix y component-wise, i.e., - /// result[i][j] is the scalar product of x[i][j] and y[i][j]. - /// - /// @tparam matType Floating-point matrix types. - /// - /// @see GLSL matrixCompMult man page - /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - template - matType matrixCompMult( - matType const & x, - matType const & y); - - /// Treats the first parameter c as a column vector - /// and the second parameter r as a row vector - /// and does a linear algebraic matrix multiply c * r. - /// - /// @tparam matType Floating-point matrix types. - /// - /// @see GLSL outerProduct man page - /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - /// - /// @todo Clarify the declaration to specify that matType doesn't have to be provided when used. - template - matType outerProduct( - vecType const & c, - vecType const & r); - - /// Returns the transposed matrix of x - /// - /// @tparam matType Floating-point matrix types. - /// - /// @see GLSL transpose man page - /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - template - typename matType::transpose_type transpose( - matType const & x); - - /// Return the determinant of a mat2 matrix. - /// - /// @tparam valType Floating-point scalar types. - /// - /// @see GLSL determinant man page - /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - template - typename detail::tmat2x2::value_type determinant( - detail::tmat2x2 const & m); - - /// Return the determinant of a mat3 matrix. - /// - /// @tparam valType Floating-point scalar types. - /// - /// @see GLSL determinant man page - /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - template - typename detail::tmat3x3::value_type determinant( - detail::tmat3x3 const & m); - - /// Return the determinant of a mat4 matrix. - /// - /// @tparam valType Floating-point scalar types. - /// - /// @see GLSL determinant man page - /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - template - typename detail::tmat4x4::value_type determinant( - detail::tmat4x4 const & m); - - /// Return the inverse of a mat2 matrix. - /// - /// @tparam valType Floating-point scalar types. - /// - /// @see GLSL inverse man page - /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - template - detail::tmat2x2 inverse( - detail::tmat2x2 const & m); - - /// Return the inverse of a mat3 matrix. - /// - /// @tparam valType Floating-point scalar types. - /// - /// @see GLSL inverse man page - /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - template - detail::tmat3x3 inverse( - detail::tmat3x3 const & m); - - /// Return the inverse of a mat4 matrix. - /// - /// @tparam valType Floating-point scalar types. - /// - /// @see GLSL inverse man page - /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - template - detail::tmat4x4 inverse( - detail::tmat4x4 const & m); - - /// @} -}//namespace glm - -#include "func_matrix.inl" - -#endif//GLM_CORE_func_matrix diff --git a/src/include/glm/core/func_matrix.inl b/src/include/glm/core/func_matrix.inl deleted file mode 100755 index e3ed4bb..0000000 --- a/src/include/glm/core/func_matrix.inl +++ /dev/null @@ -1,584 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_matrix.inl -/// @date 2008-03-08 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#include "_vectorize.hpp" - -namespace glm -{ - // matrixCompMult - template - GLM_FUNC_QUALIFIER matType matrixCompMult - ( - matType const & x, - matType const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'matrixCompMult' only accept floating-point inputs"); - - matType result(matType::null); - for(typename matType::size_type i = 0; i < matType::row_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } - - // outerProduct - template - GLM_FUNC_QUALIFIER detail::tmat2x2 outerProduct - ( - detail::tvec2 const & c, - detail::tvec2 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat2x2 m(detail::tmat2x2::null); - m[0][0] = c[0] * r[0]; - m[0][1] = c[1] * r[0]; - m[1][0] = c[0] * r[1]; - m[1][1] = c[1] * r[1]; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x3 outerProduct - ( - detail::tvec3 const & c, - detail::tvec3 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat3x3 m(detail::tmat3x3::null); - for(typename detail::tmat3x3::size_type i(0); i < m.length(); ++i) - m[i] = c * r[i]; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x4 outerProduct - ( - detail::tvec4 const & c, - detail::tvec4 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat4x4 m(detail::tmat4x4::null); - for(typename detail::tmat4x4::size_type i(0); i < m.length(); ++i) - m[i] = c * r[i]; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x3 outerProduct - ( - detail::tvec3 const & c, - detail::tvec2 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat2x3 m(detail::tmat2x3::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x2 outerProduct - ( - detail::tvec2 const & c, - detail::tvec3 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat3x2 m(detail::tmat3x2::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x4 outerProduct - ( - detail::tvec4 const & c, - detail::tvec2 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat2x4 m(detail::tmat2x4::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[0][3] = c.w * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - m[1][3] = c.w * r.y; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x2 outerProduct - ( - detail::tvec2 const & c, - detail::tvec4 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat4x2 m(detail::tmat4x2::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - m[3][0] = c.x * r.w; - m[3][1] = c.y * r.w; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x4 outerProduct - ( - detail::tvec4 const & c, - detail::tvec3 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat3x4 m(detail::tmat3x4::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[0][3] = c.w * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - m[1][3] = c.w * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - m[2][2] = c.z * r.z; - m[2][3] = c.w * r.z; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x3 outerProduct - ( - detail::tvec3 const & c, - detail::tvec4 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat4x3 m(detail::tmat4x3::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - m[2][2] = c.z * r.z; - m[3][0] = c.x * r.w; - m[3][1] = c.y * r.w; - m[3][2] = c.z * r.w; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x2 transpose - ( - detail::tmat2x2 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat2x2 result(detail::tmat2x2::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x3 transpose - ( - detail::tmat3x3 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat3x3 result(detail::tmat3x3::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[2][2] = m[2][2]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x4 transpose - ( - detail::tmat4x4 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat4x4 result(detail::tmat4x4::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[0][3] = m[3][0]; - - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - result[1][3] = m[3][1]; - - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[2][2] = m[2][2]; - result[2][3] = m[3][2]; - - result[3][0] = m[0][3]; - result[3][1] = m[1][3]; - result[3][2] = m[2][3]; - result[3][3] = m[3][3]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x3 transpose - ( - detail::tmat3x2 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat2x3 result(detail::tmat2x3::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x2 transpose - ( - detail::tmat2x3 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat3x2 result(detail::tmat3x2::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x4 transpose - ( - detail::tmat4x2 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat2x4 result(detail::tmat2x4::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[0][3] = m[3][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - result[1][3] = m[3][1]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x2 transpose - ( - detail::tmat2x4 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat4x2 result(detail::tmat4x2::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[3][0] = m[0][3]; - result[3][1] = m[1][3]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x4 transpose - ( - detail::tmat4x3 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat3x4 result(detail::tmat3x4::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[0][3] = m[3][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - result[1][3] = m[3][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[2][2] = m[2][2]; - result[2][3] = m[3][2]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x3 transpose - ( - detail::tmat3x4 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat4x3 result(detail::tmat4x3::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[2][2] = m[2][2]; - result[3][0] = m[0][3]; - result[3][1] = m[1][3]; - result[3][2] = m[2][3]; - return result; - } - - template - GLM_FUNC_QUALIFIER typename detail::tmat2x2::value_type determinant - ( - detail::tmat2x2 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); - - return m[0][0] * m[1][1] - m[1][0] * m[0][1]; - } - - template - GLM_FUNC_QUALIFIER typename detail::tmat3x3::value_type determinant - ( - detail::tmat3x3 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); - - return - + m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2]) - - m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2]) - + m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]); - } - - template - GLM_FUNC_QUALIFIER typename detail::tmat4x4::value_type determinant - ( - detail::tmat4x4 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); - - T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; - T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; - T SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; - T SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; - T SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; - T SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; - - detail::tvec4 DetCof( - + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02), - - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04), - + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05), - - (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05)); - - return m[0][0] * DetCof[0] - + m[0][1] * DetCof[1] - + m[0][2] * DetCof[2] - + m[0][3] * DetCof[3]; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x2 inverse - ( - detail::tmat2x2 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); - - //valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1]; - T Determinant = determinant(m); - - detail::tmat2x2 Inverse( - + m[1][1] / Determinant, - - m[0][1] / Determinant, - - m[1][0] / Determinant, - + m[0][0] / Determinant); - - return Inverse; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x3 inverse - ( - detail::tmat3x3 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); - - //valType Determinant = m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2]) - // - m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2]) - // + m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]); - - T Determinant = determinant(m); - - detail::tmat3x3 Inverse(detail::tmat3x3::null); - Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]); - Inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]); - Inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]); - Inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]); - Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]); - Inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]); - Inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]); - Inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]); - Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]); - Inverse /= Determinant; - - return Inverse; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x4 inverse - ( - detail::tmat4x4 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); - - T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; - T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3]; - T Coef03 = m[1][2] * m[2][3] - m[2][2] * m[1][3]; - - T Coef04 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; - T Coef06 = m[1][1] * m[3][3] - m[3][1] * m[1][3]; - T Coef07 = m[1][1] * m[2][3] - m[2][1] * m[1][3]; - - T Coef08 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; - T Coef10 = m[1][1] * m[3][2] - m[3][1] * m[1][2]; - T Coef11 = m[1][1] * m[2][2] - m[2][1] * m[1][2]; - - T Coef12 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; - T Coef14 = m[1][0] * m[3][3] - m[3][0] * m[1][3]; - T Coef15 = m[1][0] * m[2][3] - m[2][0] * m[1][3]; - - T Coef16 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; - T Coef18 = m[1][0] * m[3][2] - m[3][0] * m[1][2]; - T Coef19 = m[1][0] * m[2][2] - m[2][0] * m[1][2]; - - T Coef20 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; - T Coef22 = m[1][0] * m[3][1] - m[3][0] * m[1][1]; - T Coef23 = m[1][0] * m[2][1] - m[2][0] * m[1][1]; - - detail::tvec4 const SignA(+1, -1, +1, -1); - detail::tvec4 const SignB(-1, +1, -1, +1); - - detail::tvec4 Fac0(Coef00, Coef00, Coef02, Coef03); - detail::tvec4 Fac1(Coef04, Coef04, Coef06, Coef07); - detail::tvec4 Fac2(Coef08, Coef08, Coef10, Coef11); - detail::tvec4 Fac3(Coef12, Coef12, Coef14, Coef15); - detail::tvec4 Fac4(Coef16, Coef16, Coef18, Coef19); - detail::tvec4 Fac5(Coef20, Coef20, Coef22, Coef23); - - detail::tvec4 Vec0(m[1][0], m[0][0], m[0][0], m[0][0]); - detail::tvec4 Vec1(m[1][1], m[0][1], m[0][1], m[0][1]); - detail::tvec4 Vec2(m[1][2], m[0][2], m[0][2], m[0][2]); - detail::tvec4 Vec3(m[1][3], m[0][3], m[0][3], m[0][3]); - - detail::tvec4 Inv0 = SignA * (Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2); - detail::tvec4 Inv1 = SignB * (Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4); - detail::tvec4 Inv2 = SignA * (Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5); - detail::tvec4 Inv3 = SignB * (Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5); - - detail::tmat4x4 Inverse(Inv0, Inv1, Inv2, Inv3); - - detail::tvec4 Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]); - - T Determinant = glm::dot(m[0], Row0); - - Inverse /= Determinant; - - return Inverse; - } -}//namespace glm diff --git a/src/include/glm/core/func_noise.hpp b/src/include/glm/core/func_noise.hpp deleted file mode 100755 index de1af94..0000000 --- a/src/include/glm/core/func_noise.hpp +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_noise.hpp -/// @date 2008-08-01 / 2011-06-18 -/// @author Christophe Riccio -/// -/// @see GLSL 4.20.8 specification, section 8.13 Noise Functions -/// -/// @defgroup core_func_noise Noise functions -/// @ingroup core -/// -/// Noise functions are stochastic functions that can be used to increase visual -/// complexity. Values returned by the following noise functions give the -/// appearance of randomness, but are not truly random. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_func_noise -#define glm_core_func_noise GLM_VERSION - -namespace glm -{ - /// @addtogroup core_func_noise - /// @{ - - /// Returns a 1D noise value based on the input value x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL noise1 man page - /// @see GLSL 4.20.8 specification, section 8.13 Noise Functions - template - typename genType::value_type noise1(genType const & x); - - /// Returns a 2D noise value based on the input value x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL noise2 man page - /// @see GLSL 4.20.8 specification, section 8.13 Noise Functions - template - detail::tvec2 noise2(genType const & x); - - /// Returns a 3D noise value based on the input value x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL noise3 man page - /// @see GLSL 4.20.8 specification, section 8.13 Noise Functions - template - detail::tvec3 noise3(genType const & x); - - /// Returns a 4D noise value based on the input value x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL noise4 man page - /// @see GLSL 4.20.8 specification, section 8.13 Noise Functions - template - detail::tvec4 noise4(genType const & x); - - /// @} -}//namespace glm - -#include "func_noise.inl" - -#endif//glm_core_func_noise diff --git a/src/include/glm/core/func_noise.inl b/src/include/glm/core/func_noise.inl deleted file mode 100755 index 113e2d3..0000000 --- a/src/include/glm/core/func_noise.inl +++ /dev/null @@ -1,364 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_noise.inl -/// @date 2008-08-01 / 2011-09-27 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -namespace glm -{ - template - GLM_FUNC_QUALIFIER T noise1(T const & x) - { - return noise1(glm::detail::tvec2(x, T(0))); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec2 noise2(T const & x) - { - return glm::detail::tvec2( - noise1(x + T(0.0)), - noise1(x + T(1.0))); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec3 noise3(T const & x) - { - return glm::detail::tvec3( - noise1(x - T(1.0)), - noise1(x + T(0.0)), - noise1(x + T(1.0))); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec4 noise4(T const & x) - { - return glm::detail::tvec4( - noise1(x - T(1.0)), - noise1(x + T(0.0)), - noise1(x + T(1.0)), - noise1(x + T(2.0))); - } - - template - GLM_FUNC_QUALIFIER T noise1(glm::detail::tvec2 const & v) - { - detail::tvec4 const C = detail::tvec4( - T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0 - T( 0.366025403784439), // 0.5 * (sqrt(3.0) - 1.0) - T(-0.577350269189626), // -1.0 + 2.0 * C.x - T( 0.024390243902439)); // 1.0 / 41.0 - - // First corner - detail::tvec2 i = floor(v + dot(v, detail::tvec2(C[1]))); - detail::tvec2 x0 = v - i + dot(i, detail::tvec2(C[0])); - - // Other corners - //i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0 - //i1.y = 1.0 - i1.x; - detail::tvec2 i1 = (x0.x > x0.y) ? detail::tvec2(1, 0) : detail::tvec2(0, 1); - // x0 = x0 - 0.0 + 0.0 * C.xx ; - // x1 = x0 - i1 + 1.0 * C.xx ; - // x2 = x0 - 1.0 + 2.0 * C.xx ; - detail::tvec4 x12 = detail::tvec4(x0.x, x0.y, x0.x, x0.y) + detail::tvec4(C.x, C.x, C.z, C.z); - x12 = detail::tvec4(detail::tvec2(x12) - i1, x12.z, x12.w); - - // Permutations - i = mod(i, T(289)); // Avoid truncation effects in permutation - detail::tvec3 p = permute( - permute(i.y + detail::tvec3(T(0), i1.y, T(1))) - + i.x + detail::tvec3(T(0), i1.x, T(1))); - - detail::tvec3 m = max(T(0.5) - detail::tvec3( - dot(x0, x0), - dot(detail::tvec2(x12.x, x12.y), detail::tvec2(x12.x, x12.y)), - dot(detail::tvec2(x12.z, x12.w), detail::tvec2(x12.z, x12.w))), T(0)); - m = m * m ; - m = m * m ; - - // Gradients: 41 points uniformly over a line, mapped onto a diamond. - // The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287) - - detail::tvec3 x = T(2) * fract(p * C.w) - T(1); - detail::tvec3 h = abs(x) - T(0.5); - detail::tvec3 ox = floor(x + T(0.5)); - detail::tvec3 a0 = x - ox; - - // Normalise gradients implicitly by scaling m - // Inlined for speed: m *= taylorInvSqrt( a0*a0 + h*h ); - m *= T(1.79284291400159) - T(0.85373472095314) * (a0 * a0 + h * h); - - // Compute final noise value at P - detail::tvec3 g; - g.x = a0.x * x0.x + h.x * x0.y; - //g.yz = a0.yz * x12.xz + h.yz * x12.yw; - g.y = a0.y * x12.x + h.y * x12.y; - g.z = a0.z * x12.z + h.z * x12.w; - return T(130) * dot(m, g); - } - - template - GLM_FUNC_QUALIFIER T noise1(detail::tvec3 const & v) - { - detail::tvec2 const C(1.0 / 6.0, 1.0 / 3.0); - detail::tvec4 const D(0.0, 0.5, 1.0, 2.0); - - // First corner - detail::tvec3 i(floor(v + dot(v, detail::tvec3(C.y)))); - detail::tvec3 x0(v - i + dot(i, detail::tvec3(C.x))); - - // Other corners - detail::tvec3 g(step(detail::tvec3(x0.y, x0.z, x0.x), x0)); - detail::tvec3 l(T(1) - g); - detail::tvec3 i1(min(g, detail::tvec3(l.z, l.x, l.y))); - detail::tvec3 i2(max(g, detail::tvec3(l.z, l.x, l.y))); - - // x0 = x0 - 0.0 + 0.0 * C.xxx; - // x1 = x0 - i1 + 1.0 * C.xxx; - // x2 = x0 - i2 + 2.0 * C.xxx; - // x3 = x0 - 1.0 + 3.0 * C.xxx; - detail::tvec3 x1(x0 - i1 + C.x); - detail::tvec3 x2(x0 - i2 + C.y); // 2.0*C.x = 1/3 = C.y - detail::tvec3 x3(x0 - D.y); // -1.0+3.0*C.x = -0.5 = -D.y - - // Permutations - i = mod289(i); - detail::tvec4 p(permute(permute(permute( - i.z + detail::tvec4(T(0), i1.z, i2.z, T(1))) + - i.y + detail::tvec4(T(0), i1.y, i2.y, T(1))) + - i.x + detail::tvec4(T(0), i1.x, i2.x, T(1)))); - - // Gradients: 7x7 points over a square, mapped onto an octahedron. - // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) - T n_ = T(0.142857142857); // 1.0/7.0 - detail::tvec3 ns(n_ * detail::tvec3(D.w, D.y, D.z) - detail::tvec3(D.x, D.z, D.x)); - - detail::tvec4 j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7) - - detail::tvec4 x_(floor(j * ns.z)); - detail::tvec4 y_(floor(j - T(7) * x_)); // mod(j,N) - - detail::tvec4 x(x_ * ns.x + ns.y); - detail::tvec4 y(y_ * ns.x + ns.y); - detail::tvec4 h(T(1) - abs(x) - abs(y)); - - detail::tvec4 b0(x.x, x.y, y.x, y.y); - detail::tvec4 b1(x.z, x.w, y.z, y.w); - - // vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0; - // vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0; - detail::tvec4 s0(floor(b0) * T(2) + T(1)); - detail::tvec4 s1(floor(b1) * T(2) + T(1)); - detail::tvec4 sh(-step(h, detail::tvec4(0.0))); - - detail::tvec4 a0 = detail::tvec4(b0.x, b0.z, b0.y, b0.w) + detail::tvec4(s0.x, s0.z, s0.y, s0.w) * detail::tvec4(sh.x, sh.x, sh.y, sh.y); - detail::tvec4 a1 = detail::tvec4(b1.x, b1.z, b1.y, b1.w) + detail::tvec4(s1.x, s1.z, s1.y, s1.w) * detail::tvec4(sh.z, sh.z, sh.w, sh.w); - - detail::tvec3 p0(a0.x, a0.y, h.x); - detail::tvec3 p1(a0.z, a0.w, h.y); - detail::tvec3 p2(a1.x, a1.y, h.z); - detail::tvec3 p3(a1.z, a1.w, h.w); - - // Normalise gradients - detail::tvec4 norm = taylorInvSqrt(detail::tvec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3))); - p0 *= norm.x; - p1 *= norm.y; - p2 *= norm.z; - p3 *= norm.w; - - // Mix final noise value - detail::tvec4 m = max(T(0.6) - detail::tvec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), T(0)); - m = m * m; - return T(42) * dot(m * m, detail::tvec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3))); - } - - template - GLM_FUNC_QUALIFIER T noise1(detail::tvec4 const & v) - { - detail::tvec4 const C( - 0.138196601125011, // (5 - sqrt(5))/20 G4 - 0.276393202250021, // 2 * G4 - 0.414589803375032, // 3 * G4 - -0.447213595499958); // -1 + 4 * G4 - - // (sqrt(5) - 1)/4 = F4, used once below - T const F4 = T(0.309016994374947451); - - // First corner - detail::tvec4 i = floor(v + dot(v, vec4(F4))); - detail::tvec4 x0 = v - i + dot(i, vec4(C.x)); - - // Other corners - - // Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI) - detail::tvec4 i0; - detail::tvec3 isX = step(detail::tvec3(x0.y, x0.z, x0.w), detail::tvec3(x0.x)); - detail::tvec3 isYZ = step(detail::tvec3(x0.z, x0.w, x0.w), detail::tvec3(x0.y, x0.y, x0.z)); - // i0.x = dot(isX, vec3(1.0)); - //i0.x = isX.x + isX.y + isX.z; - //i0.yzw = T(1) - isX; - i0 = detail::tvec4(isX.x + isX.y + isX.z, T(1) - isX); - // i0.y += dot(isYZ.xy, vec2(1.0)); - i0.y += isYZ.x + isYZ.y; - //i0.zw += 1.0 - detail::tvec2(isYZ.x, isYZ.y); - i0.z += T(1) - isYZ.x; - i0.w += T(1) - isYZ.y; - i0.z += isYZ.z; - i0.w += T(1) - isYZ.z; - - // i0 now contains the unique values 0,1,2,3 in each channel - detail::tvec4 i3 = clamp(i0, 0.0, 1.0); - detail::tvec4 i2 = clamp(i0 - 1.0, 0.0, 1.0); - detail::tvec4 i1 = clamp(i0 - 2.0, 0.0, 1.0); - - // x0 = x0 - 0.0 + 0.0 * C.xxxx - // x1 = x0 - i1 + 0.0 * C.xxxx - // x2 = x0 - i2 + 0.0 * C.xxxx - // x3 = x0 - i3 + 0.0 * C.xxxx - // x4 = x0 - 1.0 + 4.0 * C.xxxx - detail::tvec4 x1 = x0 - i1 + C.x; - detail::tvec4 x2 = x0 - i2 + C.y; - detail::tvec4 x3 = x0 - i3 + C.z; - detail::tvec4 x4 = x0 + C.w; - - // Permutations - i = mod(i, T(289)); - T j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x); - detail::tvec4 j1 = permute(permute(permute(permute( - i.w + detail::tvec4(i1.w, i2.w, i3.w, T(1))) - + i.z + detail::tvec4(i1.z, i2.z, i3.z, T(1))) - + i.y + detail::tvec4(i1.y, i2.y, i3.y, T(1))) - + i.x + detail::tvec4(i1.x, i2.x, i3.x, T(1))); - - // Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope - // 7*7*6 = 294, which is close to the ring size 17*17 = 289. - detail::tvec4 ip = detail::tvec4(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0)); - - detail::tvec4 p0 = grad4(j0, ip); - detail::tvec4 p1 = grad4(j1.x, ip); - detail::tvec4 p2 = grad4(j1.y, ip); - detail::tvec4 p3 = grad4(j1.z, ip); - detail::tvec4 p4 = grad4(j1.w, ip); - - // Normalise gradients - detail::tvec4 norm = taylorInvSqrt(detail::tvec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3))); - p0 *= norm.x; - p1 *= norm.y; - p2 *= norm.z; - p3 *= norm.w; - p4 *= taylorInvSqrt(dot(p4, p4)); - - // Mix contributions from the five corners - detail::tvec3 m0 = max(T(0.6) - detail::tvec3(dot(x0, x0), dot(x1, x1), dot(x2, x2)), T(0)); - detail::tvec2 m1 = max(T(0.6) - detail::tvec2(dot(x3, x3), dot(x4, x4) ), T(0)); - m0 = m0 * m0; - m1 = m1 * m1; - return T(49) * - (dot(m0 * m0, detail::tvec3(dot(p0, x0), dot(p1, x1), dot(p2, x2))) + - dot(m1 * m1, detail::tvec2(dot(p3, x3), dot(p4, x4)))); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec2 noise2(glm::detail::tvec2 const & x) - { - return glm::detail::tvec2( - noise1(x + glm::detail::tvec2(0.0)), - noise1(glm::detail::tvec2(0.0) - x)); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec2 noise2(glm::detail::tvec3 const & x) - { - return glm::detail::tvec2( - noise1(x + glm::detail::tvec3(0.0)), - noise1(glm::detail::tvec3(0.0) - x)); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec2 noise2(glm::detail::tvec4 const & x) - { - return glm::detail::tvec2( - noise1(x + glm::detail::tvec4(0.0)), - noise1(glm::detail::tvec4(0.0) - x)); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec3 noise3(glm::detail::tvec2 const & x) - { - return glm::detail::tvec3( - noise1(x - glm::detail::tvec2(1.0)), - noise1(x + glm::detail::tvec2(0.0)), - noise1(x + glm::detail::tvec2(1.0))); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec3 noise3(glm::detail::tvec3 const & x) - { - return glm::detail::tvec3( - noise1(x - glm::detail::tvec3(1.0)), - noise1(x + glm::detail::tvec3(0.0)), - noise1(x + glm::detail::tvec3(1.0))); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec3 noise3(glm::detail::tvec4 const & x) - { - return glm::detail::tvec3( - noise1(x - glm::detail::tvec4(1.0)), - noise1(x + glm::detail::tvec4(0.0)), - noise1(x + glm::detail::tvec4(1.0))); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec4 noise4(glm::detail::tvec2 const & x) - { - return glm::detail::tvec4( - noise1(x - glm::detail::tvec2(1.0)), - noise1(x + glm::detail::tvec2(0.0)), - noise1(x + glm::detail::tvec2(1.0)), - noise1(x + glm::detail::tvec2(2.0))); - } - - - template - GLM_FUNC_QUALIFIER glm::detail::tvec4 noise4(glm::detail::tvec3 const & x) - { - return glm::detail::tvec4( - noise1(x - glm::detail::tvec3(1.0)), - noise1(x + glm::detail::tvec3(0.0)), - noise1(x + glm::detail::tvec3(1.0)), - noise1(x + glm::detail::tvec3(2.0))); - } - - template - GLM_FUNC_QUALIFIER glm::detail::tvec4 noise4(glm::detail::tvec4 const & x) - { - return glm::detail::tvec4( - noise1(x - glm::detail::tvec4(1.0)), - noise1(x + glm::detail::tvec4(0.0)), - noise1(x + glm::detail::tvec4(1.0)), - noise1(x + glm::detail::tvec4(2.0))); - } - -}//namespace glm diff --git a/src/include/glm/core/func_packing.hpp b/src/include/glm/core/func_packing.hpp deleted file mode 100755 index 1a1bde6..0000000 --- a/src/include/glm/core/func_packing.hpp +++ /dev/null @@ -1,194 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_packing.hpp -/// @date 2010-03-17 / 2011-06-15 -/// @author Christophe Riccio -/// -/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions -/// -/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions -/// @ingroup core -/// -/// These functions do not operate component-wise, rather as described in each case. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef GLM_CORE_func_packing -#define GLM_CORE_func_packing GLM_VERSION - -namespace glm -{ - /// @addtogroup core_func_packing - /// @{ - - //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. - //! Then, the results are packed into the returned 32-bit unsigned integer. - //! - //! The conversion for component c of v to fixed point is done as follows: - //! packUnorm2x16: round(clamp(c, 0, +1) * 65535.0) - //! - //! The first component of the vector will be written to the least significant bits of the output; - //! the last component will be written to the most significant bits. - //! - /// @see GLSL packUnorm2x16 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::uint32 packUnorm2x16(detail::tvec2 const & v); - - //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. - //! Then, the results are packed into the returned 32-bit unsigned integer. - //! - //! The conversion for component c of v to fixed point is done as follows: - //! packSnorm2x16: round(clamp(v, -1, +1) * 32767.0) - //! - //! The first component of the vector will be written to the least significant bits of the output; - //! the last component will be written to the most significant bits. - //! - /// @see GLSL packSnorm2x16 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::uint32 packSnorm2x16(detail::tvec2 const & v); - - //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. - //! Then, the results are packed into the returned 32-bit unsigned integer. - //! - //! The conversion for component c of v to fixed point is done as follows: - //! packUnorm4x8: round(clamp(c, 0, +1) * 255.0) - //! - //! The first component of the vector will be written to the least significant bits of the output; - //! the last component will be written to the most significant bits. - //! - /// @see GLSL packUnorm4x8 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::uint32 packUnorm4x8(detail::tvec4 const & v); - - //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. - //! Then, the results are packed into the returned 32-bit unsigned integer. - //! - //! The conversion for component c of v to fixed point is done as follows: - //! packSnorm4x8: round(clamp(c, -1, +1) * 127.0) - //! - //! The first component of the vector will be written to the least significant bits of the output; - //! the last component will be written to the most significant bits. - //! - /// @see GLSL packSnorm4x8 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::uint32 packSnorm4x8(detail::tvec4 const & v); - - //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. - //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. - //! - //! The conversion for unpacked fixed-point value f to floating point is done as follows: - //! unpackUnorm2x16: f / 65535.0 - //! - //! The first component of the returned vector will be extracted from the least significant bits of the input; - //! the last component will be extracted from the most significant bits. - //! - /// @see GLSL unpackUnorm2x16 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::tvec2 unpackUnorm2x16(detail::uint32 const & p); - - //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. - //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. - //! - //! The conversion for unpacked fixed-point value f to floating point is done as follows: - //! unpackSnorm2x16: clamp(f / 32767.0, -1, +1) - //! - //! The first component of the returned vector will be extracted from the least significant bits of the input; - //! the last component will be extracted from the most significant bits. - //! - /// @see GLSL unpackSnorm2x16 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::tvec2 unpackSnorm2x16(detail::uint32 const & p); - - /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. - /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. - /// - /// The conversion for unpacked fixed-point value f to floating point is done as follows: - /// unpackUnorm4x8: f / 255.0 - /// - /// The first component of the returned vector will be extracted from the least significant bits of the input; - /// the last component will be extracted from the most significant bits. - /// - /// @see GLSL unpackUnorm4x8 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::tvec4 unpackUnorm4x8(detail::uint32 const & p); - - /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. - /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. - /// - /// The conversion for unpacked fixed-point value f to floating point is done as follows: - /// unpackSnorm4x8: clamp(f / 127.0, -1, +1) - /// - /// The first component of the returned vector will be extracted from the least significant bits of the input; - /// the last component will be extracted from the most significant bits. - /// - /// @see GLSL unpackSnorm4x8 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::tvec4 unpackSnorm4x8(detail::uint32 const & p); - - /// Returns a double-precision value obtained by packing the components of v into a 64-bit value. - /// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified. - /// Otherwise, the bit- level representation of v is preserved. - /// The first vector component specifies the 32 least significant bits; - /// the second component specifies the 32 most significant bits. - /// - /// @see GLSL packDouble2x32 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - double packDouble2x32(detail::tvec2 const & v); - - /// Returns a two-component unsigned integer vector representation of v. - /// The bit-level representation of v is preserved. - /// The first component of the vector contains the 32 least significant bits of the double; - /// the second component consists the 32 most significant bits. - /// - /// @see GLSL unpackDouble2x32 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::tvec2 unpackDouble2x32(double const & v); - - - /// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector - /// to the 16-bit floating-point representation found in the OpenGL Specification, - /// and then packing these two 16- bit integers into a 32-bit unsigned integer. - /// The first vector component specifies the 16 least-significant bits of the result; - /// the second component specifies the 16 most-significant bits. - /// - /// @see GLSL packHalf2x16 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - uint packHalf2x16(vec2 const & v); - - /// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values, - /// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification, - /// and converting them to 32-bit floating-point values. - /// The first component of the vector is obtained from the 16 least-significant bits of v; - /// the second component is obtained from the 16 most-significant bits of v. - /// - /// @see GLSL unpackHalf2x16 man page - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - vec2 unpackHalf2x16(uint const & v); - - /// @} -}//namespace glm - -#include "func_packing.inl" - -#endif//GLM_CORE_func_packing - diff --git a/src/include/glm/core/func_packing.inl b/src/include/glm/core/func_packing.inl deleted file mode 100755 index 48b6fbc..0000000 --- a/src/include/glm/core/func_packing.inl +++ /dev/null @@ -1,178 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_packing.inl -/// @date 2010-03-17 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -namespace glm -{ - GLM_FUNC_QUALIFIER detail::uint32 packUnorm2x16(detail::tvec2 const & v) - { - detail::uint16 A(detail::uint16(round(clamp(v.x, 0.0f, 1.0f) * 65535.0f))); - detail::uint16 B(detail::uint16(round(clamp(v.y, 0.0f, 1.0f) * 65535.0f))); - return detail::uint32((B << 16) | A); - } - - GLM_FUNC_QUALIFIER detail::tvec2 unpackUnorm2x16(detail::uint32 const & p) - { - detail::uint32 Mask16((1 << 16) - 1); - detail::uint32 A((p >> 0) & Mask16); - detail::uint32 B((p >> 16) & Mask16); - return detail::tvec2( - A * 1.0f / 65535.0f, - B * 1.0f / 65535.0f); - } - - GLM_FUNC_QUALIFIER detail::uint32 packSnorm2x16(detail::tvec2 const & v) - { - union iu - { - detail::int16 i; - detail::uint16 u; - } A, B; - - detail::tvec2 Unpack = clamp(v ,-1.0f, 1.0f) * 32767.0f; - A.i = detail::int16(round(Unpack.x)); - B.i = detail::int16(round(Unpack.y)); - detail::uint32 Pack = (detail::uint32(B.u) << 16) | (detail::uint32(A.u) << 0); - return Pack; - } - - GLM_FUNC_QUALIFIER detail::tvec2 unpackSnorm2x16(detail::uint32 const & p) - { - union iu - { - detail::int16 i; - detail::uint16 u; - } A, B; - - detail::uint32 Mask16((1 << 16) - 1); - A.u = detail::uint16((p >> 0) & Mask16); - B.u = detail::uint16((p >> 16) & Mask16); - detail::tvec2 Pack(A.i, B.i); - - return clamp(Pack * 1.0f / 32767.0f, -1.0f, 1.0f); - } - - GLM_FUNC_QUALIFIER detail::uint32 packUnorm4x8(detail::tvec4 const & v) - { - detail::uint8 A((detail::uint8)round(clamp(v.x, 0.0f, 1.0f) * 255.0f)); - detail::uint8 B((detail::uint8)round(clamp(v.y, 0.0f, 1.0f) * 255.0f)); - detail::uint8 C((detail::uint8)round(clamp(v.z, 0.0f, 1.0f) * 255.0f)); - detail::uint8 D((detail::uint8)round(clamp(v.w, 0.0f, 1.0f) * 255.0f)); - return detail::uint32((D << 24) | (C << 16) | (B << 8) | A); - } - - GLM_FUNC_QUALIFIER detail::tvec4 unpackUnorm4x8(detail::uint32 const & p) - { - detail::uint32 Mask8((1 << 8) - 1); - detail::uint32 A((p >> 0) & Mask8); - detail::uint32 B((p >> 8) & Mask8); - detail::uint32 C((p >> 16) & Mask8); - detail::uint32 D((p >> 24) & Mask8); - return detail::tvec4( - A * 1.0f / 255.0f, - B * 1.0f / 255.0f, - C * 1.0f / 255.0f, - D * 1.0f / 255.0f); - } - - GLM_FUNC_QUALIFIER detail::uint32 packSnorm4x8(detail::tvec4 const & v) - { - union iu - { - detail::int8 i; - detail::uint8 u; - } A, B, C, D; - - detail::tvec4 Unpack = clamp(v ,-1.0f, 1.0f) * 127.0f; - A.i = detail::int8(round(Unpack.x)); - B.i = detail::int8(round(Unpack.y)); - C.i = detail::int8(round(Unpack.z)); - D.i = detail::int8(round(Unpack.w)); - detail::uint32 Pack = (detail::uint32(D.u) << 24) | (detail::uint32(C.u) << 16) | (detail::uint32(B.u) << 8) | (detail::uint32(A.u) << 0); - return Pack; - } - - GLM_FUNC_QUALIFIER detail::tvec4 unpackSnorm4x8(detail::uint32 const & p) - { - union iu - { - detail::int8 i; - detail::uint8 u; - } A, B, C, D; - - detail::uint32 Mask8((1 << 8) - 1); - A.u = detail::uint8((p >> 0) & Mask8); - B.u = detail::uint8((p >> 8) & Mask8); - C.u = detail::uint8((p >> 16) & Mask8); - D.u = detail::uint8((p >> 24) & Mask8); - detail::tvec4 Pack(A.i, B.i, C.i, D.i); - - return clamp(Pack * 1.0f / 127.0f, -1.0f, 1.0f); - } - - GLM_FUNC_QUALIFIER double packDouble2x32(detail::tvec2 const & v) - { - return *(double*)&v; - } - - GLM_FUNC_QUALIFIER detail::tvec2 unpackDouble2x32(double const & v) - { - return *(detail::tvec2*)&v; - } - - GLM_FUNC_QUALIFIER uint packHalf2x16(detail::tvec2 const & v) - { - union helper - { - uint other; - struct - { - detail::hdata a, b; - } orig; - } Pack; - - Pack.orig.a = detail::toFloat16(v.x); - Pack.orig.b = detail::toFloat16(v.y); - return *(uint*)&Pack; - } - - GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v) - { - union helper - { - uint other; - struct - { - detail::hdata a, b; - } orig; - } Unpack; - Unpack.other = v; - - return vec2(detail::toFloat32(Unpack.orig.a), detail::toFloat32(Unpack.orig.b)); - } -}//namespace glm - diff --git a/src/include/glm/core/func_trigonometric.hpp b/src/include/glm/core/func_trigonometric.hpp deleted file mode 100755 index 0dcbd77..0000000 --- a/src/include/glm/core/func_trigonometric.hpp +++ /dev/null @@ -1,203 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_trigonometric.hpp -/// @date 2008-08-01 / 2011-06-15 -/// @author Christophe Riccio -/// -/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions -/// -/// @defgroup core_func_trigonometric Angle and Trigonometry Functions -/// @ingroup core -/// -/// Function parameters specified as angle are assumed to be in units of radians. -/// In no case will any of these functions result in a divide by zero error. If -/// the divisor of a ratio is 0, then results will be undefined. -/// -/// These all operate component-wise. The description is per component. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef GLM_CORE_func_trigonometric -#define GLM_CORE_func_trigonometric GLM_VERSION - -namespace glm -{ - /// @addtogroup core_func_trigonometric - /// @{ - - /// Converts degrees to radians and returns the result. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL radians man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType radians(genType const & degrees); - - /// Converts radians to degrees and returns the result. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL degrees man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType degrees(genType const & radians); - - /// The standard trigonometric sine function. - /// The values returned by this function will range from [-1, 1]. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL sin man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType sin(genType const & angle); - - /// The standard trigonometric cosine function. - /// The values returned by this function will range from [-1, 1]. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL cos man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType cos(genType const & angle); - - /// The standard trigonometric tangent function. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL tan man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType tan(genType const & angle); - - /// Arc sine. Returns an angle whose sine is x. - /// The range of values returned by this function is [-PI/2, PI/2]. - /// Results are undefined if |x| > 1. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL asin man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType asin(genType const & x); - - /// Arc cosine. Returns an angle whose sine is x. - /// The range of values returned by this function is [0, PI]. - /// Results are undefined if |x| > 1. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL acos man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType acos(genType const & x); - - /// Arc tangent. Returns an angle whose tangent is y/x. - /// The signs of x and y are used to determine what - /// quadrant the angle is in. The range of values returned - /// by this function is [-PI, PI]. Results are undefined - /// if x and y are both 0. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL atan man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType atan(genType const & y, genType const & x); - - /// Arc tangent. Returns an angle whose tangent is y_over_x. - /// The range of values returned by this function is [-PI/2, PI/2]. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL atan man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType atan(genType const & y_over_x); - - /// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2 - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL sinh man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType sinh(genType const & angle); - - /// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2 - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL cosh man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType cosh(genType const & angle); - - /// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle) - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL tanh man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType tanh(genType const & angle); - - /// Arc hyperbolic sine; returns the inverse of sinh. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL asinh man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType asinh(genType const & x); - - /// Arc hyperbolic cosine; returns the non-negative inverse - /// of cosh. Results are undefined if x < 1. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL acosh man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType acosh(genType const & x); - - /// Arc hyperbolic tangent; returns the inverse of tanh. - /// Results are undefined if abs(x) >= 1. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL atanh man page - /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions - template - genType atanh(genType const & x); - - /// @} -}//namespace glm - -#include "func_trigonometric.inl" - -#endif//GLM_CORE_func_trigonometric - - diff --git a/src/include/glm/core/func_trigonometric.inl b/src/include/glm/core/func_trigonometric.inl deleted file mode 100755 index 72b19e5..0000000 --- a/src/include/glm/core/func_trigonometric.inl +++ /dev/null @@ -1,246 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_trigonometric.inl -/// @date 2008-08-03 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#include "_vectorize.hpp" - -namespace glm -{ - // radians - template - GLM_FUNC_QUALIFIER genType radians - ( - genType const & degrees - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'radians' only accept floating-point input"); - - genType const pi = genType(3.1415926535897932384626433832795); - return degrees * (pi / genType(180)); - } - - VECTORIZE_VEC(radians) - - // degrees - template - GLM_FUNC_QUALIFIER genType degrees - ( - genType const & radians - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'degrees' only accept floating-point input"); - - const genType pi = genType(3.1415926535897932384626433832795); - return radians * (genType(180) / pi); - } - - VECTORIZE_VEC(degrees) - - // sin - template - GLM_FUNC_QUALIFIER genType sin - ( - genType const & angle - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'sin' only accept floating-point input"); - - return ::std::sin(angle); - } - - VECTORIZE_VEC(sin) - - // cos - template - GLM_FUNC_QUALIFIER genType cos(genType const & angle) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'cos' only accept floating-point input"); - - return ::std::cos(angle); - } - - VECTORIZE_VEC(cos) - - // tan - template - GLM_FUNC_QUALIFIER genType tan - ( - genType const & angle - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'tan' only accept floating-point input"); - - return ::std::tan(angle); - } - - VECTORIZE_VEC(tan) - - // asin - template - GLM_FUNC_QUALIFIER genType asin - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'asin' only accept floating-point input"); - - return ::std::asin(x); - } - - VECTORIZE_VEC(asin) - - // acos - template - GLM_FUNC_QUALIFIER genType acos - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'acos' only accept floating-point input"); - - return ::std::acos(x); - } - - VECTORIZE_VEC(acos) - - // atan - template - GLM_FUNC_QUALIFIER genType atan - ( - genType const & y, - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'atan' only accept floating-point input"); - - return ::std::atan2(y, x); - } - - VECTORIZE_VEC_VEC(atan) - - template - GLM_FUNC_QUALIFIER genType atan - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'atan' only accept floating-point input"); - - return ::std::atan(x); - } - - VECTORIZE_VEC(atan) - - // sinh - template - GLM_FUNC_QUALIFIER genType sinh - ( - genType const & angle - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'sinh' only accept floating-point input"); - - return std::sinh(angle); - } - - VECTORIZE_VEC(sinh) - - // cosh - template - GLM_FUNC_QUALIFIER genType cosh - ( - genType const & angle - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'cosh' only accept floating-point input"); - - return std::cosh(angle); - } - - VECTORIZE_VEC(cosh) - - // tanh - template - GLM_FUNC_QUALIFIER genType tanh - ( - genType const & angle - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'tanh' only accept floating-point input"); - - return std::tanh(angle); - } - - VECTORIZE_VEC(tanh) - - // asinh - template - GLM_FUNC_QUALIFIER genType asinh - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'asinh' only accept floating-point input"); - - return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x)); - } - - VECTORIZE_VEC(asinh) - - // acosh - template - GLM_FUNC_QUALIFIER genType acosh - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'acosh' only accept floating-point input"); - - if(x < genType(1)) - return genType(0); - return log(x + sqrt(x * x - genType(1))); - } - - VECTORIZE_VEC(acosh) - - // atanh - template - GLM_FUNC_QUALIFIER genType atanh - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'atanh' only accept floating-point input"); - - if(abs(x) >= genType(1)) - return 0; - return genType(0.5) * log((genType(1) + x) / (genType(1) - x)); - } - - VECTORIZE_VEC(atanh) - -}//namespace glm diff --git a/src/include/glm/core/func_vector_relational.hpp b/src/include/glm/core/func_vector_relational.hpp deleted file mode 100755 index 236fb31..0000000 --- a/src/include/glm/core/func_vector_relational.hpp +++ /dev/null @@ -1,138 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/func_vector_relational.hpp -/// @date 2008-08-03 / 2011-06-15 -/// @author Christophe Riccio -/// -/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions -/// -/// @defgroup core_func_vector_relational Vector Relational Functions -/// @ingroup core -/// -/// Relational and equality operators (<, <=, >, >=, ==, !=) are defined to -/// operate on scalars and produce scalar Boolean results. For vector results, -/// use the following built-in functions. -/// -/// In all cases, the sizes of all the input and return vectors for any particular -/// call must match. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef GLM_CORE_func_vector_relational -#define GLM_CORE_func_vector_relational GLM_VERSION - -#include "_detail.hpp" - -namespace glm -{ - /// @addtogroup core_func_vector_relational - /// @{ - - /// Returns the component-wise comparison result of x < y. - /// - /// @tparam vecType Floating-point or integer vector types. - /// - /// @see GLSL lessThan man page - /// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions - template - typename vecType::bool_type lessThan(vecType const & x, vecType const & y); - - /// Returns the component-wise comparison of result x <= y. - /// - /// @tparam vecType Floating-point or integer vector types. - /// - /// @see GLSL lessThanEqual man page - /// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions - template - typename vecType::bool_type lessThanEqual(vecType const & x, vecType const & y); - - /// Returns the component-wise comparison of result x > y. - /// - /// @tparam vecType Floating-point or integer vector types. - /// - /// @see GLSL greaterThan man page - /// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions - template - typename vecType::bool_type greaterThan(vecType const & x, vecType const & y); - - /// Returns the component-wise comparison of result x >= y. - /// - /// @tparam vecType Floating-point or integer vector types. - /// - /// @see GLSL greaterThanEqual man page - /// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions - template - typename vecType::bool_type greaterThanEqual(vecType const & x, vecType const & y); - - /// Returns the component-wise comparison of result x == y. - /// - /// @tparam vecType Floating-point, integer or boolean vector types. - /// - /// @see GLSL equal man page - /// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions - template - typename vecType::bool_type equal(vecType const & x, vecType const & y); - - /// Returns the component-wise comparison of result x != y. - /// - /// @tparam vecType Floating-point, integer or boolean vector types. - /// - /// @see GLSL notEqual man page - /// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions - template - typename vecType::bool_type notEqual(vecType const & x, vecType const & y); - - /// Returns true if any component of x is true. - /// - /// @tparam vecType Boolean vector types. - /// - /// @see GLSL any man page - /// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions - template