diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..fc46d193 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.6 FATAL_ERROR) +cmake_policy(VERSION 2.6) + +project(glm) + +add_definitions(-D_CRT_SECURE_NO_WARNINGS) + +add_subdirectory(glm) +add_subdirectory(doc) +add_subdirectory(test) + + diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 00000000..6d9f918b --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,10 @@ +set(NAME glm-doc) + +file(GLOB ROOT_CPP src/*.cpp) +file(GLOB ROOT_XML src/*.xml) +file(GLOB ROOT_XSL src/*.xsl) + +source_group("XML Files" FILES ${ROOT_XML}) +source_group("XSL Files" FILES ${ROOT_XSL}) + +add_executable(${NAME} ${ROOT_CPP} ${ROOT_XML} ${ROOT_XSL}) diff --git a/doc/build/XalanMessages_1_7_0.dll b/doc/build/XalanMessages_1_7_0.dll new file mode 100644 index 00000000..65834439 Binary files /dev/null and b/doc/build/XalanMessages_1_7_0.dll differ diff --git a/doc/build/build.bat b/doc/build/build.bat new file mode 100644 index 00000000..18062b06 --- /dev/null +++ b/doc/build/build.bat @@ -0,0 +1,9 @@ +xalan -m -o ..\index.html ..\src\data.xml ..\src\news.xsl +xalan -m -o ..\download.html ..\src\data.xml ..\src\download.xsl +xalan -m -o ..\changelog.html ..\src\data.xml ..\src\changelog.xsl +xalan -m -o ..\issue.html ..\src\data.xml ..\src\issue.xsl +xalan -m -o ..\link.html ..\src\data.xml ..\src\link.xsl +xalan -m -o ..\goodies.html ..\src\data.xml ..\src\goodies.xsl +xalan -m -o ..\about.html ..\src\data.xml ..\src\about.xsl +xalan -m -o ..\code.html ..\src\data.xml ..\src\code.xsl +pause \ No newline at end of file diff --git a/doc/build/msvcp71.dll b/doc/build/msvcp71.dll new file mode 100644 index 00000000..9ed0d17e Binary files /dev/null and b/doc/build/msvcp71.dll differ diff --git a/doc/build/msvcr71.dll b/doc/build/msvcr71.dll new file mode 100644 index 00000000..9d9e0286 Binary files /dev/null and b/doc/build/msvcr71.dll differ diff --git a/doc/build/xalan-c_1_7_0.dll b/doc/build/xalan-c_1_7_0.dll new file mode 100644 index 00000000..319c14dd Binary files /dev/null and b/doc/build/xalan-c_1_7_0.dll differ diff --git a/doc/build/xalan.exe b/doc/build/xalan.exe new file mode 100644 index 00000000..62deedc5 Binary files /dev/null and b/doc/build/xalan.exe differ diff --git a/doc/build/xerces-c_2_5_0.dll b/doc/build/xerces-c_2_5_0.dll new file mode 100644 index 00000000..1a9b5112 Binary files /dev/null and b/doc/build/xerces-c_2_5_0.dll differ diff --git a/doc/common/doxygen/doxygen.css b/doc/common/doxygen/doxygen.css new file mode 100644 index 00000000..65123996 --- /dev/null +++ b/doc/common/doxygen/doxygen.css @@ -0,0 +1,475 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { + text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { + font-weight: bold +} +DIV.qindex { + width: 100%; + background-color: #ff8000;/*#e8eef2;*/ + border: 1px solid #ff8000; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navpath { + width: 100%; + background-color: #ff8000;/*e8eef2*/ + border: 1px solid #ff8000; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #ff8000;/*#e8eef2;*/ + border: 1px solid #ff8000; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #ff8000; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #ff8000 +} +A.qindex:hover { + text-decoration: none; + background-color: #ffe0c0; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #ffe0c0; + color: #ffffff; + border: 1px double #ffe0c0; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #ffe0c0; + color: #ffffff; +} +A.qindexHL:visited { + text-decoration: none; + background-color: #ffe0c0; + color: #ffffff +} +A.el { + text-decoration: none; + font-weight: bold +} +A.elRef { + font-weight: bold +} +A.code:link { + text-decoration: none; + font-weight: normal; + color: #ff8000 +} +A.code:visited { + text-decoration: none; + font-weight: normal; + color: #ff8000 +} +A.codeRef:link { + font-weight: normal; + color: #ff8000 +} +A.codeRef:visited { + font-weight: normal; + color: #ff8000 +} +A:hover { + text-decoration: none; + background-color: #f2f2ff +} +DL.el { + margin-left: -1cm +} +.fragment { + font-family: monospace, fixed; + font-size: 95%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px +} + +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { + margin-left: 16px; + font-style: italic; + font-size: 90% +} +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #fff0e0;/*#e8eef2;*/ + font-weight : normal; + padding-right : 10px; + padding-top : 8px; + padding-left : 10px; + padding-bottom : 8px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 0px solid #CCCCCC; + -moz-border-radius: 8px 8px 8px 8px; +} +TD.indexvalue { + background-color: #fff0e0;/*#e8eef2;*/ + font-style: italic; + padding-right : 10px; + padding-top : 8px; + padding-left : 10px; + padding-bottom : 8px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 0px solid #CCCCCC; + -moz-border-radius: 8px 8px 8px 8px; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { + text-align: center; +} +IMG.formulaDsp { +} +IMG.formulaInl { + vertical-align: middle; +} +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +SPAN.vhdldigit { color: #ff00ff } +SPAN.vhdlchar { color: #000000 } +SPAN.vhdlkeyword { color: #700070 } +SPAN.vhdllogic { color: #ff0000 } + +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { + color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { + font-size: 75%; + color: #402000; + font-weight: normal; + background-color: #ffe0c0; +} +TD.tiny { + font-size: 75%; +} +a { + color: #402000; +} +a:visited { + color: #804000; +} +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #fff0e0; +} +TH.dirtab { + background: #fff0e0; + font-weight: bold; +} +HR { + height: 1px; + border: none; + border-top: 1px solid black; +} + +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; + margin-left: 3px; +} +.memnav { + background-color: #ffe0c0; + border: 1px solid #ffe0c0; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + padding: 4px; + background-color: #fff0e0; + border-width: 1px; + border-style: solid; + border-color: #fff0e0; + -moz-border-radius: 8px 8px 8px 8px; +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #ffe0c0; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #ffe0c0; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; + white-space: nowrap; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +/* these are for tree view when used as main index */ +.directory { + font-size: 9pt; + font-weight: bold; +} +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* The following two styles can be used to replace the root node title */ +/* with an image of your choice. Simply uncomment the next two styles, */ +/* specify the name of your image and be sure to set 'height' to the */ +/* proper pixel height of your image. */ + +/* .directory h3.swap { */ +/* height: 61px; */ +/* background-repeat: no-repeat; */ +/* background-image: url("yourimage.gif"); */ +/* } */ +/* .directory h3.swap span { */ +/* display: none; */ +/* } */ + +.directory > h3 { + margin-top: 0; +} +.directory p { + margin: 0px; + white-space: nowrap; +} +.directory div { + display: none; + margin: 0px; +} +.directory img { + vertical-align: -30%; +} +/* these are for tree view when not used as main index */ +.directory-alt { + font-size: 100%; + font-weight: bold; +} +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} +.directory-alt > h3 { + margin-top: 0; +} +.directory-alt p { + margin: 0px; + white-space: nowrap; +} +.directory-alt div { + display: none; + margin: 0px; +} +.directory-alt img { + vertical-align: -30%; +} + diff --git a/doc/common/doxygen/doxygen.png b/doc/common/doxygen/doxygen.png new file mode 100644 index 00000000..c2877691 Binary files /dev/null and b/doc/common/doxygen/doxygen.png differ diff --git a/doc/common/doxygen/tab_b.gif b/doc/common/doxygen/tab_b.gif new file mode 100644 index 00000000..eeb81d48 Binary files /dev/null and b/doc/common/doxygen/tab_b.gif differ diff --git a/doc/common/doxygen/tab_l.gif b/doc/common/doxygen/tab_l.gif new file mode 100644 index 00000000..73cb1c57 Binary files /dev/null and b/doc/common/doxygen/tab_l.gif differ diff --git a/doc/common/doxygen/tab_r.gif b/doc/common/doxygen/tab_r.gif new file mode 100644 index 00000000..f404572d Binary files /dev/null and b/doc/common/doxygen/tab_r.gif differ diff --git a/doc/common/doxygen/tabs.css b/doc/common/doxygen/tabs.css new file mode 100644 index 00000000..308ff66d --- /dev/null +++ b/doc/common/doxygen/tabs.css @@ -0,0 +1,102 @@ +/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ + +DIV.tabs +{ + float : left; + width : 100%; + background : url("tab_b.gif") repeat-x bottom; + margin-bottom : 4px; +} + +DIV.tabs UL +{ + margin : 0px; + padding-left : 10px; + list-style : none; +} + +DIV.tabs LI, DIV.tabs FORM +{ + display : inline; + margin : 0px; + padding : 0px; +} + +DIV.tabs FORM +{ + float : right; +} + +DIV.tabs A +{ + float : left; + background : url("tab_r.gif") no-repeat right top; + border-bottom : 1px solid #FF8000; + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + +DIV.tabs A:hover +{ + background-position: 100% -150px; +} + +DIV.tabs A:link, DIV.tabs A:visited, +DIV.tabs A:active, DIV.tabs A:hover +{ + color: #000000;/*#1A419D;*/ +} + +DIV.tabs SPAN +{ + float : left; + display : block; + background : url("tab_l.gif") no-repeat left top; + padding : 5px 9px; + white-space : nowrap; +} + +DIV.tabs INPUT +{ + float : right; + display : inline; + font-size : 1em; +} + +DIV.tabs TD +{ + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + + + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +DIV.tabs SPAN {float : none;} +/* End IE5-Mac hack */ + +DIV.tabs A:hover SPAN +{ + background-position: 0% -150px; +} + +DIV.tabs LI.current A +{ + background-position: 100% -150px; + border-width : 0px; +} + +DIV.tabs LI.current SPAN +{ + background-position: 0% -150px; + padding-bottom : 6px; +} + +DIV.navpath +{ + background : none; + border : none; + border-bottom : 1px solid #FF8000; +} diff --git a/doc/common/style.css b/doc/common/style.css index 688a92b8..fb9f4788 100644 --- a/doc/common/style.css +++ b/doc/common/style.css @@ -1,3 +1,17 @@ +body +{ + background-color:#fff8f0; + width:100%; +} + +table +{ + background-color:#ffffff; + width:800px; + margin-left:auto; + margin-right:auto; +} + table.principale { background-color:#ff8000; @@ -112,7 +126,29 @@ img.menu-img div.paragraph { - text-indent:32px; + /*text-indent:32px; */ + text-align:justify; +} + +div.block +{ + padding-right: 16px; + padding-left: 16px; +} + +div.include +{ + color:#0000FF; +} + +spam.key +{ + color:#0000FF; +} + +div.comment +{ + color:#008000; } td.page diff --git a/doc/doxyfile b/doc/doxyfile index 5bdc0489..c8d424f0 100644 --- a/doc/doxyfile +++ b/doc/doxyfile @@ -1,4 +1,4 @@ -# Doxyfile 1.6.1 +# Doxyfile 1.6.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project @@ -31,7 +31,7 @@ PROJECT_NAME = GLM # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = "Version 0.8.4" +PROJECT_NUMBER = "Version 0.9.A.1" # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -397,6 +397,12 @@ HIDE_SCOPE_NAMES = YES SHOW_INCLUDE_FILES = NO +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. @@ -584,7 +590,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = ../../include/glm +INPUT = ../glm # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -810,6 +816,12 @@ HTML_FOOTER = HTML_STYLESHEET = +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = NO + # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. @@ -911,7 +923,7 @@ QCH_FILE = # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace -QHP_NAMESPACE = +QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see @@ -943,6 +955,23 @@ QHP_SECT_FILTER_ATTRS = QHG_LOCATION = +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. @@ -983,15 +1012,26 @@ TREEVIEW_WIDTH = 250 FORMULA_FONTSIZE = 10 -# When the SEARCHENGINE tag is enable doxygen will generate a search box +# When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) -# there is already a search function so this one should typically -# be disabled. +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = NO +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvances is that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- @@ -1008,7 +1048,10 @@ GENERATE_LATEX = NO LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. LATEX_CMD_NAME = latex diff --git a/doc/glm-manual.doc b/doc/glm-manual.doc new file mode 100644 index 00000000..40f6a54f Binary files /dev/null and b/doc/glm-manual.doc differ diff --git a/doc/glm-manual.pdf b/doc/glm-manual.pdf index fe02e167..a23a28b4 100644 Binary files a/doc/glm-manual.pdf and b/doc/glm-manual.pdf differ diff --git a/doc/goodies/logo1024x0640.png b/doc/goodies/logo1024x0640.png new file mode 100644 index 00000000..5d059de3 Binary files /dev/null and b/doc/goodies/logo1024x0640.png differ diff --git a/doc/goodies/logo1280x0800.png b/doc/goodies/logo1280x0800.png new file mode 100644 index 00000000..8f2dacde Binary files /dev/null and b/doc/goodies/logo1280x0800.png differ diff --git a/doc/goodies/logo1600x1000.png b/doc/goodies/logo1600x1000.png new file mode 100644 index 00000000..34207cda Binary files /dev/null and b/doc/goodies/logo1600x1000.png differ diff --git a/doc/goodies/logo1920x1200.png b/doc/goodies/logo1920x1200.png new file mode 100644 index 00000000..3e50912a Binary files /dev/null and b/doc/goodies/logo1920x1200.png differ diff --git a/doc/goodies/logo2560x1600.png b/doc/goodies/logo2560x1600.png new file mode 100644 index 00000000..a4870c37 Binary files /dev/null and b/doc/goodies/logo2560x1600.png differ diff --git a/doc/goodies/tenby-five.otf b/doc/goodies/tenby-five.otf new file mode 100644 index 00000000..454b9658 Binary files /dev/null and b/doc/goodies/tenby-five.otf differ diff --git a/doc/image/0029-mini.jpg b/doc/image/0029-mini.jpg new file mode 100644 index 00000000..8f062d36 Binary files /dev/null and b/doc/image/0029-mini.jpg differ diff --git a/doc/image/0029.jpg b/doc/image/0029.jpg new file mode 100644 index 00000000..c597c624 Binary files /dev/null and b/doc/image/0029.jpg differ diff --git a/doc/image/font-mini.png b/doc/image/font-mini.png new file mode 100644 index 00000000..8f350b18 Binary files /dev/null and b/doc/image/font-mini.png differ diff --git a/doc/image/font.png b/doc/image/font.png new file mode 100644 index 00000000..e36acdf5 Binary files /dev/null and b/doc/image/font.png differ diff --git a/doc/image/logo-mini.png b/doc/image/logo-mini.png new file mode 100644 index 00000000..80b5f9d4 Binary files /dev/null and b/doc/image/logo-mini.png differ diff --git a/doc/image/logo.png b/doc/image/logo.png new file mode 100644 index 00000000..2886a8e2 Binary files /dev/null and b/doc/image/logo.png differ diff --git a/doc/readme.txt b/doc/readme.txt new file mode 100644 index 00000000..7edadbd3 --- /dev/null +++ b/doc/readme.txt @@ -0,0 +1,248 @@ +============================= +GLM 0.9.A.1 final: 2010-02-09 +----------------------------- +- Removed deprecated features +- Internal redesign + +============================= +GLM 0.8.4.4 final: 2010-01-25 +----------------------------- +- Fixed warnings + +============================= +GLM 0.8.4.3 final: 2009-11-16 +----------------------------- +- Fixed Half float arithmetic +- Fixed setup defines + +============================= +GLM 0.8.4.2 final: 2009-10-19 +----------------------------- +- Fixed Half float adds + +============================= +GLM 0.8.4.1 final: 2009-10-05 +----------------------------- +- Updated documentation +- Fixed MacOS X build + +============================= +GLM 0.8.4.0 final: 2009-09-16 +----------------------------- +- Added GCC 4.4 and VC2010 support +- Added matrix optimizations + +============================= +GLM 0.8.3.5 final: 2009-08-11 +----------------------------- +- Fixed bugs + +============================= +GLM 0.8.3.4 final: 2009-08-10 +----------------------------- +- Updated GLM according GLSL 1.5 spec +- Fixed bugs + +============================= +GLM 0.8.3.3 final: 2009-06-25 +----------------------------- +- Fixed bugs + +============================= +GLM 0.8.3.2 final: 2009-06-04 +----------------------------- +- Added GLM_GTC_quaternion +- Added GLM_GTC_type_precision + +============================= +GLM 0.8.3.1 final: 2009-05-21 +----------------------------- +- Fixed old extension system. + +============================= +GLM 0.8.3.0 final: 2009-05-06 +----------------------------- +- Added stable extensions. +- Added new extension system. + +============================= +GLM 0.8.2.3 final: 2009-04-01 +----------------------------- +- Fixed bugs. + +============================= +GLM 0.8.2.2 final: 2009-02-24 +----------------------------- +- Fixed bugs. + +============================= +GLM 0.8.2.1 final: 2009-02-13 +----------------------------- +- Fixed bugs. + +============================= +GLM 0.8.2 final: 2009-01-21 +----------------------------- +- Fixed bugs. + +============================= +GLM 0.8.1 final: 2008-10-30 +----------------------------- +- Fixed bugs. + +============================= +GLM 0.8.0 final: 2008-10-23 +----------------------------- +- New method to use extension. + +============================= +GLM 0.8.0 beta3: 2008-10-10 +----------------------------- +- Added CMake support for GLM tests. + +============================= +GLM 0.8.0 beta2: 2008-10-04 +----------------------------- +- Improved half scalars and vectors support. + +============================= +GLM 0.8.0 beta1: 2008-09-26 +----------------------------- +- Improved GLSL conformance +- Added GLSL 1.30 support +- Improved API documentation + +============================= +GLM 0.7.6 final: 2008-08-08 +--------------------------- +- Improved C++ standard comformance +- Added Static assert for types checking + +=========================== +GLM 0.7.5 final: 2008-07-05 +--------------------------- +- Added build message system with Visual Studio +- Pedantic build with GCC + +=========================== +GLM 0.7.4 final: 2008-06-01 +--------------------------- +- Added external dependencies system. + +=========================== +GLM 0.7.3 final: 2008-05-24 +--------------------------- +- Fixed bugs +- Added new extension group + +=========================== +GLM 0.7.2 final: 2008-04-27 +--------------------------- +- Updated documentation +- Added preprocessor options + +=========================== +GLM 0.7.1 final: 2008-03-24 +--------------------------- +- Disabled half on GCC +- Fixed extensions + +=========================== +GLM 0.7.0 final: 2008-03-22 +--------------------------- +- Changed to MIT license +- Added new documentation + +=========================== +GLM 0.6.4 : 2007-12-10 +--------------------------- +- Fixed swizzle operators + +=========================== +GLM 0.6.3 : 2007-11-05 +--------------------------- +- Fixed type data accesses +- Fixed 3DSMax sdk conflict + +=========================== +GLM 0.6.2 : 2007-10-08 +--------------------------- +- Fixed extension + +=========================== +GLM 0.6.1 : 2007-10-07 +--------------------------- +- Fixed a namespace error +- Added extensions + +=========================== +GLM 0.6.0 : 2007-09-16 +--------------------------- +- Added new extension namespace mecanium +- Added Automatic compiler detection + +=========================== +GLM 0.5.1 : 2007-02-19 +--------------------------- +- Fixed swizzle operators + +=========================== +GLM 0.5.0 : 2007-01-06 +--------------------------- +- Upgrated to GLSL 1.2 +- Added swizzle operators +- Added setup settings + +=========================== +GLM 0.4.1 : 2006-05-22 +--------------------------- +- Added OpenGL examples + +=========================== +GLM 0.4.0 : 2006-05-17 +--------------------------- +- Added missing operators to vec* and mat* +- Added first GLSL 1.2 features +- Fixed windows.h before glm.h when windows.h required + +=========================== +GLM 0.3.2 : 2006-04-21 +--------------------------- +- Fixed texcoord components access. +- Fixed mat4 and imat4 division operators. + +=========================== +GLM 0.3.1 : 2006-03-28 +--------------------------- +- Added GCC 4.0 support under MacOS X. +- Added GCC 4.0 and 4.1 support under Linux. +- Added code optimisations. + +=========================== +GLM 0.3 : 2006-02-19 +--------------------------- +- Improved GLSL type conversion and construction compliance. +- Added experimental extensions. +- Added Doxygen Documentation. +- Added code optimisations. +- Fixed bugs. + +=========================== +GLM 0.2: 2005-05-05 +--------------------------- +- Improve adaptative from GLSL. +- Add experimental extensions based on OpenGL extension process. +- Fixe bugs. + +=========================== +GLM 0.1: 2005-02-21 +--------------------------- +- Add vec2, vec3, vec4 GLSL types +- Add ivec2, ivec3, ivec4 GLSL types +- Add bvec2, bvec3, bvec4 GLSL types +- Add mat2, mat3, mat4 GLSL types +- Add almost all functions + +=========================== +Christophe [Groove] Riccio, glm|AT|g-truc|DOT|net + diff --git a/doc/src/about.xsl b/doc/src/about.xsl new file mode 100644 index 00000000..6ca8854c --- /dev/null +++ b/doc/src/about.xsl @@ -0,0 +1,68 @@ + + + + + + + + + + OpenGL Mathematics : About + + + + + + + + + + + +
+
+ OpenGL Mathematics +
+ +
+ + + +
_________________
+
+ +
+ + +
+ + +
+
+ +
+
+ +
+
+ + + + + + + +
+
_________________
+
+
+
+ +
diff --git a/doc/src/bug.xsl b/doc/src/bug.xsl new file mode 100644 index 00000000..47f4057a --- /dev/null +++ b/doc/src/bug.xsl @@ -0,0 +1,116 @@ + + + + + + + + + + OpenGL Mathematics : Bugs + + + + + + +
+ OpenGL Mathematics +
+ + + + + +
+ +
+ + G-Truc Creation + + + +
+ + +
+
Bugs
+
+ +
+
+ + +
+ )
+
+
+ +
+
+ STATUE : , +
+
+
+
+ + +
+ : +
+
+ +
diff --git a/doc/src/changelog.xsl b/doc/src/changelog.xsl new file mode 100644 index 00000000..eb440b4b --- /dev/null +++ b/doc/src/changelog.xsl @@ -0,0 +1,55 @@ + + + + + + + + + + OpenGL Mathematics : Changelog + + + + + + + + + + + +
+
+ OpenGL Mathematics +
+ +
+ + +
+ + +
+ + +
+ :
+
+ +
_________________
+
+
+ + +
+ -
+
+
+ +
diff --git a/doc/src/code.xsl b/doc/src/code.xsl new file mode 100644 index 00000000..73a90189 --- /dev/null +++ b/doc/src/code.xsl @@ -0,0 +1,111 @@ + + + + + + + + + + OpenGL Mathematics: Code + + + + + + + + + + + +
+ +
OpenGL Mathematics
+ +
+ + +
+ + +
+ + +
+
+ | +
+
+ +
+
_________________
+
+
+
+ + +
diff --git a/doc/src/data.xml b/doc/src/data.xml new file mode 100644 index 00000000..70e42103 --- /dev/null +++ b/doc/src/data.xml @@ -0,0 +1,2302 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+
+ +
+
+ +
+
+ + Euler angles operation with specified rotation order + Cast to other toolkit (D3D, some engines) + Arrays + SIMD optimisations + Standard output stream + In place operations + + + GLSL 1.30, more templated code, better API documentation, use of CMake. + Hint. + First GTC extensions. + More tests. + Arrays. + SIMD optimizations. + In place operations. + + + bit rotation. + frexp + RGBE. + row matrices. + Optimize *mat4 inverse. + fixed numbers + row and column major matrices + + + + Promoted double types + + + Removed global inclusion. + Removed auto cast setup. + Removed compatibility setup. + Clean up and simplify setup.hpp + Fixed website links + + + Added missing inline. + Added common vecType for vector based types. + Updated copyright date. + Refactoring of type precision + GLM types are now more generic + Extract vec1 code + Reduced namespaces count + + + GLM 0.8.4.4 released. + + + Fixed warnings. + + + Added texcoord wrapping through GLM_IMG_wrap extension. + + + Reorganized SVN directory. + + + GLM 0.8.4.3 released. + + + Fixed half arithmetic. + + + Added scalars support for GLM_IMG_multiple. + + + Fixed setup defines. + + + Added GLM_IMG_multiple extensions and unit tests. + + + GLM 0.8.4.2 released. + + + Fixed half. + + + GLM 0.8.4.1 released. + + + Updated documentation. + + + Updated manual. + Added static assert implementation. + Removed unuse GLM_SWIZZLE_FUNC. + + + Some progress on fixing GLM for MacOSX comflics. + + + Fixed GLM_GTX_quaternion extension: cross and intermediate. + + + Fixed quaternion angle. + + + Updated documentation. + GLM 0.8.4.0 released. + + + Added Visual Studio 2010 support. + Fixed build on GCC. + Added GCC 4.4 support. + + + Added no initilization constructor to vec4. + + + Added no initilization constructor to mat4. + Updated GLM_GTC_matrix_transform: faster rotate. + + + Added GLM_GTX_matrix_operation: build diagonal matrix. + Updated GLM_GTC_matrix_transform: faster scaling. + + + Fixed transpose function for mat4x3. + Optimized translate function for mat4 matrix: ~184 cycles instead of ~592 cycles on Q6600. + + + Fixed OpenGL dependence. + Added OpenGL 3 dependence. + + + Fixed parameter definition and definition mismatch. + + + Fixed GLM_GTC_matrix_projection. + Updated GLM_GTX_transform: Added missing entry points. + GLM 0.8.3.5 released. + + + Move inverse function to core following GLSL 1.4 specification. + Move determinant function to core following GLSL 1.5 specification. + GLM 0.8.3.4 released. + + + Fixed GLM_GTX_matrix_query extension: Fixed row_size and col_size() calls. + Fixed GLM_GTX_matrix_access extension: Fixed row_size calls. + + + Fixed GLM_GTX_string_cast extension: Build on GCC 4. + Fixed GLM_GTC_quaternion extension: rotate function build. + + + Fixed GLM_GTC_matrix_transform extension: Fixed matrix operation order; like OpenGL instead of like Direct3D. + GLM 0.8.3.3 released. + + + Fixed GLM_GTX_rotate_vector extension: Fixed rotate function. + + + Fixed matrix external operators. + + + Added GLM_GTC_type_precision extension. + GLM 0.8.3.2 released. + + + Fixed GLM_GTC_matrix_transform: Fixed mat4 inverse function. + + + Added GLM_GTC_quaternion extension. + Updated GLM_GTC_quaternion extension. + Fixed GLM_GTC_matrix_transform extension. + + + GLM 0.8.3.1 released. + + + Updated GLM_GTX_bit extension: Added lowestBit functions. + Fixed old extention inclusion method. + + + Updated sse mat4 implementation. + + + Updated GLM_GTX_bit extension: Added bitRevert, bitRotateRight and bitRotateLeft functions. + + + Added intrinsic like functions for mat4 product and inverse. + + + Added intrinsic like functions for mat4 and vec4 products. + + + Fixed GLM_GTX_type_ptr extension. + GLM 0.8.3.0 released. + + + Fixed GLM_GTC_matrix_projection: glm::project build. + + + Added new extensions inclusion system. + + + Fixed GLM_GTX_determinant extension. + Reorganized extensions. + Removed GLM_GTX_vector_comp_mult and GLM_GTX_mat4x3 extensions. + Renamed .h files to .hpp. + + + Added GLM_GTC_half_float. + + + Fixed GLM_GTX_perpendicular extension. + Fixed GLM_GTX_matrix_projection extension. + Fixed GLM_GTX_transform2 extension. + + + Added GLM_GTC_matrix_operation. + Added GLM_GTC_matrix_transform. + Added GLM_GTC_matrix_projection. + Added GLM_GTC_double_float. + + + Fixed bug 2774738. + Fixed bug 2774015. + + + GLM 0.8.2.3 released. + + + Updaded mix function: Makes it more flexible, types wise. + + + Fixed GLM_GTX_perpendicular and GLM_GTX_projection. + Added GLM_GTX_radial_gradient extensions. + + + Fixed GCC 4.3 pedantic build. + GLM 0.8.2.2 released. + + + Removed all deprecated ARB conventions. + + + Fixed highp_int_t and highp_uint_t with Linux 64. + Fixed GCC 4.3 'extra ;' with pedentic build. + + + Fixed build. + GLM 0.8.2.1 released. + + + Fixed build. + Added extensions build test. + + + GLM 0.8.2 released. + + + Fixed GLM_GTX_intersect: intersectRayTriangle. + + + Fixed vectors access operators. + Fixed unresolved with quaternions. + + + Fixed GLM_GTX_norm: Include issue. + + + Fixed left value swizzle operators. + + + Fixed GLM_GTX intersect extension: intersectRayTriangleGTX with GCC. + Typo. + + + Fixed GLM_GTX inverse_transpose extension. + + + Updated quaternion implementation. + + + Added GLM_GTX_raw_data extension. + + + Updated GLM_GTX_bit extension: Added mask function. + + + Updated GLM_GTX_bit extension: Added extractField function. + Fixed STATIC_ASSERT with 64bits integers. + + + GLM 0.8.1 released. + + + Fixed mix function with boolean parameter. + Fixed value_size issue. + + + Fixed GLM_GTX_component_wise extension. + Added GLM_GTX_color_space_YCoCg extension. + + + Added GLM_GTX_comparison extension: Defined comparison operators for vectors. + + + Added GLM_GTX_log_base extension. + + + Fixed 64 bits integers with GCC. + Deleted deprecated half number setup options. + Updated GLM_GTX_number_precision: Clean up and added missing type definitions. + Updated GLM_GTX_color_cast: Clean up and fixes. + + + Updated manuel and documentation. + GLM 0.8.0 final released. + + + Fixed glm::size_t possible collisions with std::size_t. glm::size_t is now named glm::sizeType. + Updated GLM_VIRTREV_address extension: Added none const fonctions. + Updated GLM_GTX_double_float extension: Typo. + Added new API to use extension. + + + Added logos in varius resolutions. + + + Updated website. + Added website builder. + + + Updated GLM_GTX_number_precision: No more warning with type size tests. + Fixed none consistent size_t. + + + Updated website. + + + Fixed build. + Updated manual. + GLM 0.8.0 beta3 released. + + + Added GLM_GTX_reciprocal extension: Define sec, csc, cot, asec, acsc, acot, sech, csch, coth, asech, acsch and acoth functions. + + + Updated GLM_GTX_euler_angles extension: Added functions to build rotation matrices. + + + Fixed GLM_GTX_color_space: Fixed conflits with swizzle operators. + Fixed virtrev.h, didn't build. + Fixed genType build. + Fixed GLM_GTX_compatibility build. + Added GLM_VIRTREV_address: Get the address of internal vector or matrix contents. + Fixed code typo and clean up. + + + Added genType class. For long term base class for all types though template specialization. + Updated project directory. + Added CMakeFile in test directory. + Fixed code typo and clean up. + Fixed GLM_GTX_string_cast: Missing some matrix definitions, some wrong behaviours with matrices. + + + Added glm::sizeType type which is used to defined size of all vectors and matrices. Defined as std::size_t. + row_size, col_size and is_matrix are now functions. + Fixed use inline on *mat4 function declaration. + Deleted auto cast from *mat4x3. + Fixed missing ++ -- and - operators to some matrix types. + Fixed typo. + + + GLM 0.8.0 beta2 released. + + + value_size and is_vector are now functions. + + + Added GLM_USE_ANONYMOUS_UNION: To use anonymous union to provide multiple component names access for class valType. Visual C++ only. + Removed noise function from documentation. + + + Fixed build with GCC. + Updated manual. + + + Updated GLM_GTX_bit implementation. + Added GLM_USE_ONLY_XYZW to disable multiple component names. + Updated GLM_GTX_euler_angles extension: added yawPitchRoll function. + + + Fixed half vector build. + Updated GLM_GTX_vector_angle: Added orientedAngleFromRef function. + Deprecated GLM_GTX_mul extension. Features moved in GLM_GTX_verbose_operator. + Updated GLM_GTX_verbose_operator: Added mad function. + + + Fixed missing inline in tvec3 and tvec4 definisions. + New implementation of hvec3 thought specialisation of tvec3 template. + New implementation of hvec4 thought specialisation of tvec4 template. + Fixed tvec4 operators than where applied just on 3 components. + + + Added build option for build that support anonymous structure. + Fixed missing inline in tvec2 definision. + New implementation of hvec2 thought specialisation of tvec2 template. + + + Updated documentation. + GLM 0.8.0 beta1 released. + + + Fixed static asserts within vector and matrix types. + Updated mix function implementation, support for boolean vectors. + + + Fixed static asserts. + Added some asserts. + Updated matrices operator[]. + + + Added GLM_VIRTREV_equal_operator: Operators that compare vectors. + Fixed build errors from static asserts. + + + Fixed build errors with GCC. + Fixed func_trigonometric.h encoding. + + + Deleted GLM_GTX_INCLUDED. + Fixed build errors. + Fixed GLM_GTX_random: Bad assert definition. + + + Updated manual. + Updated swizzle operators with swizzle function. + Added modf definition. + + + Added namespaces to sort type and function in the API documentation. + Deleted some documentations from {__}*GTX types and functions from extensions. + Updated vectors and matrices documentation. + Updated scalars and precisions documentation. + Fixed some vectors and matrices declaration missing in some cases. + Updated overall documentation. + + + Included all types in type namespace. + + + Added type namespace in glm namespace for documentation purpose. + + + Added modf definition for vec2, vec3 and vec4. + Updated static assert to exponential, geometric, matrix, noise, trigonometric and vector relational functions. + Added GLM_GTC_matrix_transformation extensions: API and translate, rotate and scale definisions. + Deprecated GLM_GTX_gpu_shader4, GLM_GTX_hyperbolic, GLM_GTX_flexible_mix, GLM_GTX_round. + Added definition of mix with last parameter being booleans. + Added hint classes. + Updated GLM_GTX_integer, GLM_GTX_unsigned_int, GLM_GTX_half and GLM_GTX_double_float extensions. + + + Added trait code (class type) to detect bool, float, int and uint numbers. + Updated static assert to common functions. + + + Updated noise function definitions... Still unsure for staying in GLM 0.8.0. + + + Updated overall documentation, doxygen documentation. + + + Updated documentation and implementation of all matrix functions. + Added declaration of main functions for each function group namespace. + Updated documentation and API of all noise functions... Should be deleted becose of bad implementation? + + + Updated documentation and implementation of all vector relational functions. + Added transpose_type typedef to all matrix types. + Added is_matrix static constantes to all matrix types for static assert usage. + Added is_vector static constantes to all vector types for static assert usage. + + + Updated documentation and implementation of all geometric functions. + + + Updated documentation and implementation of all exponential functions. + + + Added isinf and isnan GLSL 1.3 functions. + Updated common functions code, mostly syntax. + Added trunc, round and roundEven GLSL 1.3 functions. + Added sinh, cosh, tanh, asinh, acosh and atanh GLSL 1.3 functions. + Updated documentation and implementation of all trigonometric functions. + + + Added bool_type implementation detail to vector types. + + + Added API and documentation of all common functions. + + + Updated GLM_GTX_extensions: Define operator* as a cross product. Still in WIP... + + + Updated *vec2 and *vec3 with precision types missed and documentation. + + + Fixed 2085925 bug: rotateGTX didn't use it quaternion parameter. + + + Added test files. + Updated *vec4 with precision types missed and documentation. + + + Renamed implementation files. + Updated type pre-declarations. + + + Fixed GLM_GTX_matrix_projection extension: frustum function gave a wrong result. + + + Updated matrix types functions and extensions according new vectors types. + + + Added new vector types implementation. + + + Added support for new GLSL 1.30 precision model. + + + Added GLSL 1.30.08 unsigned int types support + + + Added detail::vec1 type. + Added detail::desc for types description and higher templatisation. + + + Started work on GLM 0.8.x based on GLSL 1.3 specification. + Visual Studio .NET 2003 (7.1) is now deprecated. + GLM_FORCE_HALF_COMPATIBILITY is now deprecated. + GLM_AUTO_CAST is now deprecated. + + + Updated GLM_GTX_fast_square_root implementation: Updated fastInverseSqrt + + + Updated documentation. + GLM 0.7.6 released. + + + gl_svec* (for GLshort) added in GLM_virtrev_gl extension. + Updated detail implementation of vector types. + Make Visual C++ build with Visual C++ extensions disabled. + Rename "not" to "not_" for compatibility. + Fixed GLM_GTX_fast_square_root build. + + + Fixed GLM_GTX_component_wise extension. + + + Updated mix functions for optimization purpose. + Fixed mix functions static assert. + Updated test files. + Updated GLM_GTX_statistics_operation. + + + Fixed GLM_GTX_bit extension: isPowerOfTwoGTX works for signed int too. + Updated GLM_GTX_norm extension: Added distance2, l2norm and lxNorm functions. + Added some boost static assert. + + + Added GLM_GTX_std_based_type: Types based on C++ conventions. + Added files for extension tests. + + + Fixed GLM_GTX_fast_square_root: Updated fastDistance. + + + Fixed GLM_GTX_fast_square_root: Wrong const and updated fastLenght. + Optimized mix core function + + + Fixed GLM_GTX_epsilon: Wrong function definitions for y, z and w components. + + + Fixed GLM_GTX_flexible: Flexible with scalar only failed. + Fixed GLM_GTX_quaternion: One rotate overloaded function undefined. + + + Some fixes on GLM_GTX_intersect extension. + + + GLM 0.7.5 released. + + + Updated documentation. + + + Updated message system. + + + Added new message system. + + + Fixed GLM_GTX_normal extension. + + + Updated GLM_GTX_unsigned_int extension. (New typedef extensions) + + + Added new precompiler system. + + + Increase C++ conformance. + + + Fixed build errors. + GLM 0.7.4 released. + + + Updated external dependencies system. + Updated manual. + Fixed GLM_GTX_random extension: Fixed build with GCC. + Fixed GLM_GTX_string_cast extension: Fixed build with GCC 3.4 due to GCC anonymuous namespace bug. + + + Fixed GLM_GTX_transform2 extension: scaleBias didn't built. + + + Added GLM_VIRTREV_xstream extension: XML output for GLM types. + Added external library system + + + Updated GLM_GTX_string_cast extension: Support of non-square matrices. + GLM 0.7.3 released. + + + Fixed mat2 product. + + + Fixed GLM_GTX_transform2 dependencies. + + + Added GLM_VIRTREV_gl extension: Vector and matrix integration with OpenGL. + + + Updated GLM_GTX_number_precision extension: Added uint type. + Added GLM_GTX_string_cast extension: Create formated string from GLM type instances. + Updated GLM_GTX_transform2: added scaleBias matrix build + + + GLM 0.7.2 released. + + + Added GLM_AUTO_CAST setup option. + Updated documentation + + + Updated GLM_GTX_inverse, added affine inverse functions for fast matrix inverts. + Updated overall documentation + Added trait typedef to all GLM data types + + + Updated GLM_GTX_compatibility documentation. + Fixed GLM_GTX_random, gauss functions didn't build. + + + Added few SSE code. + Fixed matrix projections. + + + Added GLM_SWIZZLE_FUNC swizzle option. + + + Updated GLM_GTX_euler_angles documentation. + + + Updated documentation. + + + Fixed GLM_GTX_associated_min_max build on GCC. + Updated GLM_GTX_matrix_projection. + GLM 0.7.1 released. + + + GLM 0.7.0 released. + + + Updated manual. + + + Updated documentation. + Added GLM_GTX_associated_min_max extension. + + + Fixed not function with GCC. + + + Fixed interger pow function for the case of a null power. + + + Fixed mat4x2 and mat4x3 GCC build. + Updated documentation. + Reseted glmsetup.h to default values. + + + Fixed missing xvec4 constructor with bool argument definition. + Fixed namespace collision in quaternion inverse function. + Fixed swizzle operators involved in operations. + Change license from GNU LGPL to MIT. + + + Fixed missing xvec4 ++ and -- operator definition. + + + Move some implementation details into detail namespace. + + + Fixed cast between matrices of different sizes. + + + Fixed matNxM type cast to other matNxM type. + + + Fixed GLM_GTX_matrix_projection extension. + + + GLM 0.6.4 released. + + + Fixed swizzle operators. + + + Fixed GLM_GTX_matrix_selection extension. + + + Updated GLM_GTX_color_space extension. Added luminosity function. + + + GLM 0.6.3 released. + + + Fixed 3DSMax SDK conflict with GLM. + + + Updated GLM_GTX_quaternion. Added sqrt function. + + + Updated GLM_GTX_random extension. + Updated GLM_GTX_half extension. + + + Fixed matrices operator const T*() const. + + + Fixed GLM_GTX_normalize_dot extension. + GLM 0.6.2 released. + + + GLM 0.6.1 released. + + + Added GLM_GTX_normalize_dot extension: Faster way to normalize parameters before a dot product + + + Fixed namespace error on GLM_GTX_matx extension + + + Added GLM_GTX_flexible_mix extension: mix function can take different types parameters + + + Updated documentation. + GLM 0.6.0 released. + + + Added GLM_SINGLE_COMP_NAME to fixed multiple component names on half types with GCC. + + + Added #define GLM_GTX_INCLUDED to automatically include all GTX extensions in the language. + + + Updated extensions documentation. + Updated GLM_GTX_quaternion extension: squad, euler angles conversions + + + Updated GLM_GTX_compatibility extension: Added isfinite isinf, and isnan. + + + Updated GLM_GTX_random extension: Gauss distribution, spherical distribution, linear distribution. + + + Fixed namespace issues with Visual Studio 8.0 SP1. + + + Updated GLM_GTX_gpu_shader4 extension: Add bit operators. + Updated GLM_GTX_integer extension: Delete some code duplications. + Added GLM_GTX_unsigned_int extension. + + + Fixed namespace issues with Visual Studio 8.0 SP1. + Added new namespace management for extensions. + Added automatic compiler ditection, no more compiler setup. + + + Updated GLM_GTX_number_precision extension. + Updated usertype.dat for Visual Studio. + Updated GLM_GTX_random extension. + + + Added GLM_GTX_color_cast extension. + Updated GLM_GTX_quaternion extension. + + + Added GLM_GTX_verbose_operator extension. + + + Added GLM_GTX_component_wise extension. + + + Added GLM_GTX_number_precision extension. + + + Updated GLM_GTX_bit extension. + + + Updated GLM_GTX_bit extension. + + + Updated GLM_GTX_fast_square_root extension. + Updated GLM_GTX_fast_trigonometry extension. + Updated GLM_GTX_fast_exponential extension. + Added GLM_GTX_mul extension. + Fixed GLM_GTX_epsilon extension. + + + Added GLM_GTX_mixed_product extension. + Added GLM_GTX_intersect extension. + Updated GLM_GTX_matrix_access extension. + + + Added bits operators in comment for vec2, vec3 and vec4. + Fixed friendly conformance to GLM_GTX_double. + + + Fixed size_type errors. + + + Updated GLM_GTX_quaternion extension. + Added GLM_GTX_bit extension. + Added value_type, size_type and value_size typedefs and value to all types. + + + Updated GLM_GTX_compatibility extension. + Fixed GLM_GTX_color_space extension. + + + Added GLM_GTX_polar_coordinates extension. + + + Added GLM_GTX_vector_query extension. + Added GLM_GTX_matrix_query extension. + + + Fixed square matrices division operators. + + + Added GLM_GTX_mat_mn extension. + + + Updated GLM_GTX_color_space extension. + + + Added GLM_GTX_vecx extension. + Added GLM_GTX_matx extension. + + + GLM 0.5.1 released. + + + Updated Visual Studio projects. + + + Updated GLM_GTX_compatibility extension. + + + Added GLM_GTX_hyperbolic extension. + Added GLM_GTX_spline extension. + Fixed unProject and project functions from GLM_GTX_matrix_projection extension. + + + Added GLM_GTX_compatibility extension. + + + Add some undefined write swizzle operators from bvec* + Fixed vectors component access operators[] from bvec* + Fixed bvec* equal operators with write swizzle operators + Fixed various vector constructors + Updated swizzle operators, _xvec* and _bvec* share the same code + + + Add some undefined write swizzle operators from xvec* + Fixed some write operator considered as read operator from xvec* + Fixed vectors component access operators[] from xvec* + Fixed not function setup according compilers + + + Added user manual. + GLM 0.5.0 released. + + + Updated overloaded functions of matrixCompMult. + Added transpose and outerProduct functions in the GLM core. + + + Fixed GLM_GTX_rotate_vector extension. + + + Fixed GLM_GTX_interger extension conformance. + + + Improved "friendly conformance" support. + Improved quaternion implementation. + + + Updated setup options. + + + Added new setup options for swizzle operators. + + + Updated GLM_GTX_integer extension. + + + Added GLM_GTX_gpu_shader4 extension. + Added extension errors management. + Added compilers management. + Added conformance management. + + + Added GLM_GTX_rotate_vector extension. + + + Updated product operators to non-squared matrices + + + Updated tmat4x3 and tmat3x4 types + Added tmat2x3, tmat3x2, tmat2x4 and tmat4x2 + Clarified ToDo comments for missing operators with non-squared matrices types + + + Added GLSL 1.2 mat4x3 and mat3x4 + Added missing declaration of mat* operators + Added _xmat* with _xvec* division operators + + + Added GLSL 1.2 non-squared matrices files + + + fastCos and fastSin are defined between -2 pi and 2 pi + + + Added swizzle operators for xvec4 + Added swizzle operators for bvec4 + + + Added swizzle operators for bvec2> + Implicit conversion from *ref* to *vec* + Added swizzles operators for xvec3 + Added swizzles operators for bvec3 + + + Separated _*ref* types in different files + Added _bref* types + Updated _xref* types + + + Added operators for tvec2 swizzles operators management + + + GLM 0.4.1 released. + + + Add 4 examples of use with OpenGL under Windows and Linux + + + GLM 0.4.0 released. + + + It's not anymore required to include windows.h before glm.h whether windows.h is required + + + Improved tvec3 conversions + Improved tvec2 conversions + Added left hand side vec2 swizzle operators + Improved bvec4 conversions + Improved bvec3 conversions + Improved bvec2 conversions + + + Added _xref* structures for swizzle operators implementation + Seperated bvec* and xvec* types in different files + Updated core functions code + + + Fixed texture coordinate components access + Added GLM_GTX_mul extension. + Added GLM_GTX_inertia extension. + GLM 0.3.2 released. + + + Added right hand side vec2 swizzle operators + Improved tvec4 conversions + + + Updated GLM_GTX_quaterion, added log and exp functions + Added GLM_GTX_matrix_major_storage extension. + + + Reorganize types code + Complete addition and subtraction vertrices operators + + + Complete addition and subtraction matrices operators + Optimize increment and decrement operators + + + Fixed tmat4x4 division + + + Added GLM_GTX_outer_product extension. + + + GLM 0.3.1 released. + + + Added Linux support under GCC 4.0 and 4.1. + + + Optimisation of increment and decrement operators. + + + Added MacOS X support under GCC 4.0. + + + Added GLM_GTX_extend extension to wishlist in position 27. + Added GLM_GTX_euler_angles extension to wishlist in position 28. + Added Doxygen documentation. + GLM 0.3.0 released. + + + Optimized GLM_GTX_integer implementation. + + + Deleted explicit conversions from array to type to prevent unespected conversions. + + + Fixed bugs + Improved types conversions. + Added GLM_GTX_vector_access extension to wishlist in position 25. + Added GLM_GTX_random extension to wishlist in position 26. + + + Fixed bugs + + + Updated GLM_GTX_integer extension. + + + Added GLM_GTX_fast_exponential extension to wishlist in position 24. + + + Optimized _xvec* copy. + + + Added GLM_GTX_fast_trigonometry extension to wishlist in position 23. + Added factorial function to GLM_GTX_integer extension. + + + Added GLM_GTX_half extension to wishlist in position 21. + Optimized normalize function. + Global optimisation for debugging time + Added GLM_GTX_integer extension to wishlist in position 18. + Optimized clamp function. + + + Added GLM_GTX_fast_square_root extension to wishlist in position 19. + Added GLM_GTX_inverse_transpose extension to wishlist in position 20. + Fixed missing of vec4 * mat4 operator. + + + Reorganization of extensions. + Fixed vec2 constructeur bug. + + + Updated GLM_GTX_length2 extension. + Renamed GLM_GTX_length2 extension to GLM_GTX_norm. + + + Fixed GLM_GTX_quaterion implémentation bugs. + + + Updated GLM_GTX_projection extension. + + + Added GLM_GTX_transform2 extension to wishlist in position 18. + + + Updated for GCC 4.0. + + + Fixed normalization bug with LookAtGTX. + + + Add array conversion to GLM types. + + + Added GL_GTX_euler_angles extension to wishlist in position 17. + + + Added GLM_GTX_matrix_selection extension to wishlist in position 16. + Added GLM_GTX_matrix_selection extension support. + + + Updated GLM_GTX_projection extension to wishlist in position 15. + + + Added GLM_GTX_projection extension to wishlist in position 15. + + + Fixed bug from rotateGTX with quaternion. + Fixed matrix vector product. + Add vector usage to describe transformations axis. + + + Added GLM_GTX_quaternion extension support + GLM 0.2 released. + + + Add GLM_GTX_transform 2D transform support + + + Add GLM_GTX_transform 3D transform support + + + Updated GLM_GTX_transform extension to wishlist in position 2 + + + Added GLM_GTX_vector_comp_mult extension to whislist in position 14 + Added GLM_GTX_vector_comp_mult extension support + + + Added GLM_GTX_color_space extension to whislist in position 13 + Added GLM_GTX_color_space extension support + Added GLM_GTX_double extension support + + + Overload of GLSL functions used by extentions instead of create new functions + + + Added GLM_GTX_optimum_pow extension to whislist in position 11 + Added GLM_GTX_double extension to wishlist in position 12 + + + Updated GLM_GTX_matrix_cross_product extension to wishlist in position 8 + Added GLM_GTX_matrix_cross_product extension support + Added GLM_GTX_projection extension to whislist in position 9 + Added GLM_GTX_perpendicular extension to wishlist in position 10 + Added GLM_GTX_projection extension support + Added GLM_GTX_perpendicular extension support + Changed extensions organisation + + + Added *vec* by *mat* product + Updated GLM_GTX_determinant extension to wishlist in position 4 + Updated GLM_GTX_inverse extension to wishlist in position 5 + Updated GLM_GTX_length2 extension to wishlist in position 6 + Updated GLM_GTX_orthonormalize extension to wishlist in position 7 + Added GLM_GTX_determinant extension support + Added GLM_GTX_inverse extension support + Added GLM_GTX_length2 extension support + Added GLM_GTX_orthonormalize extension support + + + Added bug #7 : Vector constructor non conform + Updated issue #13 : Only ARB can allow extensions adding new operators + + + Added GLM_GTX_orthonormalize extension to wishlist in position 7 + Added GLM_GTX_matrix_cross_product extension to wishlist in position 8 + Updated issue #10 : Using template functions members + Updated *vec* types following issue #10 guidance + + + Fixed bug #2 with '#error' + + + Updated issue #4 + + + Updated issue #13 + Updated issue #8 + Updated issue #6 + Updated issue #4 + + + Bugs #2 and #5 are now one + Updated / operator for vec* types with support of the divisibility of two vectors, and the divisibility term to term + + + Updated GLM_GTX_transpose extension to wishlist in position 8 + Added GLM_GTX_transpose extension support + Fixed mat* types constructor scalar-parameted + + + Fixed mat* types product by a scalar + + + Updated function 'not' + Defined identificators following compilers + Added GLM_GTX_length2 extension to wishlist in position 6 + Optimized mat3 type divide operator + + + GLM 0.1 released + + + Updated issue #4 + Updated issue #6 + Updated issue #9 + Updated issue #12 + Updated issue #13 + Updated issues ordering + + + Updated vec* types + operator. Can now add a vector and a scalar, term by term + Updated vec* types - operator. Can now minus a vector and a scalar, term by term + Updated vec* types * operator. Can now multiply a vector and a scalar, term by term + Deleted issue #11, which was erroneous + + + Deleted from wishlist extension #6 : refract function is defined by version 1.10.59 from GLSL specs + Updated reflect function tests + Added fucntion reflect with its tests + Using typename 'genType' for functions templates + Added bug #5 + Updated function sqrt + Added function log with its tests + Added function exp with its tests + Added function log2 with its tests + Updated cross function + Updated bvec* types data implementation + Added bug #6 + + + Updated issue #13 + Converted text files into XML + Modified files hierarchy + + + Updated clamp function + Added function noise1 with its tests + Added function noise2 with its tests + Added function noise3 with its tests + Added function noise4 with its tests + + + Enhanced mat4 type division operator + Added function sqrt with its tests + Added function inversesqrt with its tests + Added function exp2 with its tests + Added function log2 with its tests + + + Modified *vec* types constructors implementation, chooses initialisation instead of affectation + Added function reflect with its tests + Updated tan function + Fixed mat4 type * operator + + + Added GLM_GTX_refract extension to wishlist in position 5. + + + Added default constructor for mat* types + + + Added mat2 and vec2 type * operator + Added mat3 and vec3 type * operator + Added mat4 and vec4 type * operator + + + Added GLM_GTX_transpose extension to wishlist in position 3 + Added GLM_GTX_determinant extension to wishlist in position 4 + Added GLM_GTX_inverse extension to wishlist in position 5 + Added / operator for two mat3 types + Enhanced *vec* types conception + Enhanced *mat* types conception + + + Updated bug #3 + Updated issue #10 + Added function matrixCompMult with its tests + Updated mat* type constant access operators + Added bug #4 : Conversion problem between two different *vec* types + + + Added bug #1 : Inability to select multiple components + Added bug #2 : Some *vec* types conversions are not available + Added bug #3 : 'not' is a C++ ISO keyword + Added * operator for two mat3 types + Added * operator for two mat4 types + Updated mat* types + Updated GLM_GTX_quaternion extension to wishlist in position 1 + Updated GLM_GTX_transform extension to wishlist in position 2 + + + Added mat2 type + Added * operator for two mat2 types + Added issue #14 + Added issue #15 + Added mat3 type + Added mat4 type + + + Added function mix with its tests + Added function step with its tests + Added function smoothstep with its tests + Updated issue #10 + Updated issue #12 + Updated issue #8 + Added type bvec4 forgotten declaration + Added function lessThan with its tests + Added function lessThanEqual with its tests + Added function greaterThan with its tests + Added function greaterThanEqual with its tests + Added function equal with its tests + Added function notEqual with its tests + Added function any with its tests + Added function all with its tests + Added function not with its tests + + + Added function fract with its tests + Added function mod with its tests + Added function clamp with its tests + + + Added function mod with its tests + Added function abs with its tests + Added function sign with its tests + Added function floor with its tests + Added function ceil with its tests + Added function min with its tests + Added function max with its tests + + + Updated issue #13 + Added temporary namespace called 'glm' + Added function pow with its tests + + + Updated sin function tests + Enhanced trigonometrics functions + Enhanced geometric functions + + + Added xvec* type constructor taking a single scalar as parameter. + Added xvec* into xvec3 type conversion + Added xvec* into xvec4 type conversion + Added xvec* into bvec2 type conversion + Added xvec* into bvec3 type conversion + Added xvec* into bvec4 type conversion + Added function sin with its tests + Added function cos with its tests + Added function tan with its tests + Added function asin with its tests + Added function acos with its tests + Added function atan with its tests + Added issue #13 + + + Added function radians with its tests + Added function degrees with its tests + Added issue #9 + + + Separated *vec* types definition from declaration + Added xvec* into xvec2 type conversion + Updated issue #11 + Added issue #12 + + + Using 'union' for multiple access to *vec* types components + Added issue #11 + Deleted __*vec1GT following issue #11 guidance + Closed issue #2 + + + Added function normalize with its tests + Added function faceforward with its tests + + + Added function cross with its tests + Added a function that can determine *vec* types size, and write beyond GLSL 1.051 specs + Added function lenght with its tests + Added function distance with its tests + Added function dot with its tests + Closed issue #1 + + + Renamed intern types _vec* into _xvec* + Separated _xvec* types data, operators and accesses + Added bvec2 type + Added __bvec1GT type beyond GLSL 1.051 specs + + + Added types vec2 and ivec2 + Added types vec3 and ivec3 + Added types vec4 and ivec4 + Added types __vec1GT and __ivec1GT, write beyond GLSL 1.051 specs + + + + + + + + Groove + + This update fixes some problem of Alpha 1 but also brings some improvements in case of errors when using GLM to provide more relevant messages. + + GLM 0.9.A.2 (zip, 1.3 MB) + GLM 0.9.A.2 (7z, 726 KB) + Full changelog + + + + Groove + + First step until a major release for GLM with this first alpha of GLM 0.9. + + + This version brings a large internal redesign to improve the library reliability and optimized some parts. + It removed the deprecated features and API which implies that GLM 0.9 isn't backward compatible. + + + For most users the build issues when upgrading to GLM 0.9 should be reduced especially if they follow the deprecation policy. + + + This release is still UNSTABLE and not recommanded for commertial products. + + GLM 0.9.A.1 (zip, 950 KB) + GLM 0.9.A.1 (7z, 391 KB) + Full changelog + + + + Groove + + This update just removes some warnings + + + By the way, if you have questions about GLM, a good place for those is the OpenGL.org Toolkits forum. + + GLM 0.8.4.4 (zip, 1.1 MB) + GLM 0.8.4.4 (7z, 479 KB) + Full changelog + + + + Groove + + This version fixed half scalars and half vectors arithmetics. + This is a really slow practice that should be avoid. + Half floating point value should be use only to store GPU data. + GPUs have native support for half values, not x86 CPUs. + + GLM 0.8.4.3 (zip, 1.1 MB) + GLM 0.8.4.3 (7z, 463 KB) + Full changelog + + + + Groove + + This version is a really minor updates, fixing single issue with half float types. + + GLM 0.8.4.2 (zip, 1.1 MB) + GLM 0.8.4.2 (7z, 443 KB) + Full changelog + + + + Groove + + This version fixes few bugs and provides an major update of the manual thanks to Damian Trebilco. + + GLM 0.8.4.1 (zip, 1.1 MB) + GLM 0.8.4.1 (7z, 443 KB) + Full changelog + + + + Groove + + This new version mainly adds support for Visual Studio 2010 and GCC 4.4. It also provides various code optimization, bug fixes and an extension. + + GLM 0.8.4.0 (zip, 1.1 MB) + GLM 0.8.4.0 (7z, 439 KB) + Full changelog + + + + Groove + + Fixed extension bugs introduced by core update. + + GLM 0.8.3.5 (zip, 971 KB) + GLM 0.8.3.5 (7z, 405 KB) + Full changelog + + + + Groove + + Fixed varius bugs. Move determinant fonction to core following GLSL 1.5 specification. + + GLM 0.8.3.4 (zip, 971 KB) + GLM 0.8.3.4 (7z, 405 KB) + Full changelog + + + + Groove + + Fixed varius bugs. + + GLM 0.8.3.3 (zip, 971 KB) + GLM 0.8.3.3 (7z, 405 KB) + Full changelog + + + + Groove + + Add GLM_GTC_quaternion and GLM_GTC_type_precision extensions both subset of GLM_GTX_quaternion and GLM_GTX_number_precision + + GLM 0.8.3.2 (zip, 971 KB) + GLM 0.8.3.2 (7z, 405 KB) + Full changelog + + + + Groove + + The old way to use extensions have been fixed and GLM_GTX_bit extension gets updated with more functions to manipulate bit fields. + + GLM 0.8.3.1 (zip, 954 KB) + GLM 0.8.3.1 (7z, 402 KB) + Full changelog + + + + Groove + + This version brings to main changed: Stable extensions and a new extension system. + + + The first stable GLM extensions are: GLM_GTC_double_float and GLM_GTC_half_float for higher and lower vectors and matrices floating point precision. GLM_GTC_matrix_operation provides determinant and inverse matrix calculation. GLM_GTC_matrix_transform allows to build scale, rotate and translate matrices and GLM_GTC_matrix_projection provides varius functions to build projection matrices. Few stable extensions yet but the number is going to grow with the next release! + + + Both GLM 0.8.2.x extensions use method are deprecated (but still working) and replace by a new one. If you wnat to use GLM_GTC_half_float just include "glm/gtc/half_float.hpp" and it is going to be included in GLM namespace. + + + Finally, quite some file have been renamed, using "hpp" instead of ".h". Old file have been deprecated but are still available so that GLM 0.8.3.0 is fully compatible with GLM 0.8.2.x. + + GLM 0.8.3.0 (zip, 896 KB) + GLM 0.8.3.0 (7z, 359 KB) + Code samples page + Manual + Full changelog + + + + Groove + GLM 0.8.2.3 (zip, 963 KB) + GLM 0.8.2.3 (7z, 381 KB) + Manual + Full changelog + + + + Groove + + A new release is available and inogurate a patch number. The goal of this patch number is to release faster fixes from bug reports. + + GLM 0.8.2.1 (zip, 963 KB) + GLM 0.8.2.1 (7z, 381 KB) + Manual + Full changelog + + + + Groove + + This release only fixes bugs. Left sided swizzle operators, quaternion operators, vectors access operators for the main onces. + + GLM 0.8.2 (zip, 963 KB) + GLM 0.8.2 (7z, 381 KB) + Manual + Full changelog + + + + Groove + + Some artifacts have been added to the tracker to give a picture of what you could expect for the next releases. + + + If you need something else you can add some artifacts to the tracker. Any comment on added entries is welcome. + + + Furthermore, no more release of GLM 0.7.x will be done. Please upgrade to GLM 0.8.1. + + + Finally, a pack of programmable oriented OpenGL samples using GLM is under development and planed to be release in December. + + Tracker + + + + Groove + + GLM 0.8.1 is released. This new version mainly fixes 64 bit integers with GCC and various bugs. + + GLM 0.8.1 (zip, 938 KB) + GLM 0.8.1 (7z, 372 KB) + GLM 0.8.1 Manual + Full changelog + + + + Groove + + GLM 0.8.0 is released. This new version is now based on GLSL 1.30 specification which provided new functions and precision qualifiers. + + + Beyond this, lot of changes have been done to make GLM easier to use, easier to develop, more reliable, more conform to C++ ISO98 standard and GLSL specifications. + + + It involves that GLM 0.8.x is not backward compatible with GLM 0.7.x... However, an application port from GLM 0.7.x to GLM 0.8.x isn't a huge work and actually for some, it won’t be work at all. + + + On GLM core side, based on GLSL features, vector types can't be automatically cast to pointer anymore for code safety purposes. Vector constructors require a single scalar parameter of the exact number of components. + + + On GLM extension side, the mechanism to use them has changed. The old [__]***GTX way doesn't exist anymore. Have a look on the manual for more information. + + + Have a look on the manual and the changelog for more information. Don't forget to send your feedback and enjoy! + + GLM 0.8.0 (zip, 936 KB) + GLM 0.8.0 (7z, 370 KB) + GLM 0.8.0 Manual + Full changelog + Post a comment + + + + Groove + + Ambient aperture lighting Humus demo have been updated to use GLM as math library. + + Updated demo + all sources (zip, 2.38 MB) + Original demo (zip, 1.40 MB) + Post a comment + + + + Groove + + As you can see the website get a little update to prepare GLM 0.8.0 final release. + + + GLM 0.8.0 final should be release during the week. + + + + + Groove + + This release fixes some bugs and add few features though extensions. The development is now based on CMake to make easier cross platform tests and project management. + + GLM 0.8.0 Beta 3 (zip, 819 KB) + GLM 0.8.0 Beta 3 (7z, 345 KB) + Full changelog + Post a comment + + + + Groove + + This release mainly improves half float vectors support. By default the low precission vectors are based on float numbers not on half numbers + + + It also provides new setup options. GLM_USE_ONLY_XYZW to disable multiple names to access to a single vector component. GLM_USE_ANONYMOUS_UNION to allow multiple component names on half vectors with Visual C++. + + + Various bugs and updates of extensions have been done too. Final release is coming... + + GLM 0.8.0 Beta 2 (zip, 798 KB) + GLM 0.8.0 Beta 2 (7z, 327 KB) + Full changelog + Post a comment + + + + Groove + + GLM have been updated to support GLSL 1.30. API documentation had significant improvements to make easier finding of GLSL functions and types. + + + GLM 0.8.x is NOT backward compatible with GLM 0.7.x. Upgrade to GLM 0.8.x could involve build errors for the following cases: A lot of improvements have been made to increase the conformance with GLSL specification. Lot of GLSL 1.30 features were already exposed in extensions that have been deleted. The extension syntaxe based on ARB convension is no long used. + + + Due to the number of changes GLM 0.8.0 is release as beta first. The final release is schedule for october. + + GLM 0.8.0 Beta 1 (zip, 786 KB) + GLM 0.8.0 Beta 1 (7z, 321 KB) + Full changelog + Post a comment + + + + Groove + + GLM 0.7.6 provides a better C++ conformance so that you can build GLM with –pedantic G++ parameter or without Visual Studio extensions. To make GLM more reliable, BOOST_STATIC_ASSERT are used according developer wishes. + + GLM 0.7.6 (zip, 907 KB) + GLM 0.7.6 (7z, 387 KB) + Full changelog + Manual + + + + Groove + + GLM 0.7.5 is available and introduces a new build messsage system to get information of GLM build configuration with Visual Studio. This mechanism is documented in section 6 of GLM manual. Also, GLM can be built with GCC pedantic options. + + GLM 0.7.5 (zip, 852 KB) + GLM 0.7.5 (7z, 366 KB) + Full changelog + Manual + + + + Groove + + GLM 0.7.4 introduces a new system to manage external dependencies. + + + It allows developing extension using external dependencies like GLEW, Boost, etc. without making required those dependencies for GLM programmer that doesn't need those external dependent extensions. + + + The mechanism is described into the updated manual. + + GLM 0.7.4 (zip, 859 KB) + GLM 0.7.4 (7z, 372 KB) + Full changelog + Manual + + + + Groove + + GLM 0.7.3 is released. This version fixes few bugs and add few extensions + + GLM 0.7.3 (zip, 1.8 MB) + GLM 0.7.3 (7z, 635 KB) + Full changelog + + + + Groove + + GLM 0.7.2 is released. The documentation have been completed again and several issues handle with precompiler options. + + + #define GLM_SWIZZLE GLM_SWIZZLE_FUNC allows to use swizzle operators with internal functions. For example, glm::vec3(1, 2, 3).zyx is replaced by glm::vec3(1, 2, 3)._zyx() with this option. + + + #define GLM_FORCE_NO_HALF allows to include all extensions (#include "glm/glmext.h") without any support of half-precision floating-point numbers. + + + #define GLM_AUTO_CAST GLM_DISABLE allows to disable automatic cast (eg: glLoadMatrixf(glm::mat4(1.0))) which could involve unfortunate issues in some cases. + + + More information on these topic are available in GLM manual section 5 "Known issues". + + GLM 0.7.2 (zip, 1.8 MB) + GLM 0.7.2 (7z, 635 KB) + Full changelog + + + + Groove + + GLM 0.7.1 is available under MIT license. It fixes bugs with GCC. + + GLM 0.7.1 (zip, 1.8 MB) + GLM 0.7.1 (7z, 635 KB) + Full changelog + + + + Groove + + GLM 0.7.0 is available under MIT license. LGPL lisence have been discard due to an issue of use for console development. This release contains a lot better documentation based on Doxygen. Lot of bugs have been fixed and the documentation completed. Thanks to all people that has contributed thought bug reports and ideas to make this version a lot better! + + GLM 0.7.0 (zip, 1.8 MB) + GLM 0.7.0 (7z, 635 KB) + Full changelog + + + + Groove + + GLM 0.6.4 is available and fixes some swizzle operator issues. + + GLM 0.6.4 (zip, 1.7 MB) + GLM 0.6.4 (7z, 612 KB) + Full changelog + + + + Groove + + GLM 0.6.3 fixes accesses of matrices and a 3DSMax SDK conflict. + + GLM 0.6.3 (zip, 1.8 MB) + GLM 0.6.3 (7z, 633 KB) + Full changelog + + + + Groove + + GLM 0.6.2 fixes an error on an extension. + + GLM 0.6.2 (zip, 1.8 MB) + GLM 0.6.2 (7z, 632 KB) + Full changelog + + + + Groove + + GLM 0.6.1 is a minor update that fix an issue on extension namespace and add two more extensions. + + GLM 0.6.1 (zip, 1.8 MB) + GLM 0.6.1 (7z, 632 KB) + Full changelog + + + + Groove + + GLM 0.6.0 is available. For this release, work focus on extensions. A new mecanisum allows to integrate GLM extensions as it is actually done for GLSL extension by vendors. Lot of new extensions have been added. + + GLM 0.6.0 (zip, 1.8 MB) + GLM 0.6.0 (7z, 666 KB) + Raytracer v1.0 (exe) + Raytracer v1.0 (zip) + Full changelog + + + + Groove + + This release fixes some issues with swizzle operators. + + GLM 0.5.1 (zip, 2.3 MB) + GLM 0.5.1 (7z, 789 KB) + + + + Groove + + A new sample is available. It's an update of Philip Rideout's Catmull Clark subdivision program that uses GLM. Released with pleasant permission of Philip Rideout. + + CatmullClark sample (zip, 605 KB) + + + + Groove + + This release include GLSL 1.2 new feature in the core implementation. Also, it includes swizzle read and write operators and a custom options system to setup GLM. + + + It includes some new extensions to extend GLSL features but they remain experimental. The next release should provide the first stable extensions. + + + The GLM 0.5.0 packages contain some basic samples and some documentation. The ray tracer sample has been updated to GLM 0.5.0. Except for specific cases, especially with extensions, GLM 0.5 is backward compatible. + + + Now, GLM development is taking advantages of SourceForge.net services: a bug tracker system and the development source code is publicly available on SF.net SVN server. + + GLM 0.5.0 (zip, 2.4 MB) + GLM 0.5.0 (7z, 843 KB) + Raytracer b3.0 (exe, 751 KB) + Raytracer b3.0 (zip, 1.1 MB) + + + + Groove + + A GLM update is available. It simply includes some examples for a sweet start with GLM. + + + The examples show how to use GLM with OpenGL intermediate mode and OpenGL vertex arrays. Also, they show how to use GLM extensions to replace GLU and OpenGL function witch could slightly increase performances by decreasing the number of OpenGL states changes. + + GLM 0.4.1 (zip, 1.6 MB) + GLM 0.4.1 (7z, 521 KB) + + + + Groove + + This release introduces first GLSL 1.2 features as planed. Also, various new extensions have been added and updated. Finally, it's not anymore required to include windows.h before glm.h when windows.h is required. + + + The number of features of GLM, including extensions, start to really increase the compilation time. That's why it's recommended to use precompiled headers. + + GLM 0.4.0 + + + + Groove + + Version 0.4 will complete matrices and vectors operators and will add GLSL 1.2 features. First, conversions simplifications will be integrated. Then, 4 per 3 matrices and outer product will be available from extensions. The transpose function is already available from extension. + + + Version 0.5 will integrate GLSL 1.2 features to GLM core. + + + Version 0.6 will add swizzle operators in reading and writing. (eg: vec3 v1(1.0, 2.0, 3.0); vec3 v2 = v1.xxx; v1.zyx = v;). + + + + + Groove + + This release corrects two main bugs. First, a bug of the imat4 and mat4 division operators and other correct the vectors components access from texture coordinate way. + + GLM 0.3.2 + + + + Groove + + This update adds GCC 4.0 support for MacOS X and Linux and GCC 4.1 under Linux. Also, its provides some optimisations. + + + Further release will prodive GLSL 1.2 compliances. + + GLM 0.3.1 + + + + Groove + + A new release of GLM is now available. It improves GLSL data type conversion and construction compliance. Also, It's adds extensions like some to manage double-precision and half-precision float numbers. Finally a Doxygen documentation has been added. + + + This new release have been tested under Visual C++ 7.1, Visual C++ 8.0, GCC 3.2.3 et GCC 3.4.2. + + GLM 0.3 + Raytrace + Online documentation + + + + Groove + + A new release of GLM is now available. A few bugs have been fixed, the portability of GLSL into C++ has been improved, and new experimental extensions have been implemented, enhancing GLSL features. + + + Project now supports quaternions, adds new features to handle colors, vectors and matrices. For example, GLM allows base colors changing, vector projected operations, and 2D/3D transforms. + + + To demo the features of this new version, a sample program is included. It is a simple Ray Tracer supporting reflected and refracted rays, three lights types (point, directionnal and spot), two objects types (sphere, plan), using all of the GLM possibilities. + + + + + Groove + + The english section of this site is now available. + + + + + Groove + + This is the first public availability of GLM. This library supports part of GLSL specifications : All vectors and matrices types, and all the operators and associated functions. + + + For now, there isn't detailed documentation, but you can freely have a look on GLSL specifications. Consider any incoherence with GLM as an error. Keep in mind the library is included in the namespace "glm". + + + This project is multi platform and was successfully tested under Visual C++ 7.1, MinGW 3.4 and GCC 3.4. + + GLM 0.1 User Release + GLM 0.1 Contributor Release + GLSL 1.10.59 specifications + + + + + + + + + + + + + + + + + + + + + + + + OpenGL's Official site. You would find OpenGL specifications, news and tons of related informations. + + + This page contains all OpenGL extensions specifications. + + + This page contains OpenGL 2.0 specifications. + + + This page contains OpenGL Shading Language Specification. + + + + This document lists all the conventions for writing GLSL extensions. These rules are the basics of the GLM extensions system. + + + + + GLSL is not the ultimate mathematics library, i.e. for matrices operations, specs are very restricted. There aren't any functions to get the determinant, inverse, or a matrix transpose. Moreover, there are a few vector types and no quaternions. + What about completing the missing features using the extensions ? It will be developed from GLSL conventions and may add for exemple the extension GLM_GTX_quaternion, defining __quatGT type and conjugateGT function. + Extensions may be available through a separate file called glmext.h instead of being directly into the library core file. + It would be interesting to suggest GLM extensions implementations directly in GLSL to increase portability. It may hopefully end by submitting extensions to ARB. + + + The use of a namespace allows to prevenf from any name collision problem with other libraries like STL. GLSL uses a reserved 'namespace' keyword but does not define it. OpenGL uses a C technic for the namespaces management with the 'gl' prefix. What name should we give to this namespace ? 'gl', 'glsl', 'glm' or 'sl' ? What is the best solution ? C-like or C++-like namespaces ? + Bug #3 says that 'not' is a C++ keyword. C-style namespaces use would resolves this bug but GLSL has been built from C upon a C++ logic. + + + The interaction with OpenGL is not the purpose of GLM. However, GLM should be easily usable with OpenGL and some features could be welcome. i.e., using vec3 type with Vertex3fv function should simplify and optimize the program. Eventually, semantically speaking, vec3 is more accurate and stronger than addressing on a potential 3 floats table. + If it is possible to make easy the interoperability between GLM and OpenGL, then this work is recommended if semantic stays correct. GLM must also remain independent towards OpenGL. + + + GLSL specifications include unimplemented reserved keywords list. Their use must return an error. Some of them already exist in C++. + GLM can only allow C++ reserved keywords. The others must be undefined so the compiler returns an error. + + + GLSL defines six variable qualifiers types : const, varying, uniform, attrib, in, out, inout. + 'const' variables are only usable in a local way into a shader. They are available for vertex and fragments shaders. GLSL's 'const' are similar to C++ 'static const', i.e. the variable only exists inside a compilation unit (.o files with GCC). + 'varying' variables offer a communication interface between vertex and fragment sahder. 'uniform' and 'attrib' variables are a way of communication between C/C++ program and shaders, so 'varying' are useless in the C++ program; so this qualifier is not allowed. + Some programmers are already using 'in', 'ou' and 'inout' qualifiers for semantic purpose. They define them as empty '#define'. + It seems difficult to keep the same syntax than GLSL for 'uniform' and 'attrib' variables although this notion seems interesting. Why not keeping it only for their semantic properties ? + + + All integrated variables matches with OpenGL state variables. So there are all accessible from the OpenGL API. + + + smapler* types come from GL_ARB_multitexure extension. Values matches with a texture unit. + A sampler type would offer an additionnal semantic value. + No, this is not the GLM objective. + + + GLSL allows several components to be accessed at the same time. Moreover, GLSL let the possibility to the user to order components as he wants. To implement such a possibility, 4² * 3 * 2 = 96 fuctions should be added for vec4 type, for example (components number : 4, access types : 3, readonly access and write access : 2). + A solution witch reach GLSL conformance have been found. However it need lot of functions. This feature is coming in a futur release. + + + GLSL allows an access to a component with many different names, that explains the component notion. i.e. the first vec3 component is accessible with .x, .r, .s. + A possibility would be creating three functions for each component. + Another would be using the keyword 'union'. + The first solution allows to keep components values in a private classes table, but in this case, the overloaded operator [] must be used to access values and/or functions per component that is not conform to GLSL specifications. The second respect GLSL rules but components are public. In this case, this is not a real problem so this second solution is kept. + + + GLSL specifications tell that 'fragment processing functions' are only available for fragment shaders and function ftransform is only available for vertex shaders. The C/C++ program must be considered as a third program type so this functions are not available. + + + + + 'union' keyword is here to allow access to vector components with several different variables names. Moreover, templates are also used to create two vector type categories : _vec* and _ivec*. Eventually, anonymous structures are not allowed in ISO C++ norm. + Problem might come from the lack of supporting both templates and unions from Visual C++ 7.1. + If -pedantic isn't used with G++, then code compiles correctly. As we are waiting for a better compromise, the code stays that way. As notified for the bug #4, the ultimate solution might be to avoid templates in vector definition. + + + GCC supports all C++ keywords that includes 'not', which is equivalent to '!' operator. So there is a problem with GLM because GLSL defines the 'not' function. + Overloading the '!' operator or the 'not' keyword we can partly resolve the problem but leaving as ignored the GLM namespace concept. If the source code contains 'glm:not' string, then GCC gives an error. + 'not' is a C++ keyword so GLM mustn't define a 'not' function. However, all the compilers don't support this keyword (VC7.1). Does this name has to be changed ? For now, it is recommended to avoid using 'not'. + + + The GLSL specifications grant access to multiple components for vector types. i.e. with GLSL the following lines are correct : vec3 MyVector = vec4(1.0, 1.0, 1.0, 0.0).xyz. + It seems difficult to create an equal feature in C++ because 'x', 'y', and 'z' according to the previous example can be sorted in any order and be repeated from zero to four to a max of four components. + + + + + + OpenGL Mathematics (GLM) is a C++ mathematics library for 3D software based on the OpenGL Shading Language (GLSL) specification. + + + The goal of the project is to provide to 3D programmers math classes and functions that miss in C++ when we use to program with GLSL or any high level GPU language. With GLM, the idea is to have a library that works the same way that GLSL which imply a strict following of GLSL specification for the implementation. + + + However, this project isn't limited by GLSL features. An extension system allows to extend GLSL capabilities. It allows GLM to be a great subtitute for some OpenGL 3 deprecated functions, to work following a clean programmable approach. + + + GLM is release under MIT license and available for all version of GCC from version 3.4 and Visual Studio from version 8.0 as a platform independent library. + + + You can checkout SVN development sources from https://glf.svn.sourceforge.net/svnroot/glf/Trunk/glm/. + + + + + GLSL + Optional features = OpenGL Mathematics (GLM). + A C++ mathematics library for 3D graphics. + + + + + + + 2560x1600 + 1920x1200 + 1600x1000 + 1280x0800 + 1024x0640 + + + + + Font (.otf) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/doc/src/download.xsl b/doc/src/download.xsl new file mode 100644 index 00000000..51c4c98b --- /dev/null +++ b/doc/src/download.xsl @@ -0,0 +1,78 @@ + + + + + + + + + + OpenGL Mathematics : Downloads + + + + + + + + + + + +
+
+ OpenGL Mathematics +
+ +
+
+
Current release
+ +
+
+ : + + + + () +
+
_________________
+
+ + + +
_________________
+
+ +
+ + +
+ + +
+
+ +
+ +
+
_________________
+
+
+ + +
+ : + + () +
+
+ +
diff --git a/doc/src/dummy.cpp b/doc/src/dummy.cpp new file mode 100644 index 00000000..0395e23b --- /dev/null +++ b/doc/src/dummy.cpp @@ -0,0 +1,4 @@ +int main() +{ + +} diff --git a/doc/src/goodies.xsl b/doc/src/goodies.xsl new file mode 100644 index 00000000..6b27bd40 --- /dev/null +++ b/doc/src/goodies.xsl @@ -0,0 +1,79 @@ + + + + + + + + + + OpenGL Mathematics: Goodies + + + + + + + + + + + +
+
+ OpenGL Mathematics +
+ +
+ + + +
_________________
+
+ +
+ + +
+ + +
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + +  + +
+
+
_________________
+
+
+
+ +
diff --git a/doc/src/issue.xsl b/doc/src/issue.xsl new file mode 100644 index 00000000..23b8e1ed --- /dev/null +++ b/doc/src/issue.xsl @@ -0,0 +1,120 @@ + + + + + + + + + + OpenGL Mathematics : Issues + + + + + + +
+ OpenGL Mathematics +
+ + + + + +
+ +
+ + + +
+ + +
+
Problématiques
+
+ +
+
+ + +
+ )
+
+
+ +
+
+ STATUE : , +
+
+
+
+ + +
+ : +
+
+ +
diff --git a/doc/src/link.xsl b/doc/src/link.xsl new file mode 100644 index 00000000..7d1ac769 --- /dev/null +++ b/doc/src/link.xsl @@ -0,0 +1,115 @@ + + + + + + + + + + OpenGL Mathematics : Links + + + + + + +
+ OpenGL Mathematics +
+ + + + + +
+ +
+ + + +
+ + +
+
Liens
+
+ This page lists all the documents that helped to develop OpenGL Mathematics. +
+
+ +
+
+ + +
+ + + +
+
+ +
+
+
+ +
diff --git a/doc/src/news.xsl b/doc/src/news.xsl new file mode 100644 index 00000000..7f85a416 --- /dev/null +++ b/doc/src/news.xsl @@ -0,0 +1,81 @@ + + + + + + + + + + OpenGL Mathematics: News + + + + + + + + + + + +
+ +
+ OpenGL Mathematics +
+ +
+ + +
+ + +
+ + +
+
+ +
+
+ +
+
+ + + + + + + + + + +
+
_________________
+
+
+
+ +
diff --git a/doc/src/util.xsl b/doc/src/util.xsl new file mode 100644 index 00000000..cb8978f2 --- /dev/null +++ b/doc/src/util.xsl @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + menu-titre2 + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + {./@title} + + + + +
+ +
+
+ + +
+
+ + +

+
+ + +
+ +
+
+
+ + + :
+
+ + + +
+ + +
+ +
+ +
+ + + + + + + + + + + + + + + +
+
+ + + + + +
diff --git a/doc/usertype.dat b/doc/usertype.dat new file mode 100644 index 00000000..dbf4a90e --- /dev/null +++ b/doc/usertype.dat @@ -0,0 +1,646 @@ +attribute +const +uniform +varying +break +continue +do +for +while +if +else +in +out +inout +float +int +void +bool +true +false +discard +return +mat2 +mat3 +mat4 +mat2x2 +mat3x3 +mat4x4 +mat2x3 +mat3x2 +mat2x4 +mat4x2 +mat3x4 +mat4x3 +vec2 +vec3 +vec4 +ivec2 +ivec3 +ivec4 +uvec2 +uvec3 +uvec4 +bvec2 +bvec3 +bvec4 +sampler1D +sampler2D +sampler3D +samplerCube +sampler1DShadow +sampler2DShadow +struct + +asm +class +union +enum +typedef +template +this +packed +goto +switch +default +inline +noinline +volatile +public +static +extern +external +interface +long +short +double +half +fixed +unsigned +input +output +sampler2DRect +sampler3DRect +sampler2DRectShadow +sizeof +cast +namespace +using + +hvec2 +hvec3 +hvec4 +fvec2 +fvec3 +fvec4 +dvec2 +dvec3 +dvec4 + +__uvec2GTX +__uvec3GTX +__uvec4GTX +__ivec2GTX +__ivec3GTX +__ivec4GTX +__hvec2GTX +__hvec3GTX +__hvec4GTX +__fvec2GTX +__fvec3GTX +__fvec4GTX +__dvec2GTX +__dvec3GTX +__dvec4GTX + +on + +final +abstract +limited +access +self + +uchar +schar +uint +sint + +int8 +int16 +int32 +int64 + +sint8 +sint16 +sint32 +sint64 + +uint8 +uint16 +uint32 +uint64 + +float16 +float32 +float64 + +quat +hquat +fquat +dquat + +__quatGTX +__hquatGTX +__fquatGTX +__dquatGTX + +handle +handle8 +handle16 +handle32 +handle64 + +flag +flag8 +flag16 +flag32 +flag64 + +import +export + +hmat2 +hmat3 +hmat4 + +fmat2 +fmat3 +fmat4 + +dmat2 +dmat3 +dmat4 + +hmat2x3 +hmat3x2 +hmat2x4 +hmat4x2 +hmat3x4 +hmat4x3 + +fmat2x3 +fmat3x2 +fmat2x4 +fmat4x2 +fmat3x4 +fmat4x3 + +dmat2x3 +dmat3x2 +dmat2x4 +dmat4x2 +dmat3x4 +dmat4x3 + +__halfGTX + +__hvec2GTX +__hvec3GTX +__hvec4GTX + +__hmat2GTX +__hmat3GTX +__hmat4GTX + +__fmat2GTX +__fmat3GTX +__fmat4GTX + +__dmat2GTX +__dmat3GTX +__dmat4GTX + +__hmat2x3GTX +__hmat3x2GTX +__hmat2x4GTX +__hmat4x2GTX +__hmat3x4GTX +__hmat4x3GTX + +__fmat2x3GTX +__fmat3x2GTX +__fmat2x4GTX +__fmat4x2GTX +__fmat3x4GTX +__fmat4x3GTX + +__dmat2x3GTX +__dmat3x2GTX +__dmat2x4GTX +__dmat4x2GTX +__dmat3x4GTX +__dmat4x3GTX + +null +pi +epsilon +infinite +self + +byte +word +dword +qword + +new_object +new_array +delete_object +delete_array + +__int8GTX +__int16GTX +__int32GTX +__int64GTX + +__i8GTX +__i16GTX +__i32GTX +__i64GTX + +__i8vec2GTX +__i8vec3GTX +__i8vec4GTX + +__i16vec2GTX +__i16vec3GTX +__i16vec4GTX + +__i32vec2GTX +__i32vec3GTX +__i32vec4GTX + +__i64vec2GTX +__i64vec3GTX +__i64vec4GTX + +__uint8GTX +__uint16GTX +__uint32GTX +__uint64GTX + +__u8GTX +__u16GTX +__u32GTX +__u64GTX + +__u8vec2GTX +__u8vec3GTX +__u8vec4GTX + +__u16vec2GTX +__u16vec3GTX +__u16vec4GTX + +__u32vec2GTX +__u32vec3GTX +__u32vec4GTX + +__u64vec2GTX +__u64vec3GTX +__u64vec4GTX + +__float16GTX +__float32GTX +__float64GTX + +__f16GTX +__f32GTX +__f64GTX + +__f16vec2GTX +__f16vec3GTX +__f16vec4GTX + +__f32vec2GTX +__f32vec3GTX +__f32vec4GTX + +__f64vec2GTX +__f64vec3GTX +__f64vec4GTX + +__f16mat2GTX +__f16mat3GTX +__f16mat4GTX + +__f16mat2x3GTX +__f16mat2x4GTX +__f16mat3x2GTX +__f16mat3x4GTX +__f16mat4x2GTX +__f16mat4x3GTX + +__f32mat2GTX +__f32mat3GTX +__f32mat4GTX + +__f32mat2x3GTX +__f32mat2x4GTX +__f32mat3x2GTX +__f32mat3x4GTX +__f32mat4x2GTX +__f32mat4x3GTX + +__f64mat2GTX +__f64mat3GTX +__f64mat4GTX + +__f64mat2x3GTX +__f64mat2x4GTX +__f64mat3x2GTX +__f64mat3x4GTX +__f64mat4x2GTX +__f64mat4x3GTX + +__f16quatGTX +__f32quatGTX +__f64quatGTX + +int8 +int16 +int32 +int64 + +i8 +i16 +i32 +i64 + +i8vec2 +i8vec3 +i8vec4 + +i16vec2 +i16vec3 +i16vec4 + +i32vec2 +i32vec3 +i32vec4 + +i64vec2 +i64vec3 +i64vec4 + +uint8 +uint16 +uint32 +uint64 + +u8 +u16 +u32 +u64 + +u8vec2 +u8vec3 +u8vec4 + +u16vec2 +u16vec3 +u16vec4 + +u32vec2 +u32vec3 +u32vec4 + +u64vec2 +u64vec3 +u64vec4 + +float16 +float32 +float64 + +f16 +f32 +f64 + +f16vec2 +f16vec3 +f16vec4 + +f32vec2 +f32vec3 +f32vec4 + +f64vec2 +f64vec3 +f64vec4 + +f16mat2 +f16mat3 +f16mat4 + +f16mat2x3 +f16mat2x4 +f16mat3x2 +f16mat3x4 +f16mat4x2 +f16mat4x3 + +f32mat2 +f32mat3 +f32mat4 + +f32mat2x3 +f32mat2x4 +f32mat3x2 +f32mat3x4 +f32mat4x2 +f32mat4x3 + +f64mat2 +f64mat3 +f64mat4 + +f64mat2x3 +f64mat2x4 +f64mat3x2 +f64mat3x4 +f64mat4x2 +f64mat4x3 + +f16quat +f32quat +f64quat + +bool1 +bool2 +bool3 +bool4 + +bool1x1 +bool2x2 +bool3x3 +bool4x4 + +bool2x3 +bool2x4 +bool3x2 +bool3x4 +bool4x2 +bool4x3 + +int1 +int2 +int3 +int4 + +int1x1 +int2x2 +int3x3 +int4x4 + +int2x3 +int2x4 +int3x2 +int3x4 +int4x2 +int4x3 + +half1 +half2 +half3 +half4 + +half2x2 +half3x3 +half4x4 + +half2x3 +half2x4 +half3x2 +half3x4 +half4x2 +half4x3 + +float1 +float2 +float3 +float4 + +float1x1 +float2x2 +float3x3 +float4x4 + +float2x3 +float2x4 +float3x2 +float3x4 +float4x2 +float4x3 + +double1 +double2 +double3 +double4 + +double1x1 +double2x2 +double3x3 +double4x4 + +double2x3 +double2x4 +double3x2 +double3x4 +double4x2 +double4x3 + +bool1GTX +bool2GTX +bool3GTX +bool4GTX + +bool1x1GTX +bool2x2GTX +bool3x3GTX +bool4x4GTX + +bool2x3GTX +bool2x4GTX +bool3x2GTX +bool3x4GTX +bool4x2GTX +bool4x3GTX + +__int1GTX +__int2GTX +__int3GTX +__int4GTX + +__int1x1GTX +__int2x2GTX +__int3x3GTX +__int4x4GTX + +__int2x3GTX +__int2x4GTX +__int3x2GTX +__int3x4GTX +__int4x2GTX +__int4x3GTX + +__half1GTX +__half2GTX +__half3GTX +__half4GTX + +__half1x1GTX +__half2x2GTX +__half3x3GTX +__half4x4GTX + +__half2x3GTX +__half2x4GTX +__half3x2GTX +__half3x4GTX +__half4x2GTX +__half4x3GTX + +__float1GTX +__float2GTX +__float3GTX +__float4GTX + +__float1x1GTX +__float2x2GTX +__float3x3GTX +__float4x4GTX + +__float2x3GTX +__float2x4GTX +__float3x2GTX +__float3x4GTX +__float4x2GTX +__float4x3GTX + +__double1GTX +__double2GTX +__double3GTX +__double4GTX + +__double1x1GTX +__double2x2GTX +__double3x3GTX +__double4x4GTX + +__double2x3GTX +__double2x4GTX +__double3x2GTX +__double3x4GTX +__double4x2GTX +__double4x3GTX diff --git a/glm/CMakeLists.txt b/glm/CMakeLists.txt new file mode 100644 index 00000000..8cf58cdc --- /dev/null +++ b/glm/CMakeLists.txt @@ -0,0 +1,51 @@ +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 IMG_SOURCE ./img/*.cpp) +file(GLOB_RECURSE IMG_INLINE ./img/*.inl) +file(GLOB_RECURSE IMG_HEADER ./img/*.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("IMG Files" FILES ${IMG_SOURCE}) +source_group("IMG Files" FILES ${IMG_INLINE}) +source_group("IMG Files" FILES ${IMG_HEADER}) +source_group("VIRTREV Files" FILES ${VIRTREV_SOURCE}) +source_group("VIRTREV Files" FILES ${VIRTREV_INLINE}) +source_group("VIRTREV Files" FILES ${VIRTREV_HEADER}) + +include_directories(..) + +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} + ${IMG_SOURCE} ${IMG_INLINE} ${IMG_HEADER} + ${VIRTREV_SOURCE} ${VIRTREV_INLINE} ${VIRTREV_HEADER}) diff --git a/glm/core/_detail.hpp b/glm/core/_detail.hpp index 783114d3..94b7432f 100644 --- a/glm/core/_detail.hpp +++ b/glm/core/_detail.hpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-07-24 // Updated : 2008-08-31 diff --git a/glm/core/_swizzle.hpp b/glm/core/_swizzle.hpp index 15caad17..8274117b 100644 --- a/glm/core/_swizzle.hpp +++ b/glm/core/_swizzle.hpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2006-04-20 // Updated : 2008-08-22 diff --git a/glm/core/_swizzle.inl b/glm/core/_swizzle.inl index 68ff88ab..7be28ff0 100644 --- a/glm/core/_swizzle.inl +++ b/glm/core/_swizzle.inl @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2006-04-27 // Updated : 2006-04-27 diff --git a/glm/core/func_common.hpp b/glm/core/func_common.hpp index acefe46c..d270eae3 100644 --- a/glm/core/func_common.hpp +++ b/glm/core/func_common.hpp @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-03-08 -// Updated : 2008-03-08 +// Updated : 2010-01-26 // Licence : This source is under MIT License -// File : glm/core/func_common.h +// File : glm/core/func_common.hpp /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_common @@ -72,10 +72,18 @@ namespace glm //! Modulus. Returns x - y * floor(x / y) //! for each component in x using the floating point value y. //! (From GLSL 1.30.08 specification, section 8.3) - template - genTypeT mod( - genTypeT const & x, - genTypeU const & y); + 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. + //! (From GLSL 1.30.08 specification, section 8.3) + 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 @@ -89,26 +97,42 @@ namespace glm //! Returns y if y < x; otherwise, it returns x. //! (From GLSL 1.30.08 specification, section 8.3) - template - genUIFTypeT min( - genUIFTypeT const & x, - genUIFTypeU const & y); + 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. //! (From GLSL 1.30.08 specification, section 8.3) - template - genUIFTypeT max( - genUIFTypeT const & x, - genUIFTypeU const & y); + 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. //! (From GLSL 1.30.08 specification, section 8.3) - template - genUIFTypeT clamp( - genUIFTypeT const & x, - genUIFTypeU const & minVal, - genUIFTypeU const & maxVal); + 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 @@ -139,8 +163,15 @@ namespace glm //! Returns 0.0 if x < edge, otherwise it returns 1.0. //! (From GLSL 1.30.08 specification, section 8.3) - template - genTypeU step(genTypeT const & edge, genTypeU const & x); + 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 @@ -152,8 +183,17 @@ namespace glm //! return t * t * (3 – 2 * t); //! Results are undefined if edge0 >= edge1. //! (From GLSL 1.30.08 specification, section 8.3) - template - genTypeU smoothstep(genTypeT const & edge0, genTypeT const & edge1, genTypeU const & x); + 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 @@ -173,6 +213,55 @@ namespace glm template typename genType::bool_type isinf(genType const & x); + //! Returns a signed or unsigned integer value representing + //! the encoding of a floating-point value. The floatingpoint + //! value's bit-level representation is preserved. + //! (From GLSL 4.00.08 specification, section 8.3) + template + genIType floatBitsToInt(genType const & value); + + //! Returns a signed or unsigned integer value representing + //! the encoding of a floating-point value. The floatingpoint + //! value's bit-level representation is preserved. + //! (From GLSL 4.00.08 specification, section 8.3) + template + genUType floatBitsToInt(genType const & value); + + //! Returns a floating-point value corresponding to a signed + //! or 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. + //! (From GLSL 4.00.08 specification, section 8.3) + template + genType intBitsToFloat(genIUType const & value); + + //! Computes and returns a * b + c. + //! (From GLSL 4.00.08 specification, section 8.3) + 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. + //! (From GLSL 4.00.08 specification, section 8.3) + 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. + //! (From GLSL 4.00.08 specification, section 8.3) + template + genType ldexp(genType const & x, genIType const & exp); + }//namespace common }//namespace function }//namespace core diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index 8e28f0c7..de792803 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-03 -// Updated : 2008-09-04 +// Updated : 2010-01-26 // Licence : This source is under MIT License // File : glm/core/func_common.inl /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -11,7 +11,6 @@ namespace glm { namespace detail { - template struct Abs_ { @@ -144,6 +143,12 @@ namespace glm } // floor + template <> + inline detail::thalf floor(detail::thalf const& x) + { + return detail::thalf(::std::floor(float(x))); + } + template inline genType floor(genType const& x) { @@ -383,78 +388,78 @@ namespace glm return x - y * floor(x / y); } - template - inline detail::tvec2 mod + template + inline detail::tvec2 mod ( - detail::tvec2 const & x, - valType y + detail::tvec2 const & x, + typename detail::tvec2::value_type const & y ) { - return detail::tvec2( + return detail::tvec2( mod(x.x, y), mod(x.y, y)); } - template - inline detail::tvec3 mod + template + inline detail::tvec3 mod ( - detail::tvec3 const & x, - valType y + detail::tvec3 const & x, + typename detail::tvec3::value_type const & y ) { - return detail::tvec3( + return detail::tvec3( mod(x.x, y), mod(x.y, y), mod(x.z, y)); } - template - inline detail::tvec4 mod + template + inline detail::tvec4 mod ( - detail::tvec4 const & x, - valType y + detail::tvec4 const & x, + typename detail::tvec4::value_type const & y ) { - return detail::tvec4( + return detail::tvec4( mod(x.x, y), mod(x.y, y), mod(x.z, y), mod(x.w, y)); } - template - inline detail::tvec2 mod + template + inline detail::tvec2 mod ( - detail::tvec2 const & x, - detail::tvec2 const & y + detail::tvec2 const & x, + detail::tvec2 const & y ) { - return detail::tvec2( + return detail::tvec2( mod(x.x, y.x), mod(x.y, y.y)); } - template - inline detail::tvec3 mod + template + inline detail::tvec3 mod ( - detail::tvec3 const & x, - detail::tvec3 const & y + detail::tvec3 const & x, + detail::tvec3 const & y ) { - return detail::tvec3( + return detail::tvec3( mod(x.x, y.x), mod(x.y, y.y), mod(x.z, y.z)); } - template - inline detail::tvec4 mod + template + inline detail::tvec4 mod ( - detail::tvec4 const & x, - detail::tvec4 const & y + detail::tvec4 const & x, + detail::tvec4 const & y ) { - return detail::tvec4( + return detail::tvec4( mod(x.x, y.x), mod(x.y, y.y), mod(x.z, y.z), @@ -539,78 +544,78 @@ namespace glm return x < y ? x : y; } - template - inline detail::tvec2 min + template + inline detail::tvec2 min ( - detail::tvec2 const & x, - valType y + detail::tvec2 const & x, + typename detail::tvec2::value_type const & y ) { - return detail::tvec2( + return detail::tvec2( min(x.x, y), min(x.y, y)); } - template - inline detail::tvec3 min + template + inline detail::tvec3 min ( - detail::tvec3 const & x, - valType y + detail::tvec3 const & x, + typename detail::tvec2::value_type const & y ) { - return detail::tvec3( + return detail::tvec3( min(x.x, y), min(x.y, y), min(x.z, y)); } - template - inline detail::tvec4 min + template + inline detail::tvec4 min ( - detail::tvec4 const & x, - valType y + detail::tvec4 const & x, + typename detail::tvec4::value_type const & y ) { - return detail::tvec4( + return detail::tvec4( min(x.x, y), min(x.y, y), min(x.z, y), min(x.w, y)); } - template - inline detail::tvec2 min + template + inline detail::tvec2 min ( - detail::tvec2 const & x, - detail::tvec2 const & y + detail::tvec2 const & x, + detail::tvec2 const & y ) { - return detail::tvec2( + return detail::tvec2( min(x.x, y.x), min(x.y, y.y)); } - template - inline detail::tvec3 min + template + inline detail::tvec3 min ( - detail::tvec3 const & x, - detail::tvec3 const & y + detail::tvec3 const & x, + detail::tvec3 const & y ) { - return detail::tvec3( + return detail::tvec3( min(x.x, y.x), min(x.y, y.y), min(x.z, y.z)); } - template - inline detail::tvec4 min + template + inline detail::tvec4 min ( - detail::tvec4 const & x, - detail::tvec4 const & y + detail::tvec4 const & x, + detail::tvec4 const & y ) { - return detail::tvec4( + return detail::tvec4( min(x.x, y.x), min(x.y, y.y), min(x.z, y.z), @@ -633,77 +638,77 @@ namespace glm return x > y ? x : y; } - template - inline detail::tvec2 max + template + inline detail::tvec2 max ( - detail::tvec2 const & x, - valType y + detail::tvec2 const & x, + typename detail::tvec2::value_type y ) { - return detail::tvec2( + return detail::tvec2( max(x.x, y), max(x.y, y)); } - template - inline detail::tvec3 max + template + inline detail::tvec3 max ( - detail::tvec3 const & x, - valType y + detail::tvec3 const & x, + typename detail::tvec3::value_type y ) { - return detail::tvec3( + return detail::tvec3( max(x.x, y), max(x.y, y), max(x.z, y)); } - template - inline detail::tvec4 max + template + inline detail::tvec4 max ( - detail::tvec4 const & x, - valType y + detail::tvec4 const & x, + typename detail::tvec4::value_type y ) { - return detail::tvec4( + return detail::tvec4( max(x.x, y), max(x.y, y), max(x.z, y), max(x.w, y)); } - template - inline detail::tvec2 max + template + inline detail::tvec2 max ( - detail::tvec2 const & x, - detail::tvec2 const & y + detail::tvec2 const & x, + detail::tvec2 const & y ) { - return detail::tvec2( + return detail::tvec2( max(x.x, y.x), max(x.y, y.y)); } - template - inline detail::tvec3 max + template + inline detail::tvec3 max ( - detail::tvec3 const & x, - detail::tvec3 const & y + detail::tvec3 const & x, + detail::tvec3 const & y ) { - return detail::tvec3( + return detail::tvec3( max(x.x, y.x), max(x.y, y.y), max(x.z, y.z)); } - template - inline detail::tvec4 max + template + inline detail::tvec4 max ( - detail::tvec4 const & x, - detail::tvec4 const & y) + detail::tvec4 const & x, + detail::tvec4 const & y) { - return detail::tvec4( + return detail::tvec4( max(x.x, y.x), max(x.y, y.y), max(x.z, y.z), @@ -729,84 +734,84 @@ namespace glm return x; } - template - inline detail::tvec2 clamp + template + inline detail::tvec2 clamp ( - detail::tvec2 const & x, - valType minVal, - valType maxVal + detail::tvec2 const & x, + typename detail::tvec2::value_type const & minVal, + typename detail::tvec2::value_type const & maxVal ) { - return detail::tvec2( + return detail::tvec2( clamp(x.x, minVal, maxVal), clamp(x.y, minVal, maxVal)); } - template - inline detail::tvec3 clamp + template + inline detail::tvec3 clamp ( - detail::tvec3 const & x, - valType minVal, - valType maxVal + detail::tvec3 const & x, + typename detail::tvec3::value_type const & minVal, + typename detail::tvec3::value_type const & maxVal ) { - return detail::tvec3( + return detail::tvec3( clamp(x.x, minVal, maxVal), clamp(x.y, minVal, maxVal), clamp(x.z, minVal, maxVal)); } - template - inline detail::tvec4 clamp + template + inline detail::tvec4 clamp ( - detail::tvec4 const & x, - valType minVal, - valType maxVal + detail::tvec4 const & x, + typename detail::tvec4::value_type const & minVal, + typename detail::tvec4::value_type const & maxVal ) { - return detail::tvec4( + return detail::tvec4( clamp(x.x, minVal, maxVal), clamp(x.y, minVal, maxVal), clamp(x.z, minVal, maxVal), clamp(x.w, minVal, maxVal)); } - template - inline detail::tvec2 clamp + template + inline detail::tvec2 clamp ( - detail::tvec2 const & x, - detail::tvec2 const & minVal, - detail::tvec2 const & maxVal + detail::tvec2 const & x, + detail::tvec2 const & minVal, + detail::tvec2 const & maxVal ) { - return detail::tvec2( + return detail::tvec2( clamp(x.x, minVal.x, maxVal.x), clamp(x.y, minVal.y, maxVal.y)); } - template - inline detail::tvec3 clamp + template + inline detail::tvec3 clamp ( - detail::tvec3 const & x, - detail::tvec3 const & minVal, - detail::tvec3 const & maxVal + detail::tvec3 const & x, + detail::tvec3 const & minVal, + detail::tvec3 const & maxVal ) { - return detail::tvec3( + 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 - inline detail::tvec4 clamp + template + inline detail::tvec4 clamp ( - detail::tvec4 const & x, - detail::tvec4 const & minVal, - detail::tvec4 const & maxVal + detail::tvec4 const & x, + detail::tvec4 const & minVal, + detail::tvec4 const & maxVal ) { - return detail::tvec4( + return detail::tvec4( clamp(x.x, minVal.x, maxVal.x), clamp(x.y, minVal.y, maxVal.y), clamp(x.z, minVal.z, maxVal.z), @@ -932,21 +937,21 @@ namespace glm return a ? x : y; } - template - inline detail::tvec2 mix + template + inline detail::tvec2 mix ( - detail::tvec2 const & x, - detail::tvec2 const & y, - typename detail::tvec2::bool_type a + detail::tvec2 const & x, + detail::tvec2 const & y, + typename detail::tvec2::bool_type a ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tvec2 result; + detail::tvec2 result; for ( - typename detail::tvec2::size_type i = 0; - i < detail::tvec2::value_size(); + typename detail::tvec2::size_type i = 0; + i < detail::tvec2::value_size(); ++i ) { @@ -955,21 +960,21 @@ namespace glm return result; } - template - inline detail::tvec3 mix + template + inline detail::tvec3 mix ( - detail::tvec3 const & x, - detail::tvec3 const & y, - typename detail::tvec3::bool_type a + detail::tvec3 const & x, + detail::tvec3 const & y, + typename detail::tvec3::bool_type a ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tvec3 result; + detail::tvec3 result; for ( - typename detail::tvec3::size_type i = 0; - i < detail::tvec3::value_size(); + typename detail::tvec3::size_type i = 0; + i < detail::tvec3::value_size(); ++i ) { @@ -978,21 +983,21 @@ namespace glm return result; } - template - inline detail::tvec4 mix + template + inline detail::tvec4 mix ( - detail::tvec4 const & x, - detail::tvec4 const & y, - typename detail::tvec4::bool_type a + detail::tvec4 const & x, + detail::tvec4 const & y, + typename detail::tvec4::bool_type a ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tvec4 result; + detail::tvec4 result; for ( - typename detail::tvec4::size_type i = 0; - i < detail::tvec4::value_size(); + typename detail::tvec4::size_type i = 0; + i < detail::tvec4::value_size(); ++i ) { @@ -1014,82 +1019,82 @@ namespace glm return x <= edge ? genType(0) : genType(1); } - template - inline detail::tvec2 step + template + inline detail::tvec2 step ( - valType const & edge, - detail::tvec2 const & x + typename detail::tvec2::value_type const & edge, + detail::tvec2 const & x ) { - return detail::tvec2( - x.x <= edge ? valType(0) : valType(1), - x.y <= edge ? valType(0) : valType(1)); + return detail::tvec2( + x.x <= edge ? T(0) : T(1), + x.y <= edge ? T(0) : T(1)); } - template - inline detail::tvec3 step + template + inline detail::tvec3 step ( - valType const & edge, - detail::tvec3 const & x + typename detail::tvec3::value_type const & edge, + detail::tvec3 const & x ) { - return detail::tvec3( - x.x <= edge ? valType(0) : valType(1), - x.y <= edge ? valType(0) : valType(1), - x.z <= edge ? valType(0) : valType(1)); + 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 - inline detail::tvec4 step + template + inline detail::tvec4 step ( - valType edge, - detail::tvec4 const & x + typename detail::tvec4::value_type const & edge, + detail::tvec4 const & x ) { - return detail::tvec4( - x.x <= edge ? valType(0) : valType(1), - x.y <= edge ? valType(0) : valType(1), - x.z <= edge ? valType(0) : valType(1), - x.w <= edge ? valType(0) : valType(1)); + 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 - inline detail::tvec2 step + template + inline detail::tvec2 step ( - detail::tvec2 const & edge, - detail::tvec2 const & x + detail::tvec2 const & edge, + detail::tvec2 const & x ) { - return detail::tvec2( - x.x <= edge.x ? valType(0) : valType(1), - x.y <= edge.y ? valType(0) : valType(1)); + return detail::tvec2( + x.x <= edge.x ? T(0) : T(1), + x.y <= edge.y ? T(0) : T(1)); } - template - inline detail::tvec3 step + template + inline detail::tvec3 step ( - detail::tvec3 const & edge, - detail::tvec3 const & x + detail::tvec3 const & edge, + detail::tvec3 const & x ) { - return detail::tvec3( - x.x <= edge.x ? valType(0) : valType(1), - x.y <= edge.y ? valType(0) : valType(1), - x.z <= edge.z ? valType(0) : valType(1)); + 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 - inline detail::tvec4 step + template + inline detail::tvec4 step ( - detail::tvec4 const & edge, - detail::tvec4 const & x + detail::tvec4 const & edge, + detail::tvec4 const & x ) { - return detail::tvec4( - x.x <= edge.x ? valType(0) : valType(1), - x.y <= edge.y ? valType(0) : valType(1), - x.z <= edge.z ? valType(0) : valType(1), - x.w <= edge.w ? valType(0) : valType(1)); + 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 @@ -1107,84 +1112,84 @@ namespace glm return tmp * tmp * (genType(3) - genType(2) * tmp); } - template - inline detail::tvec2 smoothstep + template + inline detail::tvec2 smoothstep ( - valType const & edge0, - valType const & edge1, - detail::tvec2 const & x + typename detail::tvec2::value_type const & edge0, + typename detail::tvec2::value_type const & edge1, + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( smoothstep(edge0, edge1, x.x), smoothstep(edge0, edge1, x.y)); } - template - inline detail::tvec3 smoothstep + template + inline detail::tvec3 smoothstep ( - valType const & edge0, - valType const & edge1, - detail::tvec3 const & x + typename detail::tvec3::value_type const & edge0, + typename detail::tvec3::value_type const & edge1, + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( smoothstep(edge0, edge1, x.x), smoothstep(edge0, edge1, x.y), smoothstep(edge0, edge1, x.z)); } - template - inline detail::tvec4 smoothstep + template + inline detail::tvec4 smoothstep ( - valType const & edge0, - valType const & edge1, - detail::tvec4 const & x + typename detail::tvec4::value_type const & edge0, + typename detail::tvec4::value_type const & edge1, + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( smoothstep(edge0, edge1, x.x), smoothstep(edge0, edge1, x.y), smoothstep(edge0, edge1, x.z), smoothstep(edge0, edge1, x.w)); } - template - inline detail::tvec2 smoothstep + template + inline detail::tvec2 smoothstep ( - detail::tvec2 const & edge0, - detail::tvec2 const & edge1, - detail::tvec2 const & x + detail::tvec2 const & edge0, + detail::tvec2 const & edge1, + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( smoothstep(edge0.x, edge1.x, x.x), smoothstep(edge0.y, edge1.y, x.y)); } - template - inline detail::tvec3 smoothstep + template + inline detail::tvec3 smoothstep ( - detail::tvec3 const & edge0, - detail::tvec3 const & edge1, - detail::tvec3 const & x + detail::tvec3 const & edge0, + detail::tvec3 const & edge1, + detail::tvec3 const & x ) { - return detail::tvec3( + 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 - inline detail::tvec4 smoothstep + template + inline detail::tvec4 smoothstep ( - detail::tvec4 const & edge0, - detail::tvec4 const & edge1, - detail::tvec4 const & x + detail::tvec4 const & edge0, + detail::tvec4 const & edge1, + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( smoothstep(edge0.x, edge1.x, x.x), smoothstep(edge0.y, edge1.y, x.y), smoothstep(edge0.z, edge1.z, x.z), @@ -1206,36 +1211,36 @@ namespace glm #endif } - template - inline typename detail::tvec2::bool_type isnan + template + inline typename detail::tvec2::bool_type isnan ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return typename detail::tvec2::bool_type( + return typename detail::tvec2::bool_type( isnan(x.x), isnan(x.y)); } - template - inline typename detail::tvec3::bool_type isnan + template + inline typename detail::tvec3::bool_type isnan ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return typename detail::tvec3::bool_type( + return typename detail::tvec3::bool_type( isnan(x.x), isnan(x.y), isnan(x.z)); } - template - inline typename detail::tvec4::bool_type isnan + template + inline typename detail::tvec4::bool_type isnan ( - const detail::tvec4& x + detail::tvec4 const & x ) { - return typename detail::tvec4::bool_type( + return typename detail::tvec4::bool_type( isnan(x.x), isnan(x.y), isnan(x.z), @@ -1257,42 +1262,280 @@ namespace glm #endif } - template - inline typename detail::tvec2::bool_type isinf + template + inline typename detail::tvec2::bool_type isinf ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return typename detail::tvec2::bool_type( + return typename detail::tvec2::bool_type( isnan(x.x), isnan(x.y)); } - template - inline typename detail::tvec3::bool_type isinf + template + inline typename detail::tvec3::bool_type isinf ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return typename detail::tvec3::bool_type( + return typename detail::tvec3::bool_type( isnan(x.x), isnan(x.y), isnan(x.z)); } - template - inline typename detail::tvec4::bool_type isinf + template + inline typename detail::tvec4::bool_type isinf ( - const detail::tvec4& x + detail::tvec4 const & x ) { - return typename detail::tvec4::bool_type( + return typename detail::tvec4::bool_type( isnan(x.x), isnan(x.y), isnan(x.z), isnan(x.w)); } + inline int floatBitsToInt(float const & value) + { + union + { + float f; + int i; + } fi; + + fi.f = value; + return fi.i; + } + + template + inline detail::tvec2 floatBitsToInt + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + floatBitsToInt(value.x), + floatBitsToInt(value.y)); + } + + template + inline detail::tvec3 floatBitsToInt + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + floatBitsToInt(value.x), + floatBitsToInt(value.y)); + } + + template + inline detail::tvec4 floatBitsToInt + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + floatBitsToInt(value.x), + floatBitsToInt(value.y)); + } + + inline uint floatBitsToUint(float const & value) + { + union + { + float f; + uint u; + } fu; + + fu.f = value; + return fu.u; + } + + template + inline detail::tvec2 floatBitsToUint + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + floatBitsToUint(value.x), + floatBitsToUint(value.y)); + } + + template + inline detail::tvec3 floatBitsToUint + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + floatBitsToUint(value.x), + floatBitsToUint(value.y)); + } + + template + inline detail::tvec4 floatBitsToUint + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + floatBitsToUint(value.x), + floatBitsToUint(value.y)); + } + + inline float intBitsToFloat(int const & value) + { + union + { + float f; + int i; + } fi; + + fi.i = value; + return fi.f; + } + + inline float intBitsToFloat(uint const & value) + { + union + { + float f; + uint u; + } fu; + + fu.u = value; + return fu.f; + } + + template + inline detail::tvec2 intBitsToFloat + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + intBitsToFloat(value.x), + intBitsToFloat(value.y)); + } + + template + inline detail::tvec3 intBitsToFloat + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + intBitsToFloat(value.x), + intBitsToFloat(value.y)); + } + + template + inline detail::tvec4 intBitsToFloat + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + intBitsToFloat(value.x), + intBitsToFloat(value.y)); + } + + template + inline genType fma + ( + genType const & a, + genType const & b, + genType const & c + ) + { + return a * b + c; + } + + template + genType frexp + ( + genType const & x, + int & exp + ) + { + return std::frexp(x, exp); + } + + template + detail::tvec2 frexp + ( + detail::tvec2 const & x, + detail::tvec2 & exp + ) + { + return std::frexp(x, exp); + } + + template + detail::tvec3 frexp + ( + detail::tvec3 const & x, + detail::tvec3 & exp + ) + { + return std::frexp(x, exp); + } + + template + detail::tvec4 frexp + ( + detail::tvec4 const & x, + detail::tvec4 & exp + ) + { + return std::frexp(x, exp); + } + + template + genType ldexp + ( + genType const & x, + int const & exp + ) + { + return std::frexp(x, exp); + } + + template + detail::tvec2 ldexp + ( + detail::tvec2 const & x, + detail::tvec2 const & exp + ) + { + return std::frexp(x, exp); + } + + template + detail::tvec3 ldexp + ( + detail::tvec3 const & x, + detail::tvec3 const & exp + ) + { + return std::frexp(x, exp); + } + + template + detail::tvec4 ldexp + ( + detail::tvec4 const & x, + detail::tvec4 const & exp + ) + { + return std::frexp(x, exp); + } + }//namespace common }//namespace function }//namespace core diff --git a/glm/core/func_exponential.hpp b/glm/core/func_exponential.hpp index 82e08822..09b11325 100644 --- a/glm/core/func_exponential.hpp +++ b/glm/core/func_exponential.hpp @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-08 -// Updated : 2008-09-06 +// Updated : 2010-02-04 // Licence : This source is under MIT License -// File : glm/core/func_exponential.h +// File : glm/core/func_exponential.hpp /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_exponential diff --git a/glm/core/func_exponential.inl b/glm/core/func_exponential.inl index 07b341cc..0d0dc512 100644 --- a/glm/core/func_exponential.inl +++ b/glm/core/func_exponential.inl @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-03 -// Updated : 2008-09-06 +// Updated : 2010-02-04 // Licence : This source is under MIT License // File : glm/core/func_exponential.inl /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -26,39 +26,39 @@ namespace glm return ::std::pow(x, y); } - template - inline detail::tvec2 pow + template + inline detail::tvec2 pow ( - detail::tvec2 const & x, - detail::tvec2 const & y + detail::tvec2 const & x, + detail::tvec2 const & y ) { - return detail::tvec2( + return detail::tvec2( pow(x.x, y.x), pow(x.y, y.y)); } - template - inline detail::tvec3 pow + template + inline detail::tvec3 pow ( - detail::tvec3 const & x, - detail::tvec3 const & y + detail::tvec3 const & x, + detail::tvec3 const & y ) { - return detail::tvec3( + return detail::tvec3( pow(x.x, y.x), pow(x.y, y.y), pow(x.z, y.z)); } - template - inline detail::tvec4 pow + template + inline detail::tvec4 pow ( - detail::tvec4 const & x, - detail::tvec4 const & y + detail::tvec4 const & x, + detail::tvec4 const & y ) { - return detail::tvec4( + return detail::tvec4( pow(x.x, y.x), pow(x.y, y.y), pow(x.z, y.z), @@ -77,36 +77,36 @@ namespace glm return ::std::exp(x); } - template - inline detail::tvec2 exp + template + inline detail::tvec2 exp ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( exp(x.x), exp(x.y)); } - template - inline detail::tvec3 exp + template + inline detail::tvec3 exp ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( exp(x.x), exp(x.y), exp(x.z)); } - template - inline detail::tvec4 exp + template + inline detail::tvec4 exp ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( exp(x.x), exp(x.y), exp(x.z), @@ -125,36 +125,36 @@ namespace glm return ::std::log(x); } - template - inline detail::tvec2 log + template + inline detail::tvec2 log ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( log(x.x), log(x.y)); } - template - inline detail::tvec3 log + template + inline detail::tvec3 log ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( log(x.x), log(x.y), log(x.z)); } - template - inline detail::tvec4 log + template + inline detail::tvec4 log ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( log(x.x), log(x.y), log(x.z), @@ -173,36 +173,36 @@ namespace glm return ::std::exp(genType(0.69314718055994530941723212145818) * x); } - template - inline detail::tvec2 exp2 + template + inline detail::tvec2 exp2 ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( exp2(x.x), exp2(x.y)); } - template - inline detail::tvec3 exp2 + template + inline detail::tvec3 exp2 ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( exp2(x.x), exp2(x.y), exp2(x.z)); } - template - inline detail::tvec4 exp2 + template + inline detail::tvec4 exp2 ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( exp2(x.x), exp2(x.y), exp2(x.z), @@ -221,36 +221,36 @@ namespace glm return ::std::log(x) / genType(0.69314718055994530941723212145818); } - template - inline detail::tvec2 log2 + template + inline detail::tvec2 log2 ( - const detail::tvec2& x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( log2(x.x), log2(x.y)); } - template - inline detail::tvec3 log2 + template + inline detail::tvec3 log2 ( - const detail::tvec3& x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( log2(x.x), log2(x.y), log2(x.z)); } - template - inline detail::tvec4 log2 + template + inline detail::tvec4 log2 ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( log2(x.x), log2(x.y), log2(x.z), @@ -269,36 +269,36 @@ namespace glm return genType(::std::sqrt(double(x))); } - template - inline detail::tvec2 sqrt + template + inline detail::tvec2 sqrt ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( sqrt(x.x), sqrt(x.y)); } - template - inline detail::tvec3 sqrt + template + inline detail::tvec3 sqrt ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( sqrt(x.x), sqrt(x.y), sqrt(x.z)); } - template - inline detail::tvec4 sqrt + template + inline detail::tvec4 sqrt ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( sqrt(x.x), sqrt(x.y), sqrt(x.z), @@ -316,36 +316,36 @@ namespace glm return genType(1) / ::std::sqrt(x); } - template - inline detail::tvec2 inversesqrt + template + inline detail::tvec2 inversesqrt ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( inversesqrt(x.x), inversesqrt(x.y)); } - template - inline detail::tvec3 inversesqrt + template + inline detail::tvec3 inversesqrt ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( inversesqrt(x.x), inversesqrt(x.y), inversesqrt(x.z)); } - template - inline detail::tvec4 inversesqrt + template + inline detail::tvec4 inversesqrt ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( inversesqrt(x.x), inversesqrt(x.y), inversesqrt(x.z), diff --git a/glm/core/func_geometric.hpp b/glm/core/func_geometric.hpp index 8537976e..82bf2776 100644 --- a/glm/core/func_geometric.hpp +++ b/glm/core/func_geometric.hpp @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-03 -// Updated : 2008-09-08 +// Updated : 2010-02-04 // Licence : This source is under MIT License -// File : glm/core/func_geometric.h +// File : glm/core/func_geometric.hpp /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_geometric @@ -24,45 +24,61 @@ namespace glm //! Returns the length of x, i.e., sqrt(x * x). //! (From GLSL 1.30.08 specification, section 8.4) template - typename genType::value_type length(genType const & x); + typename genType::value_type length( + genType const & x); //! Returns the distance betwwen p0 and p1, i.e., length(p0 - p1). //! (From GLSL 1.30.08 specification, section 8.4) template - typename genType::value_type distance(genType const & p0, genType const & p1); + typename genType::value_type distance( + genType const & p0, + genType const & p1); //! Returns the dot product of x and y, i.e., result = x * y. //! (From GLSL 1.30.08 specification, section 8.4) template - typename genType::value_type dot(genType const & x, genType const & y); + typename genType::value_type dot( + genType const & x, + genType const & y); //! Returns the cross product of x and y. //! (From GLSL 1.30.08 specification, section 8.4) - template - detail::tvec3 cross(detail::tvec3 const & x, detail::tvec3 const & y); + 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. //! (From GLSL 1.30.08 specification, section 8.4) template - genType normalize(genType const & x); + genType normalize( + genType const & x); //! If dot(Nref, I) < 0.0, return N, otherwise, return -N. //! (From GLSL 1.30.08 specification, section 8.4) template - genType faceforward(genType const & N, genType const & I, genType const & Nref); + 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. //! (From GLSL 1.30.08 specification, section 8.4) template - genType reflect(genType const & I, genType const & N); + 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. //! (From GLSL 1.30.08 specification, section 8.4) template - genType refract(genType const & I, genType const & N, typename genType::value_type const & eta); + genType refract( + genType const & I, + genType const & N, + typename genType::value_type const & eta); }//namespace geometric }//namespace function diff --git a/glm/core/func_geometric.inl b/glm/core/func_geometric.inl index f9f97efe..83bb9561 100644 --- a/glm/core/func_geometric.inl +++ b/glm/core/func_geometric.inl @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-03 -// Updated : 2008-09-08 +// Updated : 2010-02-04 // Licence : This source is under MIT License // File : glm/core/func_geometric.inl /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -25,40 +25,40 @@ namespace glm genType sqr = x * x; return sqrt(sqr); } - - template - inline typename detail::tvec2::value_type length + + template + inline typename detail::tvec2::value_type length ( - detail::tvec2 const & x + detail::tvec2 const & v ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType sqr = x.x * x.x + x.y * x.y; + typename detail::tvec2::value_type sqr = v.x * v.x + v.y * v.y; return sqrt(sqr); } - template - inline typename detail::tvec3::value_type length + template + inline typename detail::tvec3::value_type length ( - detail::tvec3 const & x + detail::tvec3 const & v ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType sqr = x.x * x.x + x.y * x.y + x.z * x.z; + typename detail::tvec3::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z; return sqrt(sqr); } - template - inline typename detail::tvec4::value_type length + template + inline typename detail::tvec4::value_type length ( - detail::tvec4 const & x + detail::tvec4 const & v ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; + 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); } @@ -75,38 +75,38 @@ namespace glm return length(p1 - p0); } - template - inline typename detail::tvec2::value_type distance + template + inline typename detail::tvec2::value_type distance ( - detail::tvec2 const & p0, - detail::tvec2 const & p1 + detail::tvec2 const & p0, + detail::tvec2 const & p1 ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); return length(p1 - p0); } - template - inline typename detail::tvec3::value_type distance + template + inline typename detail::tvec3::value_type distance ( - detail::tvec3 const & p0, - detail::tvec3 const & p1 + detail::tvec3 const & p0, + detail::tvec3 const & p1 ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); return length(p1 - p0); } - template - inline typename detail::tvec4::value_type distance + template + inline typename detail::tvec4::value_type distance ( - detail::tvec4 const & p0, - detail::tvec4 const & p1 + detail::tvec4 const & p0, + detail::tvec4 const & p1 ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); return length(p1 - p0); } @@ -124,26 +124,26 @@ namespace glm return x * y; } - template - inline typename detail::tvec2::value_type dot + template + inline typename detail::tvec2::value_type dot ( - detail::tvec2 const & x, - detail::tvec2 const & y + detail::tvec2 const & x, + detail::tvec2 const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); return x.x * y.x + x.y * y.y; } - template - inline valType dot + template + inline T dot ( - detail::tvec3 const & x, - detail::tvec3 const & y + detail::tvec3 const & x, + detail::tvec3 const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); return x.x * y.x + x.y * y.y + x.z * y.z; } @@ -164,29 +164,29 @@ namespace glm return Result; } */ - template - inline valType dot + template + inline T dot ( - detail::tvec4 const & x, - detail::tvec4 const & y + detail::tvec4 const & x, + detail::tvec4 const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; } // cross - template - inline detail::tvec3 cross + template + inline detail::tvec3 cross ( - detail::tvec3 const & x, - detail::tvec3 const & y + detail::tvec3 const & x, + detail::tvec3 const & y ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - return detail::tvec3( + 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); @@ -205,39 +205,39 @@ namespace glm } // According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefine and generate an error - template - inline detail::tvec2 normalize + template + inline detail::tvec2 normalize ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType sqr = x.x * x.x + x.y * x.y; + typename detail::tvec2::value_type sqr = x.x * x.x + x.y * x.y; return x * inversesqrt(sqr); } - template - inline detail::tvec3 normalize + template + inline detail::tvec3 normalize ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType sqr = x.x * x.x + x.y * x.y + x.z * x.z; + typename detail::tvec3::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z; return x * inversesqrt(sqr); } - template - inline detail::tvec4 normalize + template + inline detail::tvec4 normalize ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; + 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); } diff --git a/glm/core/func_integer.hpp b/glm/core/func_integer.hpp new file mode 100644 index 00000000..4ee932cc --- /dev/null +++ b/glm/core/func_integer.hpp @@ -0,0 +1,142 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2010-03-17 +// Updated : 2010-03-31 +// Licence : This source is under MIT License +// File : glm/core/func_integer.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_integer +#define glm_core_func_integer + +namespace glm +{ + namespace test{ + void main_core_func_integer(); + }//namespace test + + namespace core{ + namespace function{ + //! Define integer functions from Section 8.8 of GLSL 4.00.8 specification. + namespace 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. + //! + //! (From GLSL 4.00.08 specification, section 8.8) + 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. + //! + //! (From GLSL 4.00.08 specification, section 8.8) + 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. + //! (From GLSL 4.00.08 specification, section 8.8) + 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. + //! (From GLSL 4.00.08 specification, section 8.8) + 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. + //! + //! (From GLSL 4.00.08 specification, section 8.8) + 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. + //! + //! (From GLSL 4.00.08 specification, section 8.8) + 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. + //! (From GLSL 4.00.08 specification, section 8.8) + template + genIUType bitfieldReverse(genIUType const & value); + + //! Returns the number of bits set to 1 in the binary representation of value. + //! (From GLSL 4.00.08 specification, section 8.8) + template class C> + typename C::signed_type bitCount(C 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. + //! (From GLSL 4.00.08 specification, section 8.8) + template class C> + typename C::signed_type findLSB(C 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. + //! (From GLSL 4.00.08 specification, section 8.8) + template class C> + typename C::signed_type findMSB(C const & Value); + + }//namespace integer + }//namespace function + }//namespace core + + using namespace core::function::integer; +}//namespace glm + +#include "func_integer.inl" + +#endif//glm_core_func_integer + diff --git a/glm/core/func_integer.inl b/glm/core/func_integer.inl new file mode 100644 index 00000000..be78b414 --- /dev/null +++ b/glm/core/func_integer.inl @@ -0,0 +1,600 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2010-03-17 +// Updated : 2010-03-31 +// Licence : This source is under MIT License +// File : glm/core/func_integer.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace detail + { + + }//namespace detail + + namespace core{ + namespace function{ + namespace integer + { + // uaddCarry + template + inline 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 + inline 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 + inline 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 + inline 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 + inline 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 + inline 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 + inline 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 + inline 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 + inline 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*)&(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1))); + lsb = *(genUType*)&(Value64 >> detail::highp_uint_t(32)); + } + + template + inline 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 + inline 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 + inline 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 + 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*)&(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1))); + lsb = *(genIType*)&(Value64 >> detail::highp_uint_t(32)); + } + + template + inline 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 + inline 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 + inline 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 + genIUType bitfieldExtract + ( + genIUType const & Value, + int const & Offset, + int const & Bits + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer); + assert(Offset + Bits <= sizeof(genIUType)); + + genIUType Result = 0; + if(std::numeric_limits::is_signed) + Result |= (1 << (sizeof(genIUType) * 8 - 1)) & (1 << (Offset + Bits - 1)); + + genIUType Mask = 0; + for(std::size_t Bit = Offset; Bit < Bits; ++Bit) + Mask |= (1 << Bit); + + return Result | ((Mask & Value) >> Offset); + } + + template + inline detail::tvec2 bitfieldExtract + ( + detail::tvec2 const & Value, + int const & Offset, + int const & Bits + ) + { + return detail::tvec2( + bitfieldExtract(Value[0]), + bitfieldExtract(Value[1])); + } + + template + inline detail::tvec3 bitfieldExtract + ( + detail::tvec3 const & Value, + int const & Offset, + int const & Bits + ) + { + return detail::tvec3( + bitfieldExtract(Value[0]), + bitfieldExtract(Value[1]), + bitfieldExtract(Value[2])); + } + + template + inline detail::tvec4 bitfieldExtract + ( + detail::tvec4 const & Value, + int const & Offset, + int const & Bits + ) + { + return detail::tvec4( + bitfieldExtract(Value[0]), + bitfieldExtract(Value[1]), + bitfieldExtract(Value[2]), + bitfieldExtract(Value[3])); + } + + // bitfieldInsert + template + inline genIUType bitfieldInsert + ( + genIUType const & Base, + genIUType const & Insert, + int const & Offset, + int const & Bits + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer); + assert(Offset + Bits <= sizeof(genIUType)); + + if(Bits == 0) + return Base; + + genIUType Mask = 0; + for(std::size_t Bit = Offset; Bit < Offset + Bits; ++Bit) + Mask |= (1 << Bit); + + return (Base & ~Mask) | (Insert & Mask); + } + + template + inline 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 + inline 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 + inline 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 + inline genIUType bitfieldReverse(genIUType const & Value) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer); + + genIUType Result = 0; + for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i) + if(Value & (1 << i)) + Result |= (genIUType(1) << (sizeof(genIUType) * std::size_t(8)) - genIUType(1) - i); + return Result; + } + + template + inline detail::tvec2 bitfieldReverse + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + bitfieldReverse(value[0]), + bitfieldReverse(value[1])); + } + + template + inline detail::tvec3 bitfieldReverse + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + bitfieldReverse(value[0]), + bitfieldReverse(value[1]), + bitfieldReverse(value[2])); + } + + template + inline detail::tvec4 bitfieldReverse + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + bitfieldReverse(value[0]), + bitfieldReverse(value[1]), + bitfieldReverse(value[2]), + bitfieldReverse(value[3])); + } + + // bitCount + template + int bitCount(genIUType const & Value) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer); + + 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 + inline detail::tvec2 bitCount + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + bitCount(value[0]), + bitCount(value[1])); + } + + template + inline detail::tvec3 bitCount + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + bitCount(value[0]), + bitCount(value[1]), + bitCount(value[2])); + } + + template + inline detail::tvec4 bitCount + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + bitCount(value[0]), + bitCount(value[1]), + bitCount(value[2]), + bitCount(value[3])); + } + + // findLSB + template + inline int findLSB + ( + genIUType const & Value + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer); + if(Value == 0) + return -1; + + genIUType Bit; + for(Bit = genIUType(0); !(Value & (1 << Bit)); ++Bit){} + return Bit; + } + + template + inline detail::tvec2 findLSB + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + findLSB(value[0]), + findLSB(value[1])); + } + + template + inline detail::tvec3 findLSB + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + findLSB(value[0]), + findLSB(value[1]), + findLSB(value[2])); + } + + template + inline detail::tvec4 findLSB + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + findLSB(value[0]), + findLSB(value[1]), + findLSB(value[2]), + findLSB(value[3])); + } + + // findMSB + template + inline int findMSB + ( + genIUType const & Value + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer); + if(Value == 0) + return -1; + + genIUType bit = genIUType(-1); + for(genIUType tmp = Value; tmp; tmp >>= 1, ++bit){} + return bit; + } + + template + inline detail::tvec2 findMSB + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + findMSB(value[0]), + findMSB(value[1])); + } + + template + inline detail::tvec3 findMSB + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + findMSB(value[0]), + findMSB(value[1]), + findMSB(value[2])); + } + + template + inline detail::tvec4 findMSB + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + findMSB(value[0]), + findMSB(value[1]), + findMSB(value[2]), + findMSB(value[3])); + } + + }//namespace integer + }//namespace function + }//namespace core +}//namespace glm diff --git a/glm/core/func_matrix.hpp b/glm/core/func_matrix.hpp index 88a2a417..a7cc5327 100644 --- a/glm/core/func_matrix.hpp +++ b/glm/core/func_matrix.hpp @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-03 -// Updated : 2008-08-03 +// Updated : 2010-02-04 // Licence : This source is under MIT License -// File : glm/core/func_matrix.h +// File : glm/core/func_matrix.hpp /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_matrix @@ -25,31 +25,60 @@ namespace glm //! result[i][j] is the scalar product of x[i][j] and y[i][j]. //! (From GLSL 1.30.08 specification, section 8.5) template - matType matrixCompMult(matType const & x, matType const & y); + 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. //! (From GLSL 1.30.08 specification, section 8.5) template - matType outerProduct(vecType const & c, vecType const & r); + matType outerProduct( + vecType const & c, + vecType const & r); //! Returns the transposed matrix of x //! (From GLSL 1.30.08 specification, section 8.5) template - typename matType::transpose_type transpose(matType const & x); + typename matType::transpose_type transpose( + matType const & x); - //! Return the determinant of a matrix. - //! (From GLSL 1.50.09 specification, section 8.5). genType: mat2, mat3, mat4. - template - typename genType::value_type determinant( - genType const & m); + //! Return the determinant of a mat2 matrix. + //! (From GLSL 1.50.09 specification, section 8.5).. + template + typename detail::tmat2x2::value_type determinant( + detail::tmat2x2 const & m); - //! Return the inverse of a matrix. - //! (From GLSL 1.40.07 specification, section 8.5). genType: mat2, mat3, mat4. - template - genType inverse( - genType const & m); + //! Return the determinant of a mat3 matrix. + //! (From GLSL 1.50.09 specification, section 8.5). + template + typename detail::tmat3x3::value_type determinant( + detail::tmat3x3 const & m); + + //! Return the determinant of a mat4 matrix. + //! (From GLSL 1.50.09 specification, section 8.5). + template + typename detail::tmat4x4::value_type determinant( + detail::tmat4x4 const & m); + + //! Return the inverse of a mat2 matrix. + //! (From GLSL 1.40.07 specification, section 8.5). + template + detail::tmat2x2 inverse( + detail::tmat2x2 const & m); + + //! Return the inverse of a mat3 matrix. + //! (From GLSL 1.40.07 specification, section 8.5). + template + detail::tmat3x3 inverse( + detail::tmat3x3 const & m); + + //! Return the inverse of a mat4 matrix. + //! (From GLSL 1.40.07 specification, section 8.5). + template + detail::tmat4x4 inverse( + detail::tmat4x4 const & m); }//namespace matrix }//namespace function diff --git a/glm/core/func_matrix.inl b/glm/core/func_matrix.inl index 42b45bc1..5ec3efac 100644 --- a/glm/core/func_matrix.inl +++ b/glm/core/func_matrix.inl @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-03-08 -// Updated : 2008-03-08 +// Updated : 2010-02-04 // Licence : This source is under MIT License // File : glm/core/func_matrix.inl /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -14,142 +14,6 @@ namespace glm namespace matrix{ // matrixCompMult -/* - template - inline detail::tmat2x2 matrixCompMult - ( - detail::tmat2x2 const & x, - detail::tmat2x2 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float); - - detail::tmat2x2 result; - for(std::size_t i = 0; i < detail::tmat2x2::col_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } - - template - inline detail::tmat3x3 matrixCompMult - ( - detail::tmat3x3 const & x, - detail::tmat3x3 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float); - - detail::tmat3x3 result; - for(std::size_t i = 0; i < detail::tmat3x3::col_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } - - template - inline detail::tmat4x4 matrixCompMult - ( - detail::tmat4x4 const & x, - detail::tmat4x4 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float); - - detail::tmat4x4 result; - for(std::size_t i = 0; i < detail::tmat4x4::col_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } - - template - inline detail::tmat2x3 matrixCompMult - ( - detail::tmat2x3 const & x, - detail::tmat2x3 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float); - - detail::tmat2x3 result; - for(std::size_t i = 0; i < detail::tmat2x3::col_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } - - template - inline detail::tmat3x2 matrixCompMult - ( - detail::tmat3x2 const & x, - detail::tmat3x2 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float); - - detail::tmat3x2 result; - for(std::size_t i = 0; i < detail::tmat3x2::col_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } - - template - inline detail::tmat2x4 matrixCompMult - ( - detail::tmat2x4 const & x, - detail::tmat2x4 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float); - - detail::tmat2x4 result; - for(std::size_t i = 0; i < detail::tmat2x4::col_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } - - template - inline detail::tmat4x2 matrixCompMult - ( - detail::tmat4x2 const & x, - detail::tmat4x2 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float); - - detail::tmat4x2 result; - for(std::size_t i = 0; i < detail::tmat4x2::col_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } - - template - inline detail::tmat3x4 matrixCompMult - ( - detail::tmat3x4 const & x, - detail::tmat3x4 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float); - - detail::tmat3x4 result; - for(std::size_t i = 0; i < detail::tmat3x4::col_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } - - template - inline detail::tmat4x3 matrixCompMult - ( - detail::tmat4x3 const & x, - detail::tmat4x3 const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float); - - detail::tmat4x3 result; - for(std::size_t i = 0; i < detail::tmat4x3::col_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } -*/ template inline matType matrixCompMult ( @@ -159,23 +23,23 @@ namespace glm { GLM_STATIC_ASSERT(detail::type::is_float); - matType result; + matType result(matType::null); for(typename matType::size_type i = 0; i < matType::col_size(); ++i) result[i] = x[i] * y[i]; return result; } // outerProduct - template - inline detail::tmat2x2 outerProduct + template + inline detail::tmat2x2 outerProduct ( - detail::tvec2 const & c, - detail::tvec2 const & r + detail::tvec2 const & c, + detail::tvec2 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat2x2 m; + 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]; @@ -183,46 +47,46 @@ namespace glm return m; } - template - inline detail::tmat3x3 outerProduct + template + inline detail::tmat3x3 outerProduct ( - detail::tvec3 const & c, - detail::tvec3 const & r + detail::tvec3 const & c, + detail::tvec3 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat3x3 m; - for(typename detail::tmat3x3::size_type i = 0; i < detail::tmat3x3::col_size(); ++i) + detail::tmat3x3 m(detail::tmat3x3::null); + for(typename detail::tmat3x3::size_type i = 0; i < detail::tmat3x3::col_size(); ++i) m[i] = c * r[i]; return m; } - template - inline detail::tmat4x4 outerProduct + template + inline detail::tmat4x4 outerProduct ( - detail::tvec4 const & c, - detail::tvec4 const & r + detail::tvec4 const & c, + detail::tvec4 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat4x4 m; - for(typename detail::tmat4x4::size_type i = 0; i < detail::tmat4x4::col_size(); ++i) + detail::tmat4x4 m(detail::tmat4x4::null); + for(typename detail::tmat4x4::size_type i = 0; i < detail::tmat4x4::col_size(); ++i) m[i] = c * r[i]; return m; } - template - inline detail::tmat2x3 outerProduct + template + inline detail::tmat2x3 outerProduct ( - detail::tvec3 const & c, - detail::tvec2 const & r + detail::tvec3 const & c, + detail::tvec2 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat2x3 m; + 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; @@ -232,16 +96,16 @@ namespace glm return m; } - template - inline detail::tmat3x2 outerProduct + template + inline detail::tmat3x2 outerProduct ( - detail::tvec2 const & c, - detail::tvec3 const & r + detail::tvec2 const & c, + detail::tvec3 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat3x2 m; + 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; @@ -251,16 +115,16 @@ namespace glm return m; } - template - inline detail::tmat2x4 outerProduct + template + inline detail::tmat2x4 outerProduct ( - detail::tvec2 const & c, - detail::tvec4 const & r + detail::tvec2 const & c, + detail::tvec4 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat2x4 m; + 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; @@ -272,16 +136,16 @@ namespace glm return m; } - template - inline detail::tmat4x2 outerProduct + template + inline detail::tmat4x2 outerProduct ( - detail::tvec4 const & c, - detail::tvec2 const & r + detail::tvec4 const & c, + detail::tvec2 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat4x2 m; + 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; @@ -293,16 +157,16 @@ namespace glm return m; } - template - inline detail::tmat3x4 outerProduct + template + inline detail::tmat3x4 outerProduct ( - detail::tvec4 const & c, - detail::tvec3 const & r + detail::tvec4 const & c, + detail::tvec3 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat3x4 m; + 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; @@ -318,16 +182,16 @@ namespace glm return m; } - template - inline detail::tmat4x3 outerProduct + template + inline detail::tmat4x3 outerProduct ( - detail::tvec3 const & c, - detail::tvec4 const & r + detail::tvec3 const & c, + detail::tvec4 const & r ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat4x3 m; + 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; @@ -343,15 +207,15 @@ namespace glm return m; } - template - inline detail::tmat2x2 transpose + template + inline detail::tmat2x2 transpose ( - detail::tmat2x2 const & m + detail::tmat2x2 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat2x2 result; + detail::tmat2x2 result(detail::tmat2x2::null); result[0][0] = m[0][0]; result[0][1] = m[1][0]; result[1][0] = m[0][1]; @@ -359,15 +223,15 @@ namespace glm return result; } - template - inline detail::tmat3x3 transpose + template + inline detail::tmat3x3 transpose ( - detail::tmat3x3 const & m + detail::tmat3x3 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat3x3 result; + detail::tmat3x3 result(detail::tmat3x3::null); result[0][0] = m[0][0]; result[0][1] = m[1][0]; result[0][2] = m[2][0]; @@ -382,15 +246,15 @@ namespace glm return result; } - template - inline detail::tmat4x4 transpose + template + inline detail::tmat4x4 transpose ( - detail::tmat4x4 const & m + detail::tmat4x4 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat4x4 result; + detail::tmat4x4 result(detail::tmat4x4::null); result[0][0] = m[0][0]; result[0][1] = m[1][0]; result[0][2] = m[2][0]; @@ -413,15 +277,15 @@ namespace glm return result; } - template - inline detail::tmat2x3 transpose + template + inline detail::tmat2x3 transpose ( - detail::tmat3x2 const & m + detail::tmat3x2 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat2x3 result; + detail::tmat2x3 result(detail::tmat2x3::null); result[0][0] = m[0][0]; result[0][1] = m[1][0]; result[0][2] = m[2][0]; @@ -431,15 +295,15 @@ namespace glm return result; } - template - inline detail::tmat3x2 transpose + template + inline detail::tmat3x2 transpose ( - detail::tmat2x3 const & m + detail::tmat2x3 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat3x2 result; + detail::tmat3x2 result(detail::tmat3x2::null); result[0][0] = m[0][0]; result[0][1] = m[1][0]; result[1][0] = m[0][1]; @@ -449,15 +313,15 @@ namespace glm return result; } - template - inline detail::tmat2x4 transpose + template + inline detail::tmat2x4 transpose ( - detail::tmat4x2 const & m + detail::tmat4x2 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat2x4 result; + detail::tmat2x4 result(detail::tmat2x4::null); result[0][0] = m[0][0]; result[0][1] = m[1][0]; result[0][2] = m[2][0]; @@ -469,15 +333,15 @@ namespace glm return result; } - template - inline detail::tmat4x2 transpose + template + inline detail::tmat4x2 transpose ( - detail::tmat2x4 const & m + detail::tmat2x4 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat4x2 result; + detail::tmat4x2 result(detail::tmat4x2::null); result[0][0] = m[0][0]; result[0][1] = m[1][0]; result[1][0] = m[0][1]; @@ -489,15 +353,15 @@ namespace glm return result; } - template - inline detail::tmat3x4 transpose + template + inline detail::tmat3x4 transpose ( - detail::tmat4x3 const & m + detail::tmat4x3 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat3x4 result; + detail::tmat3x4 result(detail::tmat3x4::null); result[0][0] = m[0][0]; result[0][1] = m[1][0]; result[0][2] = m[2][0]; @@ -513,15 +377,15 @@ namespace glm return result; } - template - inline detail::tmat4x3 transpose + template + inline detail::tmat4x3 transpose ( - detail::tmat3x4 const & m + detail::tmat3x4 const & m ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - detail::tmat4x3 result; + detail::tmat4x3 result(detail::tmat4x3::null); result[0][0] = m[0][0]; result[0][1] = m[1][0]; result[0][2] = m[2][0]; @@ -537,40 +401,41 @@ namespace glm return result; } - template - inline typename detail::tmat2x2::value_type determinant + template + inline typename detail::tmat2x2::value_type determinant ( - detail::tmat2x2 const & m + detail::tmat2x2 const & m ) { return m[0][0] * m[1][1] - m[1][0] * m[0][1]; } - template - inline typename detail::tmat3x3::value_type determinant + template + inline typename detail::tmat3x3::value_type determinant ( - detail::tmat3x3 const & m + detail::tmat3x3 const & m ) { - return m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2]) + 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 - inline typename detail::tmat4x4::value_type determinant + template + inline typename detail::tmat4x4::value_type determinant ( - detail::tmat4x4 const & m + detail::tmat4x4 const & m ) { - valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; - valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; - valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; - valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; - valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; - valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; + 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( + 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), @@ -582,16 +447,16 @@ namespace glm + m[0][3] * DetCof[3]; } - template - inline detail::tmat2x2 inverse + template + inline detail::tmat2x2 inverse ( - detail::tmat2x2 const & m + detail::tmat2x2 const & m ) { //valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1]; - valType Determinant = determinant(m); + T Determinant = determinant(m); - detail::tmat2x2 Inverse( + detail::tmat2x2 Inverse( + m[1][1] / Determinant, - m[1][0] / Determinant, - m[0][1] / Determinant, @@ -600,19 +465,19 @@ namespace glm return Inverse; } - template - inline detail::tmat3x3 inverse + template + inline detail::tmat3x3 inverse ( - detail::tmat3x3 const & m + detail::tmat3x3 const & m ) { //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]); - valType Determinant = determinant(m); + T Determinant = determinant(m); - detail::tmat3x3 Inverse; + 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]); @@ -627,127 +492,61 @@ namespace glm return Inverse; } - template - inline detail::tmat4x4 inverseOgre + template + inline detail::tmat4x4 inverse ( - detail::tmat4x4 const & m - ) - { - valType m00 = m[0][0], m01 = m[0][1], m02 = m[0][2], m03 = m[0][3]; - valType m10 = m[1][0], m11 = m[1][1], m12 = m[1][2], m13 = m[1][3]; - valType m20 = m[2][0], m21 = m[2][1], m22 = m[2][2], m23 = m[2][3]; - valType m30 = m[3][0], m31 = m[3][1], m32 = m[3][2], m33 = m[3][3]; - - valType v0 = m20 * m31 - m21 * m30; - valType v1 = m20 * m32 - m22 * m30; - valType v2 = m20 * m33 - m23 * m30; - valType v3 = m21 * m32 - m22 * m31; - valType v4 = m21 * m33 - m23 * m31; - valType v5 = m22 * m33 - m23 * m32; - - valType t00 = + (v5 * m11 - v4 * m12 + v3 * m13); - valType t10 = - (v5 * m10 - v2 * m12 + v1 * m13); - valType t20 = + (v4 * m10 - v2 * m11 + v0 * m13); - valType t30 = - (v3 * m10 - v1 * m11 + v0 * m12); - - valType invDet = 1 / (t00 * m00 + t10 * m01 + t20 * m02 + t30 * m03); - - valType d00 = t00 * invDet; - valType d10 = t10 * invDet; - valType d20 = t20 * invDet; - valType d30 = t30 * invDet; - - valType d01 = - (v5 * m01 - v4 * m02 + v3 * m03) * invDet; - valType d11 = + (v5 * m00 - v2 * m02 + v1 * m03) * invDet; - valType d21 = - (v4 * m00 - v2 * m01 + v0 * m03) * invDet; - valType d31 = + (v3 * m00 - v1 * m01 + v0 * m02) * invDet; - - v0 = m10 * m31 - m11 * m30; - v1 = m10 * m32 - m12 * m30; - v2 = m10 * m33 - m13 * m30; - v3 = m11 * m32 - m12 * m31; - v4 = m11 * m33 - m13 * m31; - v5 = m12 * m33 - m13 * m32; - - valType d02 = + (v5 * m01 - v4 * m02 + v3 * m03) * invDet; - valType d12 = - (v5 * m00 - v2 * m02 + v1 * m03) * invDet; - valType d22 = + (v4 * m00 - v2 * m01 + v0 * m03) * invDet; - valType d32 = - (v3 * m00 - v1 * m01 + v0 * m02) * invDet; - - v0 = m21 * m10 - m20 * m11; - v1 = m22 * m10 - m20 * m12; - v2 = m23 * m10 - m20 * m13; - v3 = m22 * m11 - m21 * m12; - v4 = m23 * m11 - m21 * m13; - v5 = m23 * m12 - m22 * m13; - - valType d03 = - (v5 * m01 - v4 * m02 + v3 * m03) * invDet; - valType d13 = + (v5 * m00 - v2 * m02 + v1 * m03) * invDet; - valType d23 = - (v4 * m00 - v2 * m01 + v0 * m03) * invDet; - valType d33 = + (v3 * m00 - v1 * m01 + v0 * m02) * invDet; - - return detail::tmat4x4( - d00, d01, d02, d03, - d10, d11, d12, d13, - d20, d21, d22, d23, - d30, d31, d32, d33); - } - - template - inline detail::tmat4x4 inverse - ( - detail::tmat4x4 const & m + detail::tmat4x4 const & m ) { - valType Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; - valType Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3]; - valType Coef03 = m[1][2] * m[2][3] - m[2][2] * m[1][3]; + 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]; - valType Coef04 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; - valType Coef06 = m[1][1] * m[3][3] - m[3][1] * m[1][3]; - valType Coef07 = m[1][1] * m[2][3] - m[2][1] * 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]; - valType Coef08 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; - valType Coef10 = m[1][1] * m[3][2] - m[3][1] * m[1][2]; - valType Coef11 = m[1][1] * m[2][2] - m[2][1] * m[1][2]; + 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]; - valType Coef12 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; - valType Coef14 = m[1][0] * m[3][3] - m[3][0] * m[1][3]; - valType Coef15 = m[1][0] * m[2][3] - m[2][0] * m[1][3]; + 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]; - valType Coef16 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; - valType Coef18 = m[1][0] * m[3][2] - m[3][0] * m[1][2]; - valType Coef19 = m[1][0] * m[2][2] - m[2][0] * m[1][2]; + 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]; - valType Coef20 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; - valType Coef22 = m[1][0] * m[3][1] - m[3][0] * m[1][1]; - valType Coef23 = m[1][0] * m[2][1] - m[2][0] * m[1][1]; + 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 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 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 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::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::tmat4x4 Inverse(Inv0, Inv1, Inv2, Inv3); - detail::tvec4 Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]); + detail::tvec4 Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]); - valType Determinant = glm::dot(m[0], Row0); + T Determinant = glm::dot(m[0], Row0); Inverse /= Determinant; diff --git a/glm/core/func_noise.hpp b/glm/core/func_noise.hpp index 8537ff4b..1b1a7034 100644 --- a/glm/core/func_noise.hpp +++ b/glm/core/func_noise.hpp @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-01 // Updated : 2008-09-10 // Licence : This source is under MIT License -// File : glm/core/func_noise.h +// File : glm/core/func_noise.hpp /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_noise diff --git a/glm/core/func_noise.inl b/glm/core/func_noise.inl index b6cd4f26..f2787c07 100644 --- a/glm/core/func_noise.inl +++ b/glm/core/func_noise.inl @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-01 // Updated : 2008-09-23 @@ -26,38 +26,38 @@ namespace glm return genType(int(iNbr / genType(65536)) % 32768) / genType(32767); } - template - inline typename detail::tvec2::value_type noise1 + template + inline typename detail::tvec2::value_type noise1 ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - valType tmp(0); - for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + T tmp(0); + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) tmp += x[i]; return noise1(tmp); } - template - inline typename detail::tvec3::value_type noise1 + template + inline typename detail::tvec3::value_type noise1 ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - valType tmp(0); - for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + T tmp(0); + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) tmp += x[i]; return noise1(tmp); } - template - inline typename detail::tvec4::value_type noise1 + template + inline typename detail::tvec4::value_type noise1 ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - valType tmp(0); - for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + T tmp(0); + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) tmp += x[i]; return noise1(tmp); } @@ -78,59 +78,59 @@ namespace glm noise1(f2)); } - template - inline detail::tvec2 noise2 + template + inline detail::tvec2 noise2 ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType f0(0); - for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + T f0(0); + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) f0 += x[i]; - valType f1 = f0 * valType(1103515245) + valType(12345); - valType f2 = f1 * valType(1103515245) + valType(12345); - return detail::tvec2( + T f1 = f0 * T(1103515245) + T(12345); + T f2 = f1 * T(1103515245) + T(12345); + return detail::tvec2( noise1(f1), noise1(f2)); } - template - inline detail::tvec2 noise2 + template + inline detail::tvec2 noise2 ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType f0(0); - for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + T f0(0); + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) f0 += x[i]; - valType f1 = f0 * valType(1103515245) + valType(12345); - valType f2 = f1 * valType(1103515245) + valType(12345); - return detail::tvec2( + T f1 = f0 * T(1103515245) + T(12345); + T f2 = f1 * T(1103515245) + T(12345); + return detail::tvec2( noise1(f1), noise1(f2)); } - template - inline detail::tvec2 noise2 + template + inline detail::tvec2 noise2 ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType f0(0); - for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + T f0(0); + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) f0 += x[i]; - valType f1 = f0 * valType(1103515245) + valType(12345); - valType f2 = f1 * valType(1103515245) + valType(12345); - return detail::tvec2( + T f1 = f0 * T(1103515245) + T(12345); + T f2 = f1 * T(1103515245) + T(12345); + return detail::tvec2( noise1(f1), noise1(f2)); } @@ -153,61 +153,61 @@ namespace glm noise1(f3)); } - template - inline detail::tvec3 noise3 + template + inline detail::tvec3 noise3 ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType f0(0); - for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + T f0(0); + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) f0 += x[i]; - valType f1 = f0 * valType(1103515245) + valType(12345); - valType f2 = f1 * valType(1103515245) + valType(12345); - valType f3 = f2 * valType(1103515245) + valType(12345); - return detail::tvec3( + T f1 = f0 * T(1103515245) + T(12345); + T f2 = f1 * T(1103515245) + T(12345); + T f3 = f2 * T(1103515245) + T(12345); + return detail::tvec3( noise1(f1), noise1(f2), noise1(f3)); } - template - inline detail::tvec3 noise3 + template + inline detail::tvec3 noise3 ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType f0(0); - for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + T f0(0); + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) f0 += x[i]; - valType f1 = f0 * valType(1103515245) + valType(12345); - valType f2 = f1 * valType(1103515245) + valType(12345); - valType f3 = f2 * valType(1103515245) + valType(12345); - return detail::tvec3( + T f1 = f0 * T(1103515245) + T(12345); + T f2 = f1 * T(1103515245) + T(12345); + T f3 = f2 * T(1103515245) + T(12345); + return detail::tvec3( noise1(f1), noise1(f2), noise1(f3)); } - template - inline detail::tvec3 noise3 + template + inline detail::tvec3 noise3 ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType f0(0); - for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + T f0(0); + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) f0 += x[i]; - valType f1 = f0 * valType(1103515245) + valType(12345); - valType f2 = f1 * valType(1103515245) + valType(12345); - valType f3 = f2 * valType(1103515245) + valType(12345); - return detail::tvec3( + T f1 = f0 * T(1103515245) + T(12345); + T f2 = f1 * T(1103515245) + T(12345); + T f3 = f2 * T(1103515245) + T(12345); + return detail::tvec3( noise1(f1), noise1(f2), noise1(f3)); @@ -233,66 +233,66 @@ namespace glm noise1(f4)); } - template - inline detail::tvec4 noise4 + template + inline detail::tvec4 noise4 ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType f0(0); - for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + T f0(0); + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) f0 += x[i]; - valType f1 = f0 * valType(1103515245) + valType(12345); - valType f2 = f1 * valType(1103515245) + valType(12345); - valType f3 = f2 * valType(1103515245) + valType(12345); - valType f4 = f3 * valType(1103515245) + valType(12345); - return detail::tvec4( + T f1 = f0 * T(1103515245) + T(12345); + T f2 = f1 * T(1103515245) + T(12345); + T f3 = f2 * T(1103515245) + T(12345); + T f4 = f3 * T(1103515245) + T(12345); + return detail::tvec4( noise1(f1), noise1(f2), noise1(f3), noise1(f4)); } - template - inline detail::tvec4 noise4 + template + inline detail::tvec4 noise4 ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType f0(0); - for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + T f0(0); + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size()(); ++i) f0 += x[i]; - valType f1 = f0 * valType(1103515245) + valType(12345); - valType f2 = f1 * valType(1103515245) + valType(12345); - valType f3 = f2 * valType(1103515245) + valType(12345); - valType f4 = f3 * valType(1103515245) + valType(12345); - return detail::tvec4( + T f1 = f0 * T(1103515245) + T(12345); + T f2 = f1 * T(1103515245) + T(12345); + T f3 = f2 * T(1103515245) + T(12345); + T f4 = f3 * T(1103515245) + T(12345); + return detail::tvec4( noise1(f1), noise1(f2), noise1(f3), noise1(f4)); } - template - inline detail::tvec4 noise4 + template + inline detail::tvec4 noise4 ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float); - valType f0(0); - for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + T f0(0); + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size()(); ++i) f0 += x[i]; - valType f1 = f0 * valType(1103515245) + valType(12345); - valType f2 = f1 * valType(1103515245) + valType(12345); - valType f3 = f2 * valType(1103515245) + valType(12345); - valType f4 = f3 * valType(1103515245) + valType(12345); - return detail::tvec4( + T f1 = f0 * T(1103515245) + T(12345); + T f2 = f1 * T(1103515245) + T(12345); + T f3 = f2 * T(1103515245) + T(12345); + T f4 = f3 * T(1103515245) + T(12345); + return detail::tvec4( noise1(f1), noise1(f2), noise1(f3), diff --git a/glm/core/func_packing.hpp b/glm/core/func_packing.hpp new file mode 100644 index 00000000..3dea30ad --- /dev/null +++ b/glm/core/func_packing.hpp @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2010-03-17 +// Updated : 2010-03-17 +// Licence : This source is under MIT License +// File : glm/core/func_packing.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_packing +#define glm_core_func_packing + +namespace glm +{ + namespace test{ + void main_core_func_packing(); + }//namespace test + + namespace core{ + namespace function{ + //! Define packing functions from section 8.4 floating-point pack and unpack functions of GLSL 4.00.8 specification + namespace packing + { + uint packUnorm2x16(vec2 const & v); + uint packUnorm4x8(vec4 const & v); + uint packSnorm4x8(vec4 const & v); + + vec2 unpackUnorm2x16(uint const & p); + vec4 unpackUnorm4x8(uint const & p); + vec4 unpackSnorm4x8(uint const & p); + + double packDouble2x32(uvec2 const & v); + uvec2 unpackDouble2x32(double const & v); + + }//namespace packing + }//namespace function + }//namespace core + + using namespace core::function::packing; +}//namespace glm + +#include "func_packing.inl" + +#endif//glm_core_func_packing + diff --git a/glm/core/func_packing.inl b/glm/core/func_packing.inl new file mode 100644 index 00000000..83e174d3 --- /dev/null +++ b/glm/core/func_packing.inl @@ -0,0 +1,25 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2010-03-17 +// Updated : 2010-03-17 +// Licence : This source is under MIT License +// File : glm/core/func_packing.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace detail + { + + }//namespace detail + + namespace core{ + namespace function{ + namespace packing{ + + + }//namespace packing + }//namespace function + }//namespace core +}//namespace glm diff --git a/glm/core/func_trigonometric.hpp b/glm/core/func_trigonometric.hpp index 55917b1a..032ff74e 100644 --- a/glm/core/func_trigonometric.hpp +++ b/glm/core/func_trigonometric.hpp @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-01 // Updated : 2008-09-10 // Licence : This source is under MIT License -// File : glm/core/func_trigonometric.h +// File : glm/core/func_trigonometric.hpp /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_trigonometric diff --git a/glm/core/func_trigonometric.inl b/glm/core/func_trigonometric.inl index 93f97c45..b4993bed 100644 --- a/glm/core/func_trigonometric.inl +++ b/glm/core/func_trigonometric.inl @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-03 // Updated : 2008-09-14 @@ -26,36 +26,36 @@ namespace glm return degrees * (pi / genType(180)); } - template - inline detail::tvec2 radians + template + inline detail::tvec2 radians ( - detail::tvec2 const & degrees + detail::tvec2 const & degrees ) { - return detail::tvec2( + return detail::tvec2( radians(degrees.x), radians(degrees.y)); } - template - inline detail::tvec3 radians + template + inline detail::tvec3 radians ( - detail::tvec3 const & degrees + detail::tvec3 const & degrees ) { - return detail::tvec3( + return detail::tvec3( radians(degrees.x), radians(degrees.y), radians(degrees.z)); } - template - inline detail::tvec4 radians + template + inline detail::tvec4 radians ( - detail::tvec4 const & degrees + detail::tvec4 const & degrees ) { - return detail::tvec4( + return detail::tvec4( radians(degrees.x), radians(degrees.y), radians(degrees.z), @@ -75,36 +75,36 @@ namespace glm return radians * (genType(180) / pi); } - template - inline detail::tvec2 degrees + template + inline detail::tvec2 degrees ( - detail::tvec2 const & radians + detail::tvec2 const & radians ) { - return detail::tvec2( + return detail::tvec2( degrees(radians.x), degrees(radians.y)); } - template - inline detail::tvec3 degrees + template + inline detail::tvec3 degrees ( - detail::tvec3 const & radians + detail::tvec3 const & radians ) { - return detail::tvec3( + return detail::tvec3( degrees(radians.x), degrees(radians.y), degrees(radians.z)); } - template - inline detail::tvec4 degrees + template + inline detail::tvec4 degrees ( - detail::tvec4 const & radians + detail::tvec4 const & radians ) { - return detail::tvec4( + return detail::tvec4( degrees(radians.x), degrees(radians.y), degrees(radians.z), @@ -123,36 +123,36 @@ namespace glm return ::std::sin(angle); } - template - inline detail::tvec2 sin + template + inline detail::tvec2 sin ( - detail::tvec2 const & angle + detail::tvec2 const & angle ) { - return detail::tvec2( + return detail::tvec2( sin(angle.x), sin(angle.y)); } - template - inline detail::tvec3 sin + template + inline detail::tvec3 sin ( - detail::tvec3 const & angle + detail::tvec3 const & angle ) { - return detail::tvec3( + return detail::tvec3( sin(angle.x), sin(angle.y), sin(angle.z)); } - template - inline detail::tvec4 sin + template + inline detail::tvec4 sin ( - detail::tvec4 const & angle + detail::tvec4 const & angle ) { - return detail::tvec4( + return detail::tvec4( sin(angle.x), sin(angle.y), sin(angle.z), @@ -168,36 +168,36 @@ namespace glm return ::std::cos(angle); } - template - inline detail::tvec2 cos + template + inline detail::tvec2 cos ( - detail::tvec2 const & angle + detail::tvec2 const & angle ) { - return detail::tvec2( + return detail::tvec2( cos(angle.x), cos(angle.y)); } - template - inline detail::tvec3 cos + template + inline detail::tvec3 cos ( - detail::tvec3 const & angle + detail::tvec3 const & angle ) { - return detail::tvec3( + return detail::tvec3( cos(angle.x), cos(angle.y), cos(angle.z)); } - template - inline detail::tvec4 cos + template + inline detail::tvec4 cos ( - detail::tvec4 const & angle + detail::tvec4 const & angle ) { - return detail::tvec4( + return detail::tvec4( cos(angle.x), cos(angle.y), cos(angle.z), @@ -216,36 +216,36 @@ namespace glm return ::std::tan(angle); } - template - inline detail::tvec2 tan + template + inline detail::tvec2 tan ( - detail::tvec2 const & angle + detail::tvec2 const & angle ) { - return detail::tvec2( + return detail::tvec2( tan(angle.x), tan(angle.y)); } - template - inline detail::tvec3 tan + template + inline detail::tvec3 tan ( - detail::tvec3 const & angle + detail::tvec3 const & angle ) { - return detail::tvec3( + return detail::tvec3( tan(angle.x), tan(angle.y), tan(angle.z)); } - template - inline detail::tvec4 tan + template + inline detail::tvec4 tan ( - detail::tvec4 const & angle + detail::tvec4 const & angle ) { - return detail::tvec4( + return detail::tvec4( tan(angle.x), tan(angle.y), tan(angle.z), @@ -264,36 +264,36 @@ namespace glm return ::std::asin(x); } - template - inline detail::tvec2 asin + template + inline detail::tvec2 asin ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( asin(x.x), asin(x.y)); } - template - inline detail::tvec3 asin + template + inline detail::tvec3 asin ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( asin(x.x), asin(x.y), asin(x.z)); } - template - inline detail::tvec4 asin + template + inline detail::tvec4 asin ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( asin(x.x), asin(x.y), asin(x.z), @@ -312,36 +312,36 @@ namespace glm return ::std::acos(x); } - template - inline detail::tvec2 acos + template + inline detail::tvec2 acos ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( acos(x.x), acos(x.y)); } - template - inline detail::tvec3 acos + template + inline detail::tvec3 acos ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( acos(x.x), acos(x.y), acos(x.z)); } - template - inline detail::tvec4 acos + template + inline detail::tvec4 acos ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( acos(x.x), acos(x.y), acos(x.z), @@ -361,39 +361,39 @@ namespace glm return ::std::atan2(y, x); } - template - inline detail::tvec2 atan + template + inline detail::tvec2 atan ( - detail::tvec2 const & y, - detail::tvec2 const & x + detail::tvec2 const & y, + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( atan(y.x, x.x), atan(y.y, x.y)); } - template - inline detail::tvec3 atan + template + inline detail::tvec3 atan ( - detail::tvec3 const & y, - detail::tvec3 const & x + detail::tvec3 const & y, + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( atan(y.x, x.x), atan(y.y, x.y), atan(y.z, x.z)); } - template - inline detail::tvec4 atan + template + inline detail::tvec4 atan ( - detail::tvec4 const & y, - detail::tvec4 const & x + detail::tvec4 const & y, + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( atan(y.x, x.x), atan(y.y, x.y), atan(y.z, x.z), @@ -411,36 +411,36 @@ namespace glm return ::std::atan(x); } - template - inline detail::tvec2 atan + template + inline detail::tvec2 atan ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( atan(x.x), atan(x.y)); } - template - inline detail::tvec3 atan + template + inline detail::tvec3 atan ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( atan(x.x), atan(x.y), atan(x.z)); } - template - inline detail::tvec4 atan + template + inline detail::tvec4 atan ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( atan(x.x), atan(x.y), atan(x.z), @@ -459,36 +459,36 @@ namespace glm return std::sinh(angle); } - template - inline detail::tvec2 sinh + template + inline detail::tvec2 sinh ( - detail::tvec2 const & angle + detail::tvec2 const & angle ) { - return detail::tvec2( + return detail::tvec2( sinh(angle.x), sinh(angle.y)); } - template - inline detail::tvec3 sinh + template + inline detail::tvec3 sinh ( - detail::tvec3 const & angle + detail::tvec3 const & angle ) { - return detail::tvec3( + return detail::tvec3( sinh(angle.x), sinh(angle.y), sinh(angle.z)); } - template - inline detail::tvec4 sinh + template + inline detail::tvec4 sinh ( - detail::tvec4 const & angle + detail::tvec4 const & angle ) { - return detail::tvec4( + return detail::tvec4( sinh(angle.x), sinh(angle.y), sinh(angle.z), @@ -507,36 +507,36 @@ namespace glm return std::cosh(angle); } - template - inline detail::tvec2 cosh + template + inline detail::tvec2 cosh ( - detail::tvec2 const & angle + detail::tvec2 const & angle ) { - return detail::tvec2( + return detail::tvec2( cosh(angle.x), cosh(angle.y)); } - template - inline detail::tvec3 cosh + template + inline detail::tvec3 cosh ( - detail::tvec3 const & angle + detail::tvec3 const & angle ) { - return detail::tvec3( + return detail::tvec3( cosh(angle.x), cosh(angle.y), cosh(angle.z)); } - template - inline detail::tvec4 cosh + template + inline detail::tvec4 cosh ( - detail::tvec4 const & angle + detail::tvec4 const & angle ) { - return detail::tvec4( + return detail::tvec4( cosh(angle.x), cosh(angle.y), cosh(angle.z), @@ -555,36 +555,36 @@ namespace glm return std::tanh(angle); } - template - inline detail::tvec2 tanh + template + inline detail::tvec2 tanh ( - detail::tvec2 const & angle + detail::tvec2 const & angle ) { - return detail::tvec2( + return detail::tvec2( tanh(angle.x), tanh(angle.y)); } - template - inline detail::tvec3 tanh + template + inline detail::tvec3 tanh ( - detail::tvec3 const & angle + detail::tvec3 const & angle ) { - return detail::tvec3( + return detail::tvec3( tanh(angle.x), tanh(angle.y), tanh(angle.z)); } - template - inline detail::tvec4 tanh + template + inline detail::tvec4 tanh ( - detail::tvec4 const & angle + detail::tvec4 const & angle ) { - return detail::tvec4( + return detail::tvec4( tanh(angle.x), tanh(angle.y), tanh(angle.z), @@ -603,36 +603,36 @@ namespace glm return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x)); } - template - inline detail::tvec2 asinh + template + inline detail::tvec2 asinh ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( asinh(x.x), asinh(x.y)); } - template - inline detail::tvec3 asinh + template + inline detail::tvec3 asinh ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( asinh(x.x), asinh(x.y), asinh(x.z)); } - template - inline detail::tvec4 asinh + template + inline detail::tvec4 asinh ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( asinh(x.x), asinh(x.y), asinh(x.z), @@ -653,36 +653,36 @@ namespace glm return log(x + sqrt(x * x - genType(1))); } - template - inline detail::tvec2 acosh + template + inline detail::tvec2 acosh ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( acosh(x.x), acosh(x.y)); } - template - inline detail::tvec3 acosh + template + inline detail::tvec3 acosh ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( acosh(x.x), acosh(x.y), acosh(x.z)); } - template - inline detail::tvec4 acosh + template + inline detail::tvec4 acosh ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( acosh(x.x), acosh(x.y), acosh(x.z), @@ -703,36 +703,36 @@ namespace glm return genType(0.5) * log((genType(1) + x) / (genType(1) - x)); } - template - inline detail::tvec2 atanh + template + inline detail::tvec2 atanh ( - detail::tvec2 const & x + detail::tvec2 const & x ) { - return detail::tvec2( + return detail::tvec2( atanh(x.x), atanh(x.y)); } - template - inline detail::tvec3 atanh + template + inline detail::tvec3 atanh ( - detail::tvec3 const & x + detail::tvec3 const & x ) { - return detail::tvec3( + return detail::tvec3( atanh(x.x), atanh(x.y), atanh(x.z)); } - template - inline detail::tvec4 atanh + template + inline detail::tvec4 atanh ( - detail::tvec4 const & x + detail::tvec4 const & x ) { - return detail::tvec4( + return detail::tvec4( atanh(x.x), atanh(x.y), atanh(x.z), diff --git a/glm/core/func_vector_relational.hpp b/glm/core/func_vector_relational.hpp index 2c7ed6bb..3916d7e5 100644 --- a/glm/core/func_vector_relational.hpp +++ b/glm/core/func_vector_relational.hpp @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-03 // Updated : 2008-09-09 // Licence : This source is under MIT License -// File : glm/core/func_vector_relational.h +// File : glm/core/func_vector_relational.hpp /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_vector_relational @@ -18,53 +18,164 @@ namespace glm namespace core{ namespace function{ - //! Define vector relational functions from Section 8.3 of GLSL 1.30.8 specification. Included in glm namespace. - namespace vector_relational{ + //! Define vector relational functions from Section 8.3 of GLSL 1.30.8 specification. + //! Included in glm namespace. + namespace vector_relational + { + //! Returns the component-wise comparison result of x < y. + //! (From GLSL 1.30.08 specification, section 8.6) + template class vecType> + inline typename vecType::bool_type lessThan + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); - //! Returns the component-wise compare of x < y. - //! (From GLSL 1.30.08 specification, section 8.6) - template - typename vecType::bool_type lessThan(vecType const & x, vecType const & y); + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] < y[i]; + return Result; + } - //! Returns the component-wise compare of x <= y. - //! (From GLSL 1.30.08 specification, section 8.6) - template - typename vecType::bool_type lessThanEqual(vecType const & x, vecType const & y); + //! Returns the component-wise comparison of result x <= y. + //! (From GLSL 1.30.08 specification, section 8.6) + template class vecType> + inline typename vecType::bool_type lessThanEqual + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); - //! Returns the component-wise compare of x > y. - //! (From GLSL 1.30.08 specification, section 8.6) - template - typename vecType::bool_type greaterThan(vecType const & x, vecType const & y); + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] <= y[i]; + return Result; + } - //! Returns the component-wise compare of x >= y. - //! (From GLSL 1.30.08 specification, section 8.6) - template - typename vecType::bool_type greaterThanEqual(vecType const & x, vecType const & y); + //! Returns the component-wise comparison of result x > y. + //! (From GLSL 1.30.08 specification, section 8.6) + template class vecType> + inline typename vecType::bool_type greaterThan + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); - //! Returns the component-wise compare of x == y. - //! (From GLSL 1.30.08 specification, section 8.6) - template - typename vecType::bool_type equal(vecType const & x, vecType const & y); + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] > y[i]; + return Result; + } - //! Returns the component-wise compare of x != y. - //! (From GLSL 1.30.08 specification, section 8.6) - template - typename vecType::bool_type notEqual(vecType const & x, vecType const & y); + //! Returns the component-wise comparison of result x >= y. + //! (From GLSL 1.30.08 specification, section 8.6) + template class vecType> + inline typename vecType::bool_type greaterThanEqual + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); - //! Returns true if any component of x is true. - //! (From GLSL 1.30.08 specification, section 8.6) - template - bool any(vecType const & x); + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] >= y[i]; + return Result; + } - //! Returns true if all components of x are true. - //! (From GLSL 1.30.08 specification, section 8.6) - template - bool all(vecType const & x); + //! Returns the component-wise comparison of result x == y. + //! (From GLSL 1.30.08 specification, section 8.6) + template class vecType> + inline typename vecType::bool_type equal + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint || + detail::type::is_bool); - //! Returns the component-wise logical complement of x. - //! (From GLSL 1.30.08 specification, section 8.6) - template - typename vecType::bool_type not_(vecType const & x); + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] == y[i]; + return Result; + } + + //! Returns the component-wise comparison of result x != y. + //! (From GLSL 1.30.08 specification, section 8.6) + template class vecType> + inline typename vecType::bool_type notEqual + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint || + detail::type::is_bool); + + typename vecType::bool_type Result(vecType::null); + for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) + Result[i] = x[i] != y[i]; + return Result; + } + + //! Returns true if any component of x is true. + //! (From GLSL 1.30.08 specification, section 8.6) + template