File mvmath-0.gitmodule.obscpio of Package reframe

07070100000000000081A40000000000000000000000016938E8EF00000C76000000000000000000000000000000000000002100000000mvmath-0.gitmodule/.clang-format# Clang Format config taken from Linux Kernel source tree.
# Edited by AlynxZhou.
# Licensed with GPL-2.0.
# Need clang-format v7.0.0 or higher.
---
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: false
BinPackParameters: OnePerLine
BraceWrapping:
  AfterClass: false
  AfterControlStatement: false
  AfterEnum: false
  AfterFunction: true
  AfterNamespace: true
  AfterObjCDeclaration: false
  AfterStruct: false
  AfterUnion: false
  AfterExternBlock: false
  BeforeCatch: false
  BeforeElse: false
  IndentBraces: false
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false

ForEachMacros:

IncludeBlocks: Preserve
IncludeCategories:
  - Regex: '.*'
    Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: AfterHash
IndentWidth: 8
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLines:
  AtStartOfBlock: true
  AtStartOfFile: false
  AtEndOfFile: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 8
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: CurrentLine

# Taken from git's rules
PenaltyBreakAssignment: 10
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyExcessCharacter: 100
PenaltyReturnTypeOnItsOwnLine: 60

PointerAlignment: Right
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp03
TabWidth: 8
UseTab: Always
...
07070100000001000081A40000000000000000000000016938E8EF00000007000000000000000000000000000000000000001E00000000mvmath-0.gitmodule/.gitignorebuild/
07070100000002000081A40000000000000000000000016938E8EF00002C5D000000000000000000000000000000000000001B00000000mvmath-0.gitmodule/LICENSE                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
07070100000003000081A40000000000000000000000016938E8EF000002C8000000000000000000000000000000000000001D00000000mvmath-0.gitmodule/README.mdmvmath
======

A simple C implemention of some GLM Matrix and Vector Math functions.
---------------------------------------------------------------------

This library is based on OpenGL left hand coordinate.

You need to link C standard math library libm.so (`-lm`) to use this.

# Data types

- vec2
- vec3
- vec4
- mat4

They are just structs of array.

# Usage

Add it as a submodule to your project and use Meson to build and compile it. If your project does not use Meson, you can directly copy `srcs/mvmath.{c,h}` to your source tree.

If you want to use custom print function, define `MVPRINT` before include `mvmath.h`, for example `#define MVPRINT g_debug`. Otherwise it will use `printf` by default.
07070100000004000081A40000000000000000000000016938E8EF00000093000000000000000000000000000000000000001F00000000mvmath-0.gitmodule/meson.buildmv_c_args = []
if get_option('debug') == true
  warning_level = 3
  mv_c_args += ['-D__DEBUG__']
endif
mv_c_args += ['-std=gnu11']

subdir('srcs')
07070100000005000041ED0000000000000000000000026938E8EF00000000000000000000000000000000000000000000001800000000mvmath-0.gitmodule/srcs07070100000006000081A40000000000000000000000016938E8EF00000385000000000000000000000000000000000000002400000000mvmath-0.gitmodule/srcs/meson.buildsources = files(
  'mvmath.c'
)

headers = files(
  'mvmath.h'
)

dependencies = []
cc = meson.get_compiler('c')
m = cc.find_library('m')
dependencies += [m]

include_directories = []

# This is designed as a project submodule so we add project name as prefix.
if get_option('buildtype') == 'debug'
  mvmath = static_library(
    meson.project_name() + '-mvmath',
    sources: sources,
    c_args: mv_c_args,
    include_directories: include_directories,
    dependencies: dependencies,
    # Do not install static libray, we already linked against it.
    install: false
  )
else
  mvmath = shared_library(
    meson.project_name() + '-mvmath',
    sources: sources,
    c_args: mv_c_args,
    include_directories: include_directories,
    dependencies: dependencies,
    install: true
  )
endif
mvmath_dep = declare_dependency(
  link_with: mvmath,
  include_directories: include_directories('.')
)
07070100000007000081A40000000000000000000000016938E8EF00002FD9000000000000000000000000000000000000002100000000mvmath-0.gitmodule/srcs/mvmath.c#include "mvmath.h"

scalar sabs(scalar s)
{
	return s >= 0 ? s : -s;
}

scalar smax(scalar s1, scalar s2)
{
	return s1 > s2 ? s1 : s2;
}

scalar smin(scalar s1, scalar s2)
{
	return s1 < s2 ? s1 : s2;
}

scalar sclamp(scalar s, scalar min, scalar max)
{
	return smax(min, smin(max, s));
}

scalar sdegrees(scalar radians)
{
	return radians * 180.0f / PI;
}

scalar sradians(scalar degrees)
{
	return degrees * PI / 180.0f;
}

vec2 v2s(scalar s1, scalar s2)
{
	vec2 v;
	v.v[0] = s1;
	v.v[1] = s2;
	return v;
}

vec2 v2v3(vec3 v)
{
	return v2s(v.v[0], v.v[1]);
}

vec2 v2v4(vec4 v)
{
	return v2s(v.v[0], v.v[1]);
}

scalar v2length(vec2 v)
{
	return sqrtf(v2dot(v, v));
}

vec2 v2normalize(vec2 v)
{
	return v2smultiply(v, 1.0f / v2length(v));
}

int v2compare(vec2 v1, vec2 v2)
{
	return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1];
}

vec2 v2abs(vec2 v)
{
	return v2s(sabs(v.v[0]), sabs(v.v[1]));
}

vec2 v2add(vec2 v1, vec2 v2)
{
	return v2s(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1]);
}

vec2 v2substract(vec2 v1, vec2 v2)
{
	return v2s(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1]);
}

scalar v2dot(vec2 v1, vec2 v2)
{
	return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1];
}

vec2 v2smultiply(vec2 v, scalar s)
{
	return v2s(v.v[0] * s, v.v[1] * s);
}

vec2 v2multiply(vec2 v1, vec2 v2)
{
	return v2s(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1]);
}

vec2 v2clamp(vec2 v, vec2 vmin, vec2 vmax)
{
	return v2s(
		sclamp(v.v[0], vmin.v[0], vmax.v[0]),
		sclamp(v.v[1], vmin.v[1], vmax.v[1])
	);
}

vec3 v3s(scalar s1, scalar s2, scalar s3)
{
	vec3 v;
	v.v[0] = s1;
	v.v[1] = s2;
	v.v[2] = s3;
	return v;
}

vec3 v3v2s(vec2 v, scalar s)
{
	return v3s(v.v[0], v.v[1], s);
}

vec3 v3v4(vec4 v)
{
	return v3s(v.v[0], v.v[1], v.v[2]);
}

scalar v3length(vec3 v)
{
	return sqrtf(v3dot(v, v));
}

vec3 v3normalize(vec3 v)
{
	return v3smultiply(v, 1.0f / v3length(v));
}

int v3compare(vec3 v1, vec3 v2)
{
	return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1] && v1.v[2] == v2.v[2];
}

vec3 v3abs(vec3 v)
{
	return v3s(sabs(v.v[0]), sabs(v.v[1]), sabs(v.v[2]));
}

vec3 v3add(vec3 v1, vec3 v2)
{
	return v3s(v1.v[0] + v2.v[0], v1.v[1] + v2.v[1], v1.v[2] + v2.v[2]);
}

vec3 v3substract(vec3 v1, vec3 v2)
{
	return v3s(v1.v[0] - v2.v[0], v1.v[1] - v2.v[1], v1.v[2] - v2.v[2]);
}

vec3 v3cross(vec3 v1, vec3 v2)
{
	return v3s(
		v1.v[1] * v2.v[2] - v1.v[2] * v2.v[1],
		v1.v[2] * v2.v[0] - v1.v[0] * v2.v[2],
		v1.v[0] * v2.v[1] - v1.v[1] * v2.v[0]
	);
}

scalar v3dot(vec3 v1, vec3 v2)
{
	return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1] + v1.v[2] * v2.v[2];
}

vec3 v3smultiply(vec3 v, scalar s)
{
	return v3s(v.v[0] * s, v.v[1] * s, v.v[2] * s);
}

vec3 v3multiply(vec3 v1, vec3 v2)
{
	return v3s(v1.v[0] * v2.v[0], v1.v[1] * v2.v[1], v1.v[2] * v2.v[2]);
}

vec3 v3clamp(vec3 v, vec3 vmin, vec3 vmax)
{
	return v3s(
		sclamp(v.v[0], vmin.v[0], vmax.v[0]),
		sclamp(v.v[1], vmin.v[1], vmax.v[1]),
		sclamp(v.v[2], vmin.v[2], vmax.v[2])
	);
}

vec4 v4s(scalar s1, scalar s2, scalar s3, scalar s4)
{
	vec4 v;
	v.v[0] = s1;
	v.v[1] = s2;
	v.v[2] = s3;
	v.v[3] = s4;
	return v;
}

vec4 v4v2s(vec2 v, scalar s1, scalar s2)
{
	return v4s(v.v[0], v.v[1], s1, s2);
}

vec4 v4v3s(vec3 v, scalar s)
{
	return v4s(v.v[0], v.v[1], v.v[2], s);
}

vec4 v4v2(vec2 v1, vec2 v2)
{
	return v4s(v1.v[0], v1.v[1], v2.v[0], v2.v[1]);
}

scalar v4length(vec4 v)
{
	return sqrtf(v4dot(v, v));
}

vec4 v4normalize(vec4 v)
{
	return v4smultiply(v, 1.0f / v4length(v));
}

int v4compare(vec4 v1, vec4 v2)
{
	return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1] && v1.v[2] == v2.v[2] &&
	       v1.v[3] == v2.v[3];
}

vec4 v4abs(vec4 v)
{
	return v4s(sabs(v.v[0]), sabs(v.v[1]), sabs(v.v[2]), sabs(v.v[3]));
}

vec4 v4add(vec4 v1, vec4 v2)
{
	return v4s(
		v1.v[0] + v2.v[0],
		v1.v[1] + v2.v[1],
		v1.v[2] + v2.v[2],
		v1.v[3] + v2.v[3]
	);
}

vec4 v4substract(vec4 v1, vec4 v2)
{
	return v4s(
		v1.v[0] - v2.v[0],
		v1.v[1] - v2.v[1],
		v1.v[2] - v2.v[2],
		v1.v[3] - v2.v[3]
	);
}

scalar v4dot(vec4 v1, vec4 v2)
{
	return v1.v[0] * v2.v[0] + v1.v[1] * v2.v[1] + v1.v[2] * v2.v[2] +
	       v1.v[3] * v2.v[3];
}

vec4 v4smultiply(vec4 v, scalar s)
{
	return v4s(v.v[0] * s, v.v[1] * s, v.v[2] * s, v.v[3] * s);
}

vec4 v4multiply(vec4 v1, vec4 v2)
{
	return v4s(
		v1.v[0] * v2.v[0],
		v1.v[1] * v2.v[1],
		v1.v[2] * v2.v[2],
		v1.v[3] * v2.v[3]
	);
}

vec4 v4clamp(vec4 v, vec4 vmin, vec4 vmax)
{
	return v4s(
		sclamp(v.v[0], vmin.v[0], vmax.v[0]),
		sclamp(v.v[1], vmin.v[1], vmax.v[1]),
		sclamp(v.v[2], vmin.v[2], vmax.v[2]),
		sclamp(v.v[3], vmin.v[3], vmax.v[3])
	);
}

mat4 m4identity(void)
{
	mat4 m;
	m.m[0] = 1.0f;
	m.m[1] = 0.0f;
	m.m[2] = 0.0f;
	m.m[3] = 0.0f;
	m.m[4] = 0.0f;
	m.m[5] = 1.0f;
	m.m[6] = 0.0f;
	m.m[7] = 0.0f;
	m.m[8] = 0.0f;
	m.m[9] = 0.0f;
	m.m[10] = 1.0f;
	m.m[11] = 0.0f;
	m.m[12] = 0.0f;
	m.m[13] = 0.0f;
	m.m[14] = 0.0f;
	m.m[15] = 1.0f;
	return m;
}

int m4compare(mat4 m1, mat4 m2)
{
	for (unsigned int i = 0; i < 4; ++i)
		for (unsigned int j = 0; j < 4; ++j)
			if (m1.m[i * 4 + j] != m2.m[i * 4 + j])
				return 0;
	return 1;
}

mat4 m4inverse(mat4 m)
{
	mat4 result;
	scalar delta = 0.0f;
	result.m[0] = m.m[5] * m.m[10] * m.m[15] - m.m[5] * m.m[11] * m.m[14] -
		      m.m[9] * m.m[6] * m.m[15] + m.m[9] * m.m[7] * m.m[14] +
		      m.m[13] * m.m[6] * m.m[11] - m.m[13] * m.m[7] * m.m[10];
	result.m[1] = -m.m[1] * m.m[10] * m.m[15] + m.m[1] * m.m[11] * m.m[14] +
		      m.m[9] * m.m[2] * m.m[15] - m.m[9] * m.m[3] * m.m[14] -
		      m.m[13] * m.m[2] * m.m[11] + m.m[13] * m.m[3] * m.m[10];
	result.m[2] = m.m[1] * m.m[6] * m.m[15] - m.m[1] * m.m[7] * m.m[14] -
		      m.m[5] * m.m[2] * m.m[15] + m.m[5] * m.m[3] * m.m[14] +
		      m.m[13] * m.m[2] * m.m[7] - m.m[13] * m.m[3] * m.m[6];
	result.m[3] = -m.m[1] * m.m[6] * m.m[11] + m.m[1] * m.m[7] * m.m[10] +
		      m.m[5] * m.m[2] * m.m[11] - m.m[5] * m.m[3] * m.m[10] -
		      m.m[9] * m.m[2] * m.m[7] + m.m[9] * m.m[3] * m.m[6];
	result.m[4] = -m.m[4] * m.m[10] * m.m[15] + m.m[4] * m.m[11] * m.m[14] +
		      m.m[8] * m.m[6] * m.m[15] - m.m[8] * m.m[7] * m.m[14] -
		      m.m[12] * m.m[6] * m.m[11] + m.m[12] * m.m[7] * m.m[10];
	result.m[5] = m.m[0] * m.m[10] * m.m[15] - m.m[0] * m.m[11] * m.m[14] -
		      m.m[8] * m.m[2] * m.m[15] + m.m[8] * m.m[3] * m.m[14] +
		      m.m[12] * m.m[2] * m.m[11] - m.m[12] * m.m[3] * m.m[10];
	result.m[6] = -m.m[0] * m.m[6] * m.m[15] + m.m[0] * m.m[7] * m.m[14] +
		      m.m[4] * m.m[2] * m.m[15] - m.m[4] * m.m[3] * m.m[14] -
		      m.m[12] * m.m[2] * m.m[7] + m.m[12] * m.m[3] * m.m[6];
	result.m[7] = m.m[0] * m.m[6] * m.m[11] - m.m[0] * m.m[7] * m.m[10] -
		      m.m[4] * m.m[2] * m.m[11] + m.m[4] * m.m[3] * m.m[10] +
		      m.m[8] * m.m[2] * m.m[7] - m.m[8] * m.m[3] * m.m[6];
	result.m[8] = m.m[4] * m.m[9] * m.m[15] - m.m[4] * m.m[11] * m.m[13] -
		      m.m[8] * m.m[5] * m.m[15] + m.m[8] * m.m[7] * m.m[13] +
		      m.m[12] * m.m[5] * m.m[11] - m.m[12] * m.m[7] * m.m[9];
	result.m[9] = -m.m[0] * m.m[9] * m.m[15] + m.m[0] * m.m[11] * m.m[13] +
		      m.m[8] * m.m[1] * m.m[15] - m.m[8] * m.m[3] * m.m[13] -
		      m.m[12] * m.m[1] * m.m[11] + m.m[12] * m.m[3] * m.m[9];
	result.m[10] = m.m[0] * m.m[5] * m.m[15] - m.m[0] * m.m[7] * m.m[13] -
		       m.m[4] * m.m[1] * m.m[15] + m.m[4] * m.m[3] * m.m[13] +
		       m.m[12] * m.m[1] * m.m[7] - m.m[12] * m.m[3] * m.m[5];
	result.m[11] = -m.m[0] * m.m[5] * m.m[11] + m.m[0] * m.m[7] * m.m[9] +
		       m.m[4] * m.m[1] * m.m[11] - m.m[4] * m.m[3] * m.m[9] -
		       m.m[8] * m.m[1] * m.m[7] + m.m[8] * m.m[3] * m.m[5];
	result.m[12] = -m.m[4] * m.m[9] * m.m[14] + m.m[4] * m.m[10] * m.m[13] +
		       m.m[8] * m.m[5] * m.m[14] - m.m[8] * m.m[6] * m.m[13] -
		       m.m[12] * m.m[5] * m.m[10] + m.m[12] * m.m[6] * m.m[9];
	result.m[13] = m.m[0] * m.m[9] * m.m[14] - m.m[0] * m.m[10] * m.m[13] -
		       m.m[8] * m.m[1] * m.m[14] + m.m[8] * m.m[2] * m.m[13] +
		       m.m[12] * m.m[1] * m.m[10] - m.m[12] * m.m[2] * m.m[9];
	result.m[14] = -m.m[0] * m.m[5] * m.m[14] + m.m[0] * m.m[6] * m.m[13] +
		       m.m[4] * m.m[1] * m.m[14] - m.m[4] * m.m[2] * m.m[13] -
		       m.m[12] * m.m[1] * m.m[6] + m.m[12] * m.m[2] * m.m[5];
	result.m[15] = m.m[0] * m.m[5] * m.m[10] - m.m[0] * m.m[6] * m.m[9] -
		       m.m[4] * m.m[1] * m.m[10] + m.m[4] * m.m[2] * m.m[9] +
		       m.m[8] * m.m[1] * m.m[6] - m.m[8] * m.m[2] * m.m[5];
	delta = m.m[0] * m.m[0] + m.m[1] * m.m[4] + m.m[2] * m.m[8] +
		m.m[3] * m.m[12];
	if (delta == 0.0f)
		return m4identity();
	delta = 1.0f / delta;
	for (unsigned int i = 0; i < 16; ++i)
		result.m[i] *= delta;
	return result;
}

mat4 m4transpose(mat4 m)
{
	mat4 result;
	for (unsigned int i = 0; i < 4; ++i)
		for (unsigned int j = 0; j < 4; ++j)
			result.m[i * 4 + j] = m.m[j * 4 + i];
	return result;
}

mat4 m4multiply(mat4 m1, mat4 m2)
{
	mat4 m;
	for (unsigned int i = 0; i < 4; ++i) {
		for (unsigned int j = 0; j < 4; ++j) {
			m.m[i * 4 + j] = 0.0f;
			for (unsigned int k = 0; k < 4; ++k) {
				m.m[i * 4 + j] +=
					m1.m[k * 4 + j] * m2.m[i * 4 + k];
			}
		}
	}
	return m;
}

vec4 m4v4multiply(mat4 m, vec4 v)
{
	vec4 result;
	for (unsigned int i = 0; i < 4; ++i) {
		result.v[i] = 0.0f;
		for (unsigned int j = 0; j < 4; ++j) {
			result.v[i] += m.m[j * 4 + i] * v.v[j];
		}
	}
	return result;
}

mat4 m4translate(vec3 delta)
{
	mat4 m;
	m.m[0] = 1.0f;
	m.m[1] = 0.0f;
	m.m[2] = 0.0f;
	m.m[3] = 0.0f;
	m.m[4] = 0.0f;
	m.m[5] = 1.0f;
	m.m[6] = 0.0f;
	m.m[7] = 0.0f;
	m.m[8] = 0.0f;
	m.m[9] = 0.0f;
	m.m[10] = 1.0f;
	m.m[11] = 0.0f;
	m.m[12] = delta.v[0];
	m.m[13] = delta.v[1];
	m.m[14] = delta.v[2];
	m.m[15] = 1.0f;
	return m;
}

mat4 m4scale(vec3 scale)
{
	mat4 m;
	m.m[0] = scale.v[0];
	m.m[1] = 0.0f;
	m.m[2] = 0.0f;
	m.m[3] = 0.0f;
	m.m[4] = 0.0f;
	m.m[5] = scale.v[1];
	m.m[6] = 0.0f;
	m.m[7] = 0.0f;
	m.m[8] = 0.0f;
	m.m[9] = 0.0f;
	m.m[10] = scale.v[2];
	m.m[11] = 0.0f;
	m.m[12] = 0.0f;
	m.m[13] = 0.0f;
	m.m[14] = 0.0f;
	m.m[15] = 1.0f;
	return m;
}

mat4 m4rotate(vec3 axis, scalar angle)
{
	mat4 m;
	axis = v3normalize(axis);
	const scalar s = sinf(angle);
	const scalar c = cosf(angle);
	const scalar temp = 1.0f - c;
	m.m[0] = temp * axis.v[0] * axis.v[0] + c;
	m.m[1] = temp * axis.v[0] * axis.v[1] - axis.v[2] * s;
	m.m[2] = temp * axis.v[2] * axis.v[0] + axis.v[1] * s;
	m.m[3] = 0.0f;
	m.m[4] = temp * axis.v[0] * axis.v[1] + axis.v[2] * s;
	m.m[5] = temp * axis.v[1] * axis.v[1] + c;
	m.m[6] = temp * axis.v[1] * axis.v[2] - axis.v[0] * s;
	m.m[7] = 0.0f;
	m.m[8] = temp * axis.v[2] * axis.v[0] - axis.v[1] * s;
	m.m[9] = temp * axis.v[1] * axis.v[2] + axis.v[0] * s;
	m.m[10] = temp * axis.v[2] * axis.v[2] + c;
	m.m[11] = 0.0f;
	m.m[12] = 0.0f;
	m.m[13] = 0.0f;
	m.m[14] = 0.0f;
	m.m[15] = 1.0f;
	return m;
}

mat4 m4perspective(scalar fov, scalar aspect, scalar near, scalar far)
{
	mat4 m;
	const scalar dz = near - far;
	const scalar cot = 1.0f / tanf(fov / 2.0f);
	m.m[0] = cot / aspect;
	m.m[1] = 0.0f;
	m.m[2] = 0.0f;
	m.m[3] = 0.0f;
	m.m[4] = 0.0f;
	m.m[5] = cot;
	m.m[6] = 0.0f;
	m.m[7] = 0.0f;
	m.m[8] = 0.0f;
	m.m[9] = 0.0f;
	m.m[10] = (far + near) / dz;
	m.m[11] = -1.0f;
	m.m[12] = 0.0f;
	m.m[13] = 0.0f;
	m.m[14] = (2.0f * far * near) / dz;
	m.m[15] = 0.0f;
	return m;
}

mat4 m4ortho(
	scalar left,
	scalar right,
	scalar top,
	scalar bottom,
	scalar near,
	scalar far
)
{
	mat4 m;
	m.m[0] = 2 / (right - left);
	m.m[1] = 0;
	m.m[2] = 0;
	m.m[3] = 0;
	m.m[4] = 0;
	m.m[5] = 2 / (top - bottom);
	m.m[6] = 0;
	m.m[7] = 0;
	m.m[8] = 0;
	m.m[9] = 0;
	m.m[10] = -2 / (far - near);
	m.m[11] = 0;
	m.m[12] = -(right + left) / (right - left);
	m.m[13] = -(top + bottom) / (top - bottom);
	m.m[14] = -(far + near) / (far - near);
	m.m[15] = 1;
	return m;
}

mat4 m4camera(vec3 eye, vec3 target, vec3 up)
{
	mat4 m;
	vec3 direction = v3normalize(v3substract(target, eye));
	// We are using a left hand coordinate, but camera matrix needs right
	// direction, so we change cross sequence.
	vec3 right = v3normalize(v3cross(up, direction));
	up = v3cross(direction, right);
	m.m[0] = right.v[0];
	m.m[1] = up.v[0];
	m.m[2] = -direction.v[0];
	m.m[3] = 0.0f;
	m.m[4] = right.v[1];
	m.m[5] = up.v[1];
	m.m[6] = -direction.v[1];
	m.m[7] = 0.0f;
	m.m[8] = right.v[2];
	m.m[9] = up.v[2];
	m.m[10] = -direction.v[2];
	m.m[11] = 0.0f;
	m.m[12] = -v3dot(right, eye);
	m.m[13] = -v3dot(up, eye);
	m.m[14] = v3dot(direction, eye);
	m.m[15] = 1.0f;
	return m;
}
07070100000008000081A40000000000000000000000016938E8EF000014AE000000000000000000000000000000000000002100000000mvmath-0.gitmodule/srcs/mvmath.h#ifndef __MVMATH_H__
#define __MVMATH_H__

#include <math.h>

typedef float scalar;
/**
 * vec2 is a scalar[2] like this:
 * | 0 |
 * | 1 |
 */
typedef struct {
	scalar v[2];
} vec2;
/**
 * vec3 is a scalar[3] like this:
 * | 0 |
 * | 1 |
 * | 2 |
 */
typedef struct {
	scalar v[3];
} vec3;
/**
 * vec4 is a scalar[4] like this:
 * | 0 |
 * | 1 |
 * | 2 |
 * | 4 |
 */
typedef struct {
	scalar v[4];
} vec4;
/**
 * mat4 is a scalar[16] like this:
 * |   0   4   8  12   |
 * |   1   5   9  13   |
 * |   2   6  10  14   |
 * |   3   7  11  15   |
 */
typedef struct {
	scalar m[16];
} mat4;

#define PI 3.1415926f

#define SABS(S) ((S) >= 0 ? (S) : -(S))
#define SMAX(S1, S2) ((S1) > (S2) ? (S1) : (S2))
#define SMIN(S1, S2) ((S1) < (S2) ? (S1) : (S2))
#define SCLAMP(S, MIN, MAX) (SMAX(MIN, SMIN(MAX, S)))
#define SDEGREES(RADIANS) ((RADIANS) * 180.0f / PI)
#define SRADIANS(DEGREES) ((DEGREES) * PI / 180.0f)
#define VARRAY(V) ((V).v)
#define VX(V) VARRAY(V)[0]
#define VY(V) VARRAY(V)[1]
#define VZ(V) VARRAY(V)[2]
#define VW(V) VARRAY(V)[3]
#define VR(V) VR(V)
#define VG(V) VG(V)
#define VB(V) VB(V)
#define VA(V) VA(V)
#define MARRAY(M) ((M).m)

#ifdef __DEBUG__
#	ifndef MVPRINT
#		include <stdio.h>
#		define MVPRINT(...)                 \
			do {                         \
				printf(__VA_ARGS__); \
				putchar('\n');       \
			} while (0);
#	endif
#	define V2PRINT(V) \
		MVPRINT("(vec2){%8.3f, %8.3f}", VARRAY(V)[0], VARRAY(V)[1])
#	define V3PRINT(V)                             \
		MVPRINT("(vec3){%8.3f, %8.3f, %8.3f}", \
			VARRAY(V)[0],                  \
			VARRAY(V)[1],                  \
			VARRAY(V)[2])
#	define V4PRINT(V)                                      \
		MVPRINT("(vec4){%8.3f, %8.3f, %8.3f, %8.3f}\n", \
			VARRAY(V)[0],                           \
			VARRAY(V)[1],                           \
			VARRAY(V)[2],                           \
			VARRAY(V)[3])
#	define M4PRINT(M)                                \
		MVPRINT("(mat4){\n"                       \
			"\t%8.3f, %8.3f, %8.3f, %8.3f,\n" \
			"\t%8.3f, %8.3f, %8.3f, %8.3f,\n" \
			"\t%8.3f, %8.3f, %8.3f, %8.3f,\n" \
			"\t%8.3f, %8.3f, %8.3f, %8.3f,\n" \
			"}",                              \
			MARRAY(M)[0],                     \
			MARRAY(M)[4],                     \
			MARRAY(M)[8],                     \
			MARRAY(M)[12],                    \
			MARRAY(M)[1],                     \
			MARRAY(M)[5],                     \
			MARRAY(M)[9],                     \
			MARRAY(M)[13],                    \
			MARRAY(M)[2],                     \
			MARRAY(M)[6],                     \
			MARRAY(M)[10],                    \
			MARRAY(M)[14],                    \
			MARRAY(M)[3],                     \
			MARRAY(M)[7],                     \
			MARRAY(M)[11],                    \
			MARRAY(M)[15])
#endif

scalar sabs(scalar s);
scalar smax(scalar s1, scalar s2);
scalar smin(scalar s1, scalar s2);
scalar sclamp(scalar s, scalar min, scalar max);
scalar sdegrees(scalar radians);
scalar sradians(scalar degrees);

vec2 v2s(scalar s1, scalar s2);
vec2 v2v3(vec3 v);
vec2 v2v4(vec4 v);
scalar v2length(vec2 v);
vec2 v2normalize(vec2 v);
vec2 v2abs(vec2 v);
int v2compare(vec2 v1, vec2 v2);
vec2 v2add(vec2 v1, vec2 v2);
vec2 v2substract(vec2 v1, vec2 v2);
scalar v2dot(vec2 v1, vec2 v2);
vec2 v2smultiply(vec2 v, scalar s);
vec2 v2multiply(vec2 v1, vec2 v2);
vec2 v2clamp(vec2 v, vec2 vmin, vec2 vmax);

vec3 v3s(scalar s1, scalar s2, scalar s3);
vec3 v3v2s(vec2 v, scalar s);
vec3 v3v4(vec4 v);
scalar v3length(vec3 v);
vec3 v3normalize(vec3 v);
int v3compare(vec3 v1, vec3 v2);
vec3 v3abs(vec3 v);
vec3 v3add(vec3 v1, vec3 v2);
vec3 v3substract(vec3 v1, vec3 v2);
vec3 v3cross(vec3 v1, vec3 v2);
scalar v3dot(vec3 v1, vec3 v2);
vec3 v3smultiply(vec3 v, scalar s);
vec3 v3multiply(vec3 v1, vec3 v2);
vec3 v3clamp(vec3 v, vec3 vmin, vec3 vmax);

vec4 v4s(scalar s1, scalar s2, scalar s3, scalar s4);
vec4 v4v2s(vec2 v, scalar s1, scalar s2);
vec4 v4v3s(vec3 v, scalar s);
vec4 v4v2(vec2 v1, vec2 v2);
scalar v4length(vec4 v);
vec4 v4normalize(vec4 v);
int v4compare(vec4 v1, vec4 v2);
vec4 v4abs(vec4 v);
vec4 v4add(vec4 v1, vec4 v2);
vec4 v4substract(vec4 v1, vec4 v2);
scalar v4dot(vec4 v1, vec4 v2);
vec4 v4smultiply(vec4 v, scalar s);
vec4 v4multiply(vec4 v1, vec4 v2);
vec4 v4clamp(vec4 v, vec4 vmin, vec4 vmax);

mat4 m4identity(void);
int m4compare(mat4 m1, mat4 m2);
mat4 m4inverse(mat4 m);
mat4 m4transpose(mat4 m);
mat4 m4multiply(mat4 m1, mat4 m2);
vec4 m4v4multiply(mat4 m, vec4 v);
mat4 m4translate(vec3 delta);
mat4 m4scale(vec3 scale);
// Rotating is always about (0, 0, 0) so if it is not the center of your model,
// you have to move its center to (0, 0, 0) before rotating and move it back.
//
// In OpenGL left hand coordinate, positive angle means counter-clockwise.
mat4 m4rotate(vec3 axis, scalar angle);
// We are in OpenGL left hand coordinate. That is, outside screen is negative
// and inside screen is positive. Because we look to screen, near and far should
// be positive in param.
mat4 m4perspective(scalar fov, scalar aspect, scalar near, scalar far);
// Give top a greater value than bottom to make top left as (0, 0).
mat4 m4ortho(
	scalar left,
	scalar right,
	scalar top,
	scalar bottom,
	scalar near,
	scalar far
);
mat4 m4camera(vec3 eye, vec3 target, vec3 up);

#endif
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!69 blocks
openSUSE Build Service is sponsored by