This commit is contained in:
Zack Buhman 2025-12-17 23:34:49 -06:00
commit 4871b500e5
35 changed files with 8968 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
*~
.#*
*.o
*.d
*.s
*.blend1
*.zip
main
main*

137
Makefile Normal file
View File

@ -0,0 +1,137 @@
.SUFFIXES:
.INTERMEDIATE:
.SECONDARY:
.PHONY: all clean
ifndef GLFW
$(error GLFW undefined)
endif
MAKEFILE_PATH := $(patsubst %/,%,$(dir $(abspath $(firstword $(MAKEFILE_LIST)))))
DEBUG = -g
CSTD += -std=gnu23
CXXSTD += -std=gnu++23
CFLAGS += -Wall -Werror -Wfatal-errors
CFLAGS += -Wno-error=unused-function
CFLAGS += -Wno-error=unused-variable
CFLAGS += -I$(MAKEFILE_PATH)/include
CFLAGS += -I$(dir $(GLFW))../include
CXXFLAGS += -fno-exceptions
LDFLAGS += -nostdlib++ -lm -Wl,-z noexecstack
ifeq ($(shell uname),Linux)
LDFLAGS += -static-libgcc
endif
ifeq ($(OS),Windows_NT)
LDFLAGS += -Wl,--subsystem,windows -mwindows
endif
ifeq ($(shell uname),Darwin)
LDFLAGS += -framework Foundation -framework IOKit -framework AppKit
endif
DEPFLAGS = -MMD -MP
OPT = -Og
all: main
makefile_path := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
as_obj_binary = $(subst -,_,$(subst .,_,$(subst /,_,$(subst .h,,$(1)))))
as_obj_binary_p = _binary_$(call as_obj_binary,$(1))
define BUILD_BINARY_S
@echo build_binary_s $@
@echo '.section .rodata.$(call as_obj_binary_p,$<)' > $@
@echo '.global $(call as_obj_binary_p,$<)_start' >> $@
@echo '.global $(call as_obj_binary_p,$<)_end' >> $@
@echo '$(call as_obj_binary_p,$<)_start:' >> $@
@printf '\t.incbin "$<"\n' >> $@
@echo '$(call as_obj_binary_p,$<)_end:' >> $@
endef
define BUILD_BINARY_H
@echo build_binary_h $@
@echo '#pragma once' > $@
@echo '' >> $@
@echo '#include <stdint.h>' >> $@
@echo '' >> $@
@echo '#ifdef __cplusplus' >> $@
@echo 'extern "C" {' >> $@
@echo '#endif' >> $@
@echo '' >> $@
@echo 'extern uint32_t $(call as_obj_binary_p,$<)_start __asm("$(call as_obj_binary_p,$<)_start");' >> $@
@echo 'extern uint32_t $(call as_obj_binary_p,$<)_end __asm("$(call as_obj_binary_p,$<)_end");' >> $@
@echo '' >> $@
@echo '#define $(call as_obj_binary,$<)_start ((const char *)&$(call as_obj_binary_p,$<)_start)' >> $@
@echo '#define $(call as_obj_binary,$<)_end ((const char *)&$(call as_obj_binary_p,$<)_end)' >> $@
@echo '#define $(call as_obj_binary,$<)_size ((uintptr_t)$(call as_obj_binary,$<)_end - (uintptr_t)$(call as_obj_binary,$<)_start)' >> $@
@echo '' >> $@
@echo '#ifdef __cplusplus' >> $@
@echo '}' >> $@
@echo '#endif' >> $@
endef
%.glsl.s: %.glsl
$(BUILD_BINARY_S)
%.data.s: %.data
$(BUILD_BINARY_S)
%.data.pal.s: %.data.pal
$(BUILD_BINARY_S)
include/%.glsl.h: src/%.glsl
$(BUILD_BINARY_H)
include/%.data.h: %.data
$(BUILD_BINARY_H)
include/%.data.pal.h: %.data.pal
$(BUILD_BINARY_H)
clean:
rm -f *.o *.d *.gch
rm -f main
%.o: %.s
$(AS) $(AFLAGS) $< -o $@ $(TARGET)
%.o: %.cpp
$(CXX) $(CXXSTD) $(ARCH) $(CFLAGS) $(OPT) $(DEBUG) $(DEPFLAGS) -MF ${<}.d -c $< -o $@
%.o: %.c
$(CC) $(CSTD) $(ARCH) $(CFLAGS) $(CXXFLAGS) $(OPT) $(DEBUG) $(DEPFLAGS) -MF ${<}.d -c $< -o $@
SHADERS = $(shell find src/ -type f -name '*.glsl')
SHADER_OBJS = $(patsubst %,%.o,$(SHADERS))
SHADER_HEADERS = $(subst src/,include/,$(patsubst %,%.h,$(SHADERS)))
shaders: $(SHADER_HEADERS)
MAIN_OBJS = \
src/main.o \
src/gl.o \
src/make.o \
src/shader.o \
src/render.o \
model/test_scene_color.data.o \
$(SHADER_OBJS) \
$(GLFW)
main: $(MAIN_OBJS) | shaders
$(CXX) $^ $(CXXFLAGS) $(ARCH) -o $@ $(LDFLAGS)
-include $(shell find src/ -type f -name '*.d')
.SUFFIXES:
.INTERMEDIATE:
.SECONDARY:
.PHONY: all clean shaders
%: RCS/%,v
%: RCS/%
%: %,v
%: s.%
%: SCCS/s.%

311
include/KHR/khrplatform.h Normal file
View File

@ -0,0 +1,311 @@
#ifndef __khrplatform_h_
#define __khrplatform_h_
/*
** Copyright (c) 2008-2018 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Khronos platform-specific types and definitions.
*
* The master copy of khrplatform.h is maintained in the Khronos EGL
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
* The last semantic modification to khrplatform.h was at commit ID:
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
* Please submit changes by filing pull requests or issues on
* the EGL Registry repository linked above.
*
*
* See the Implementer's Guidelines for information about where this file
* should be located on your system and for more details of its use:
* http://www.khronos.org/registry/implementers_guide.pdf
*
* This file should be included as
* #include <KHR/khrplatform.h>
* by Khronos client API header files that use its types and defines.
*
* The types in khrplatform.h should only be used to define API-specific types.
*
* Types defined in khrplatform.h:
* khronos_int8_t signed 8 bit
* khronos_uint8_t unsigned 8 bit
* khronos_int16_t signed 16 bit
* khronos_uint16_t unsigned 16 bit
* khronos_int32_t signed 32 bit
* khronos_uint32_t unsigned 32 bit
* khronos_int64_t signed 64 bit
* khronos_uint64_t unsigned 64 bit
* khronos_intptr_t signed same number of bits as a pointer
* khronos_uintptr_t unsigned same number of bits as a pointer
* khronos_ssize_t signed size
* khronos_usize_t unsigned size
* khronos_float_t signed 32 bit floating point
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
* nanoseconds
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
* khronos_boolean_enum_t enumerated boolean type. This should
* only be used as a base type when a client API's boolean type is
* an enum. Client APIs which use an integer or other type for
* booleans cannot use this as the base type for their boolean.
*
* Tokens defined in khrplatform.h:
*
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
*
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
*
* Calling convention macros defined in this file:
* KHRONOS_APICALL
* KHRONOS_APIENTRY
* KHRONOS_APIATTRIBUTES
*
* These may be used in function prototypes as:
*
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
* int arg1,
* int arg2) KHRONOS_APIATTRIBUTES;
*/
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
# define KHRONOS_STATIC 1
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if defined(KHRONOS_STATIC)
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
* header compatible with static linking. */
# define KHRONOS_APICALL
#elif defined(_WIN32)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
# define KHRONOS_APICALL __attribute__((visibility("default")))
#else
# define KHRONOS_APICALL
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIENTRY
*-------------------------------------------------------------------------
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else
# define KHRONOS_APIENTRY
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIATTRIBUTES
*-------------------------------------------------------------------------
* This follows the closing parenthesis of the function prototype arguments.
*/
#if defined (__ARMCC_2__)
#define KHRONOS_APIATTRIBUTES __softfp
#else
#define KHRONOS_APIATTRIBUTES
#endif
/*-------------------------------------------------------------------------
* basic type definitions
*-----------------------------------------------------------------------*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
/*
* To support platform where unsigned long cannot be used interchangeably with
* inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
* Ideally, we could just use (u)intptr_t everywhere, but this could result in
* ABI breakage if khronos_uintptr_t is changed from unsigned long to
* unsigned long long or similar (this results in different C++ name mangling).
* To avoid changes for existing platforms, we restrict usage of intptr_t to
* platforms where the size of a pointer is larger than the size of long.
*/
#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
#define KHRONOS_USE_INTPTR_T
#endif
#endif
#elif defined(__VMS ) || defined(__sgi)
/*
* Using <inttypes.h>
*/
#include <inttypes.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
/*
* Win32
*/
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__sun__) || defined(__digital__)
/*
* Sun or Digital
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#if defined(__arch64__) || defined(_LP64)
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
#else
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
#endif /* __arch64__ */
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif 0
/*
* Hypothetical platform with no float or int64 support
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
#else
/*
* Generic fallback
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#endif
/*
* Types that are (so far) the same on all platforms
*/
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
#ifdef KHRONOS_USE_INTPTR_T
typedef intptr_t khronos_intptr_t;
typedef uintptr_t khronos_uintptr_t;
#elif defined(_WIN64)
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
#else
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
#endif
#if defined(_WIN64)
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#endif
#if KHRONOS_SUPPORT_FLOAT
/*
* Float type
*/
typedef float khronos_float_t;
#endif
#if KHRONOS_SUPPORT_INT64
/* Time types
*
* These types can be used to represent a time interval in nanoseconds or
* an absolute Unadjusted System Time. Unadjusted System Time is the number
* of nanoseconds since some arbitrary system event (e.g. since the last
* time the system booted). The Unadjusted System Time is an unsigned
* 64 bit value that wraps back to 0 every 584 years. Time intervals
* may be either signed or unsigned.
*/
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
#endif
/*
* Dummy value used to pad enum types to 32 bits.
*/
#ifndef KHRONOS_MAX_ENUM
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
#endif
/*
* Enumerated boolean type
*
* Values other than zero should be considered to be true. Therefore
* comparisons should not be made against KHRONOS_TRUE.
*/
typedef enum {
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */

3293
include/glad/gl.h Normal file

File diff suppressed because it is too large Load Diff

25
include/make.h Normal file
View File

@ -0,0 +1,25 @@
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
unsigned int make_buffer(unsigned int target,
const void * data,
size_t size);
unsigned int make_texture(const void * data,
int internalformat,
int width,
int height,
int format,
int type);
#define make_buffer_sizeof(target, data) \
make_buffer(target, data, (sizeof (data)))
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,5 @@
#pragma once
#define PI (3.14159274101257324219f)
#define PI_2 (PI * 2.0f)
#define I_PI_2 (1.0f / (PI_2))

View File

@ -0,0 +1,15 @@
#pragma once
#include "vec2.hpp"
#include "vec3.hpp"
#include "vec4.hpp"
#include "mat2x2.hpp"
#include "mat3x3.hpp"
#include "mat4x4.hpp"
using vec2 = vec<2, float>;
using vec3 = vec<3, float>;
using vec4 = vec<4, float>;
using mat2x2 = mat<2, 2, float>;
using mat3x3 = mat<3, 3, float>;
using mat4x4 = mat<4, 4, float>;

26
include/math/mat.hpp Normal file
View File

@ -0,0 +1,26 @@
#pragma once
template <int R, int C, typename T>
struct mat;
template <int R, int C, typename T>
inline constexpr typename mat<R, C, T>::col_type
col(mat<R, C, T> const& m, int c)
{
typename mat<R, C, T>::col_type v;
for (int r = 0; r < R; r++) {
v[r] = m[r][c];
}
return v;
}
template <int R, typename T>
inline constexpr vec<3, T>
col(mat<R, 4, T> const& m, int c)
{
vec<3, T> v;
for (int r = 0; r < 3; r++) {
v[r] = m[r][c];
}
return v;
}

112
include/math/mat2x2.hpp Normal file
View File

@ -0,0 +1,112 @@
#pragma once
#include <utility>
#include "vec2.hpp"
#include "mat.hpp"
//
// mat2x2
//
template <typename T>
struct mat<2, 2, T>
{
typedef vec<2, T> row_type;
typedef vec<2, T> col_type;
private:
row_type value[2];
public:
inline constexpr mat();
inline constexpr mat
(
T const& a00, T const& a01,
T const& a10, T const& a11
);
inline static constexpr int length() { return 4; }
inline constexpr typename mat<2, 2, T>::row_type &
operator[](int i);
inline constexpr typename mat<2, 2, T>::row_type const &
operator[](int i) const;
void operator=(const mat<2, 2, T>&) = delete;
};
template<typename T>
inline constexpr mat<2, 2, T>::mat()
: value{std::move(row_type(1, 0)),
std::move(row_type(0, 1))}
{ }
template<typename T>
inline constexpr mat<2, 2, T>::mat
(
T const& a00, T const& a01,
T const& a10, T const& a11
)
: value{std::move(row_type(a00, a01)),
std::move(row_type(a10, a11))}
{ }
template <typename T>
inline constexpr typename mat<2, 2, T>::row_type &
mat<2, 2, T>::operator[](int i)
{
return value[i];
}
template <typename T>
inline constexpr typename mat<2, 2, T>::row_type const &
mat<2, 2, T>::operator[](int i) const
{
return value[i];
}
template<typename T>
inline constexpr mat<2, 2, T> operator*(mat<2, 2, T> const& m1, mat<2, 2, T> const& m2)
{
#define c(i, j) ( \
m1[i][0] * m2[0][j] \
+ m1[i][1] * m2[1][j])
return mat<2, 2, T>(c(0,0), c(0,1),
c(1,0), c(1,1));
#undef c
}
template<typename T>
inline constexpr typename mat<2, 2, T>::row_type operator*
(
mat<2, 2, T> const& m,
typename mat<2, 2, T>::col_type const& v
)
{
#define c(i) ( \
m[i][0] * v[0] \
+ m[i][1] * v[1])
return typename mat<2, 2, T>::row_type(c(0), c(1));
#undef c
}
template<typename T>
inline constexpr mat<2, 2, T> transpose(mat<2, 2, T> const& m)
{
return mat<2, 2, T>(
m[0][0], m[1][0],
m[0][1], m[1][1]
);
}
template<typename T>
inline constexpr float determinant(mat<2, 2, T> const& a)
{
return a[0][0] * a[1][1] - a[0][1] * a[1][0];
}

201
include/math/mat3x3.hpp Normal file
View File

@ -0,0 +1,201 @@
#pragma once
#include <utility>
#include "vec3.hpp"
#include "mat.hpp"
//
// mat3x3
//
template <typename T>
struct mat<3, 3, T>
{
typedef vec<3, T> row_type;
typedef vec<3, T> col_type;
private:
row_type value[3];
public:
inline constexpr mat();
inline constexpr mat
(
T const& a00, T const& a01, T const& a02,
T const& a10, T const& a11, T const& a12,
T const& a20, T const& a21, T const& a22
);
inline static constexpr int length() { return 3; }
inline constexpr typename mat<3, 3, T>::row_type &
operator[](int i);
inline constexpr typename mat<3, 3, T>::row_type const &
operator[](int i) const;
//void operator=(const mat<3, 3, T>&) = delete;
};
template<typename T>
inline constexpr mat<3, 3, T>::mat()
: value{std::move(row_type(1, 0, 0)),
std::move(row_type(0, 1, 0)),
std::move(row_type(0, 0, 1))}
{ }
template<typename T>
inline constexpr mat<3, 3, T>::mat
(
T const& a00, T const& a01, T const& a02,
T const& a10, T const& a11, T const& a12,
T const& a20, T const& a21, T const& a22
)
: value{std::move(row_type(a00, a01, a02)),
std::move(row_type(a10, a11, a12)),
std::move(row_type(a20, a21, a22))}
{ }
template <typename T>
inline constexpr typename mat<3, 3, T>::row_type &
mat<3, 3, T>::operator[](int i)
{
return value[i];
}
template <typename T>
inline constexpr typename mat<3, 3, T>::row_type const &
mat<3, 3, T>::operator[](int i) const
{
return value[i];
}
template<typename T>
inline constexpr mat<3, 3, T> operator+(mat<3, 3, T> const& m1, mat<3, 3, T> const& m2)
{
#define c(i, j) ( m1[i][j] + m2[i][j] )
return mat<3, 3, T>(c(0,0), c(0,1), c(0,2),
c(1,0), c(1,1), c(1,2),
c(2,0), c(2,1), c(2,2));
#undef c
}
template<typename T>
inline constexpr mat<3, 3, T> operator*(mat<3, 3, T> const& m1, mat<3, 3, T> const& m2)
{
#define c(i, j) ( \
m1[i][0] * m2[0][j] \
+ m1[i][1] * m2[1][j] \
+ m1[i][2] * m2[2][j] )
return mat<3, 3, T>(c(0,0), c(0,1), c(0,2),
c(1,0), c(1,1), c(1,2),
c(2,0), c(2,1), c(2,2));
#undef c
}
template<typename T>
inline constexpr mat<3, 3, T> operator*(mat<3, 3, T> const& m1, float s)
{
#define c(i, j) ( m1[i][j] * s )
return mat<3, 3, T>(c(0,0), c(0,1), c(0,2),
c(1,0), c(1,1), c(1,2),
c(2,0), c(2,1), c(2,2));
#undef c
}
template<typename T>
inline constexpr typename mat<3, 3, T>::row_type operator*
(
mat<3, 3, T> const& m,
typename mat<3, 3, T>::col_type const& v
)
{
#define c(i) ( \
m[i][0] * v[0] \
+ m[i][1] * v[1] \
+ m[i][2] * v[2] )
return typename mat<3, 3, T>::row_type(c(0), c(1), c(2));
#undef c
}
template<typename T>
inline constexpr mat<3, 3, T> transpose(mat<3, 3, T> const& m)
{
return mat<3, 3, T>(
m[0][0], m[1][0], m[2][0],
m[0][1], m[1][1], m[2][1],
m[0][2], m[1][2], m[2][2]
);
}
template<typename T>
inline constexpr mat<2, 2, T> submatrix(mat<3, 3, T> const& a, int r, int c)
{
mat<2, 2, T> b;
int row2 = 0;
for (int row3 = 0; row3 < 3; row3++) {
if (row3 == r) continue;
int col2 = 0;
for (int col3 = 0; col3 < 3; col3++) {
if (col3 == c) continue;
b[row2][col2] = a[row3][col3];
col2++;
}
row2++;
}
return b;
}
template<typename T>
inline constexpr float minor(mat<3, 3, T> const& a, int r, int c)
{
mat<2, 2, T> s = submatrix(a, r, c);
float ret = determinant(s);
return ret;
}
template<typename T>
inline constexpr float cofactor(mat<3, 3, T> const& a, int r, int c)
{
float m = minor(a, r, c);
if ((r + c) & 1)
return -m;
else
return m;
}
template<typename T>
inline constexpr float determinant(mat<3, 3, T> const& a)
{
float f0 = cofactor(a, 0, 0);
float f1 = cofactor(a, 0, 1);
float f2 = cofactor(a, 0, 2);
return
a[0][0] * f0 +
a[0][1] * f1 +
a[0][2] * f2;
}
template<typename T>
inline constexpr mat<3, 3, T> inverse(mat<3, 3, T> const& a)
{
mat<3, 3, T> m;
float idet = 1.0f / determinant(a);
m[0][0] = cofactor(a, 0, 0) * idet;
m[1][0] = cofactor(a, 0, 1) * idet;
m[2][0] = cofactor(a, 0, 2) * idet;
m[0][1] = cofactor(a, 1, 0) * idet;
m[1][1] = cofactor(a, 1, 1) * idet;
m[2][1] = cofactor(a, 1, 2) * idet;
m[0][2] = cofactor(a, 2, 0) * idet;
m[1][2] = cofactor(a, 2, 1) * idet;
m[2][2] = cofactor(a, 2, 2) * idet;
return m;
}

247
include/math/mat4x4.hpp Normal file
View File

@ -0,0 +1,247 @@
#pragma once
#include <utility>
#include "vec4.hpp"
#include "mat.hpp"
//
// mat4x4
//
template <typename T>
struct mat<4, 4, T>
{
typedef vec<4, T> row_type;
typedef vec<4, T> col_type;
private:
row_type value[4];
public:
inline constexpr mat();
inline constexpr mat
(
T const& a00, T const& a01, T const& a02, T const& a03,
T const& a10, T const& a11, T const& a12, T const& a13,
T const& a20, T const& a21, T const& a22, T const& a23,
T const& a30, T const& a31, T const& a32, T const& a33
);
inline static constexpr int length() { return 4; }
inline constexpr typename mat<4, 4, T>::row_type &
operator[](int i);
inline constexpr typename mat<4, 4, T>::row_type const &
operator[](int i) const;
//void operator=(const mat<4, 4, T>&) = delete;
};
template<typename T>
inline constexpr mat<4, 4, T>::mat()
: value{std::move(row_type(1, 0, 0, 0)),
std::move(row_type(0, 1, 0, 0)),
std::move(row_type(0, 0, 1, 0)),
std::move(row_type(0, 0, 0, 1))}
{ }
template<typename T>
inline constexpr mat<4, 4, T>::mat
(
T const& a00, T const& a01, T const& a02, T const& a03,
T const& a10, T const& a11, T const& a12, T const& a13,
T const& a20, T const& a21, T const& a22, T const& a23,
T const& a30, T const& a31, T const& a32, T const& a33
)
: value{std::move(row_type(a00, a01, a02, a03)),
std::move(row_type(a10, a11, a12, a13)),
std::move(row_type(a20, a21, a22, a23)),
std::move(row_type(a30, a31, a32, a33))}
{ }
template <typename T>
inline constexpr typename mat<4, 4, T>::row_type &
mat<4, 4, T>::operator[](int i)
{
return value[i];
}
template <typename T>
inline constexpr typename mat<4, 4, T>::row_type const &
mat<4, 4, T>::operator[](int i) const
{
return value[i];
}
template<typename T>
inline constexpr mat<4, 4, T> operator+(mat<4, 4, T> const& m1, mat<4, 4, T> const& m2)
{
#define c(i, j) ( m1[i][j] + m2[i][j] )
return mat<4, 4, T>(c(0,0), c(0,1), c(0,2), c(0,3),
c(1,0), c(1,1), c(1,2), c(1,3),
c(2,0), c(2,1), c(2,2), c(2,3),
c(3,0), c(3,1), c(3,2), c(3,3));
#undef c
}
template<typename T>
inline constexpr mat<4, 4, T> operator*(mat<4, 4, T> const& m1, mat<4, 4, T> const& m2)
{
#define c(i, j) ( \
m1[i][0] * m2[0][j] \
+ m1[i][1] * m2[1][j] \
+ m1[i][2] * m2[2][j] \
+ m1[i][3] * m2[3][j] )
return mat<4, 4, T>(c(0,0), c(0,1), c(0,2), c(0,3),
c(1,0), c(1,1), c(1,2), c(1,3),
c(2,0), c(2,1), c(2,2), c(2,3),
c(3,0), c(3,1), c(3,2), c(3,3));
#undef c
}
template<typename T>
inline constexpr mat<4, 4, T> operator*(mat<4, 4, T> const& m1, float s)
{
#define c(i, j) ( m1[i][j] * s )
return mat<4, 4, T>(c(0,0), c(0,1), c(0,2), c(0,3),
c(1,0), c(1,1), c(1,2), c(1,3),
c(2,0), c(2,1), c(2,2), c(2,3),
c(3,0), c(3,1), c(3,2), c(3,3));
#undef c
}
template<typename T>
inline constexpr typename mat<4, 4, T>::row_type operator*
(
mat<4, 4, T> const& m,
typename mat<4, 4, T>::col_type const& v
)
{
#define c(i) ( \
m[i][0] * v[0] \
+ m[i][1] * v[1] \
+ m[i][2] * v[2] \
+ m[i][3] * v[3] )
return typename mat<4, 4, T>::row_type(c(0), c(1), c(2), c(3));
#undef c
}
template<typename T>
inline constexpr vec<3, T> operator*
(
mat<4, 4, T> const& m,
vec<3, T> const& v
)
{
#define c(i) ( \
m[i][0] * v[0] \
+ m[i][1] * v[1] \
+ m[i][2] * v[2] \
+ m[i][3] )
return vec<3, T>(c(0), c(1), c(2));
#undef c
}
template<typename T>
inline constexpr mat<4, 4, T> transpose(mat<4, 4, T> const& m)
{
return mat<4, 4, T>(
m[0][0], m[1][0], m[2][0], m[3][0],
m[0][1], m[1][1], m[2][1], m[3][1],
m[0][2], m[1][2], m[2][2], m[3][2],
m[0][3], m[1][3], m[2][3], m[3][3]
);
}
template<typename T>
inline constexpr mat<3, 3, T> submatrix(mat<4, 4, T> const& a, int r, int c)
{
mat<3, 3, T> b;
int row3 = 0;
for (int row4 = 0; row4 < 4; row4++) {
if (row4 == r) continue;
int col3 = 0;
for (int col4 = 0; col4 < 4; col4++) {
if (col4 == c) continue;
b[row3][col3] = a[row4][col4];
col3++;
}
row3++;
}
return b;
}
template<typename T>
inline constexpr float minor(mat<4, 4, T> const& a, int r, int c)
{
mat<3, 3, T> s = submatrix(a, r, c);
float ret = determinant(s);
return ret;
}
template<typename T>
inline constexpr float cofactor(mat<4, 4, T> const& a, int r, int c)
{
float m = minor(a, r, c);
if ((r + c) & 1)
return -m;
else
return m;
}
template<typename T>
inline constexpr float determinant(mat<4, 4, T> const& a)
{
float f0 = cofactor(a, 0, 0);
float f1 = cofactor(a, 0, 1);
float f2 = cofactor(a, 0, 2);
float f3 = cofactor(a, 0, 3);
return
a[0][0] * f0 +
a[0][1] * f1 +
a[0][2] * f2 +
a[0][3] * f3;
}
template<typename T>
inline constexpr mat<4, 4, T> inverse(mat<4, 4, T> const& a)
{
mat<4, 4, T> m;
float idet = 1.0f / determinant(a);
m[0][0] = cofactor(a, 0, 0) * idet;
m[1][0] = cofactor(a, 0, 1) * idet;
m[2][0] = cofactor(a, 0, 2) * idet;
m[3][0] = cofactor(a, 0, 3) * idet;
m[0][1] = cofactor(a, 1, 0) * idet;
m[1][1] = cofactor(a, 1, 1) * idet;
m[2][1] = cofactor(a, 1, 2) * idet;
m[3][1] = cofactor(a, 1, 3) * idet;
m[0][2] = cofactor(a, 2, 0) * idet;
m[1][2] = cofactor(a, 2, 1) * idet;
m[2][2] = cofactor(a, 2, 2) * idet;
m[3][2] = cofactor(a, 2, 3) * idet;
m[0][3] = cofactor(a, 3, 0) * idet;
m[1][3] = cofactor(a, 3, 1) * idet;
m[2][3] = cofactor(a, 3, 2) * idet;
m[3][3] = cofactor(a, 3, 3) * idet;
return m;
}
template<typename T>
inline constexpr mat<4, 4, T> identity()
{
return mat<4, 4, T>(1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
}

167
include/math/transform.hpp Normal file
View File

@ -0,0 +1,167 @@
#pragma once
#include "vec.hpp"
#include "mat.hpp"
template<typename T>
inline constexpr mat<4, 4, T> translate(vec<3, T> t)
{
return {
1, 0, 0, t.x,
0, 1, 0, t.y,
0, 0, 1, t.z,
0, 0, 0, 1
};
}
template <typename T>
inline constexpr mat<4, 4, T> scale(vec<3, T> s)
{
return {
s.x, 0, 0, 0,
0, s.y, 0, 0,
0, 0, s.z, 0,
0, 0, 0, 1
};
}
template <typename T>
inline constexpr mat<4, 4, T> scale(T s)
{
return {
s, 0, 0, 0,
0, s, 0, 0,
0, 0, s, 0,
0, 0, 0, 1
};
}
template <typename T>
inline constexpr mat<4, 4, T> rotate_x(T t)
{
return {
1, 0, 0, 0,
0, cos(t), -sin(t), 0,
0, sin(t), cos(t), 0,
0, 0, 0, 1
};
}
template <typename T>
inline constexpr mat<4, 4, T> rotate_y(T t)
{
return {
cos(t), 0, sin(t), 0,
0, 1, 0, 0,
-sin(t), 0, cos(t), 0,
0, 0, 0, 1
};
}
template <typename T>
inline constexpr mat<4, 4, T> rotate_z(T t)
{
return {
cos(t), -sin(t), 0, 0,
sin(t), cos(t), 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
}
template <typename T>
inline constexpr mat<4, 4, T> rotate_axis_angle(vec<3, T> u, T t)
{
T st = sin(t);
T ct = cos(t);
T oct = 1.0 - ct;
T xx = u.x * u.x;
T xy = u.x * u.y;
T xz = u.x * u.z;
T yy = u.y * u.y;
T yz = u.y * u.z;
T zz = u.z * u.z;
return {
xx * oct + ct, xy * oct - u.z * st, xz * oct + u.y * st, 0,
xy * oct + u.z * st, yy * oct + ct, yz * oct - u.x * st, 0,
xz * oct - u.y * st, yz * oct + u.x * st, zz * oct + ct, 0,
0, 0, 0, 0
};
}
template <typename T>
inline constexpr mat<4, 4, T> rotate_axis_angle(vec<4, T> u)
{
return rotate_axis_angle({u.x, u.y, u.z}, u.w);
}
template <typename T>
inline constexpr mat<4, 4, T> rotate_quaternion(vec<4, T> r)
{
T xx2 = 2 * r.x * r.x;
T xy2 = 2 * r.x * r.y;
T xz2 = 2 * r.x * r.z;
T xw2 = 2 * r.x * r.w;
T yy2 = 2 * r.y * r.y;
T yz2 = 2 * r.y * r.z;
T yw2 = 2 * r.y * r.w;
T zz2 = 2 * r.z * r.z;
T zw2 = 2 * r.z * r.w;
return {
1 - yy2 - zz2, xy2 - zw2, xz2 + yw2, 0,
xy2 + zw2, 1 - xx2 - zz2, yz2 - xw2, 0,
xz2 - yw2, yz2 + xw2, 1 - xx2 - yy2, 0,
0, 0, 0, 1,
};
}
template <typename T>
inline constexpr mat<4, 4, T> look_at(vec<3, T> eye, vec<3, T> center, vec<3, T> up)
{
vec<3, T> z = normalize(eye - center);
vec<3, T> y = up;
vec<3, T> x = cross(y, z);
y = cross(z, x);
x = normalize(x);
y = normalize(y);
mat<4, 4, T> mat = {
x.x, x.y, x.z, -dot(x, eye),
y.x, y.y, y.z, -dot(y, eye),
z.x, z.y, z.z, -dot(z, eye),
0, 0, 0, 1,
};
return mat;
}
template <typename T>
inline constexpr vec<3, T> normal_multiply(mat<4, 4, T> m, vec<3, T> n)
{
vec<4, T> n4 = m * (vec<4, T>){n.x, n.y, n.z, 0.0};
return {n4.x, n4.y, n4.z};
}
template <typename T>
inline constexpr T inverse_length(vec<3, T> v)
{
float f = dot(v, v);
return 1.0f / sqrt<T>(f);
}
template <typename T>
inline constexpr T screen_transform(T x, T y)
{
T x2 = x / 2.0;
T y2 = y / 2.0;
return {
y2, 0, 0, x2,
0, y2, 0, y2,
0, 0, 1, 0,
0, 0, 0, 1
};
}

29
include/math/vec.hpp Normal file
View File

@ -0,0 +1,29 @@
#pragma once
template <int L, typename T>
struct vec;
template <int L, typename T>
inline constexpr T magnitude(vec<L, T> const& v)
{
return sqrt(dot(v, v));
}
template <int L, typename T>
inline constexpr T magnitude_squared(vec<L, T> const& v)
{
return dot(v, v);
}
template <int L, typename T>
inline constexpr vec<L, T> normalize(vec<L, T> const& v)
{
T d = 1.0f / magnitude(v);
return v * d;
}
template <int L, typename T>
inline constexpr vec<L, T> reflect(vec<L, T> const& i, vec<L, T> const& n)
{
return i - dot(n, i) * n * static_cast<T>(2.0);
}

154
include/math/vec2.hpp Normal file
View File

@ -0,0 +1,154 @@
#pragma once
#include "vec.hpp"
//
// vec3
//
template <typename T>
struct vec<2, T>
{
union {
T val[2];
struct { T x, y; };
struct { T u, v; };
};
inline constexpr vec();
inline constexpr vec(T scalar);
inline constexpr vec(T _x, T _y);
constexpr inline vec<2, T> operator-() const;
inline constexpr T & operator[](int i);
inline constexpr T const& operator[](int i) const;
inline constexpr vec<2, T>& operator=(vec<2, T> const& v);
inline constexpr vec<2, T>& operator+=(vec<2, T> const& v);
inline constexpr vec<2, T>& operator-=(vec<2, T> const& v);
};
template <typename T>
inline constexpr vec<2, T>::vec()
: x(0), y(0)
{}
template <typename T>
inline constexpr vec<2, T>::vec(T scalar)
: x(scalar), y(scalar)
{}
template <typename T>
inline constexpr vec<2, T>::vec(T _x, T _y)
: x(_x), y(_y)
{}
template <typename T>
constexpr inline vec<2, T> vec<2, T>::operator-() const
{
return vec<2, T>(-x, -y);
}
template <typename T>
inline constexpr T & vec<2, T>::operator[](int i)
{
return val[i];
}
template <typename T>
inline constexpr T const& vec<2, T>::operator[](int i) const
{
return val[i];
}
template <typename T>
inline constexpr vec<2, T>& vec<2, T>::operator=(vec<2, T> const& v)
{
this->x = static_cast<T>(v.x);
this->y = static_cast<T>(v.y);
return *this;
}
template <typename T>
inline constexpr vec<2, T>& vec<2, T>::operator+=(vec<2, T> const& v)
{
*this = *this + vec<2, T>(v);
return *this;
}
template <typename T>
inline constexpr vec<2, T>& vec<2, T>::operator-=(vec<2, T> const& v)
{
*this = *this - vec<2, T>(v);
return *this;
}
template <typename T>
inline constexpr vec<2, T> operator+(vec<2, T> const& v1, vec<2, T> const& v2)
{
return vec<2, T>(v1.x + v2.x,
v1.y + v2.y);
}
template <typename T>
inline constexpr vec<2, T> operator-(vec<2, T> const& v1, vec<2, T> const& v2)
{
return vec<2, T>(v1.x - v2.x,
v1.y - v2.y);
}
template <typename T>
inline constexpr vec<2, T> operator*(vec<2, T> const& v1, vec<2, T> const& v2)
{
return vec<2, T>(v1.x * v2.x,
v1.y * v2.y);
}
template <typename T>
inline constexpr vec<2, T> operator*(vec<2, T> const& v1, T const& scalar)
{
return v1 * vec<2, T>(scalar);
}
template <typename T>
inline constexpr vec<2, T> operator*(T const& scalar, vec<2, T> const& v1)
{
return vec<2, T>(scalar) * v1;
}
template <typename T>
inline constexpr vec<2, T> operator/(vec<2, T> const& v1, vec<2, T> const& v2)
{
return vec<2, T>(v1.x / v2.x,
v1.y / v2.y);
}
template <typename T>
inline constexpr vec<2, T> operator/(vec<2, T> const& v1, T const& scalar)
{
return v1 / vec<2, T>(scalar);
}
template <typename T>
inline constexpr T dot(vec<2, T> const& v1, vec<2, T> const& v2)
{
vec<2, T> tmp(v1 * v2);
return tmp.x + tmp.y;
}
template <typename T>
inline constexpr T cross(vec<2, T> const& v1, vec<2, T> const& v2)
{
return v1.x * v2.y - v2.x * v1.y;
}
template <typename T>
inline constexpr vec<2, T> functor1(T (&func) (T const& x), vec<2, T> const& v)
{
return vec<2, T>(func(v.x), func(v.y));
}
template <typename T, typename U>
inline constexpr vec<2, U> functor1(U (&func) (T const& x), vec<2, T> const& v)
{
return vec<2, U>(func(v.x), func(v.y));
}

171
include/math/vec3.hpp Normal file
View File

@ -0,0 +1,171 @@
#pragma once
#include "vec.hpp"
//
// vec3
//
template <typename T>
struct vec<3, T>
{
union {
T val[3];
struct { T x, y, z; };
struct { T r, g, b; };
};
inline constexpr vec();
inline constexpr vec(T scalar);
inline constexpr vec(T _x, T _y, T _z);
constexpr inline vec<3, T> operator-() const;
inline constexpr T & operator[](int i);
inline constexpr T const& operator[](int i) const;
inline constexpr vec<3, T>& operator=(vec<3, T> const& v);
inline constexpr vec<3, T>& operator+=(vec<3, T> const& v);
inline constexpr vec<3, T>& operator-=(vec<3, T> const& v);
inline constexpr vec<3, T>& operator*=(T const& scalar);
};
template <typename T>
inline constexpr vec<3, T>::vec()
: x(0), y(0), z(0)
{}
template <typename T>
inline constexpr vec<3, T>::vec(T scalar)
: x(scalar), y(scalar), z(scalar)
{}
template <typename T>
inline constexpr vec<3, T>::vec(T _x, T _y, T _z)
: x(_x), y(_y), z(_z)
{}
template <typename T>
constexpr inline vec<3, T> vec<3, T>::operator-() const
{
return vec<3, T>(-x, -y, -z);
}
template <typename T>
inline constexpr T & vec<3, T>::operator[](int i)
{
return val[i];
}
template <typename T>
inline constexpr T const& vec<3, T>::operator[](int i) const
{
return val[i];
}
template <typename T>
inline constexpr vec<3, T>& vec<3, T>::operator=(vec<3, T> const& v)
{
this->x = static_cast<T>(v.x);
this->y = static_cast<T>(v.y);
this->z = static_cast<T>(v.z);
return *this;
}
template <typename T>
inline constexpr vec<3, T>& vec<3, T>::operator+=(vec<3, T> const& v)
{
*this = *this + vec<3, T>(v);
return *this;
}
template <typename T>
inline constexpr vec<3, T>& vec<3, T>::operator-=(vec<3, T> const& v)
{
*this = *this - vec<3, T>(v);
return *this;
}
template <typename T>
inline constexpr vec<3, T>& vec<3, T>::operator*=(T const& scalar)
{
*this = *this * scalar;
return *this;
}
template <typename T>
inline constexpr vec<3, T> operator+(vec<3, T> const& v1, vec<3, T> const& v2)
{
return vec<3, T>(v1.x + v2.x,
v1.y + v2.y,
v1.z + v2.z);
}
template <typename T>
inline constexpr vec<3, T> operator-(vec<3, T> const& v1, vec<3, T> const& v2)
{
return vec<3, T>(v1.x - v2.x,
v1.y - v2.y,
v1.z - v2.z);
}
template <typename T>
inline constexpr vec<3, T> operator*(vec<3, T> const& v1, vec<3, T> const& v2)
{
return vec<3, T>(v1.x * v2.x,
v1.y * v2.y,
v1.z * v2.z);
}
template <typename T>
inline constexpr vec<3, T> operator*(vec<3, T> const& v1, T const& scalar)
{
return v1 * vec<3, T>(scalar);
}
template <typename T>
inline constexpr vec<3, T> operator*(T const& scalar, vec<3, T> const& v1)
{
return vec<3, T>(scalar) * v1;
}
template <typename T>
inline constexpr vec<3, T> operator/(vec<3, T> const& v1, vec<3, T> const& v2)
{
return vec<3, T>(v1.x / v2.x,
v1.y / v2.y,
v1.z / v2.z);
}
template <typename T>
inline constexpr vec<3, T> operator/(vec<3, T> const& v1, T const& scalar)
{
return v1 / vec<3, T>(scalar);
}
template <typename T>
inline constexpr T dot(vec<3, T> const& v1, vec<3, T> const& v2)
{
return
v1.x * v2.x +
v1.y * v2.y +
v1.z * v2.z;
}
template <typename T>
inline constexpr vec<3, T> cross(vec<3, T> const& v1, vec<3, T> const& v2)
{
return vec<3, T>(v1.y * v2.z - v2.y * v1.z,
v1.z * v2.x - v2.z * v1.x,
v1.x * v2.y - v2.x * v1.y);
}
template <typename T>
inline constexpr vec<3, T> functor1(T (&func) (T const& x), vec<3, T> const& v)
{
return vec<3, T>(func(v.x), func(v.y), func(v.z));
}
template <typename T, typename U>
inline constexpr vec<3, U> functor1(U (&func) (T const& x), vec<3, T> const& v)
{
return vec<3, U>(func(v.x), func(v.y), func(v.z));
}

164
include/math/vec4.hpp Normal file
View File

@ -0,0 +1,164 @@
#pragma once
#include "vec.hpp"
//
// vec4
//
template <typename T>
struct vec<4, T>
{
union {
T val[4];
struct { T x, y, z, w; };
struct { T a, r, g, b; };
};
inline constexpr vec();
inline constexpr vec(T scalar);
inline constexpr vec(T _x, T _y, T _z, T _w);
inline constexpr vec(const vec<3, T>& v);
constexpr inline vec<4, T> operator-() const;
inline constexpr T & operator[](int i);
inline constexpr T const& operator[](int i) const;
inline constexpr vec<4, T>& operator=(vec<4, T> const& v);
inline constexpr vec<4, T>& operator+=(vec<4, T> const& v);
inline constexpr vec<4, T>& operator-=(vec<4, T> const& v);
};
template <typename T>
inline constexpr vec<4, T>::vec()
: x(0), y(0), z(0), w(0)
{}
template <typename T>
inline constexpr vec<4, T>::vec(T scalar)
: x(scalar), y(scalar), z(scalar), w(scalar)
{}
template <typename T>
inline constexpr vec<4, T>::vec(T _x, T _y, T _z, T _w)
: x(_x), y(_y), z(_z), w(_w)
{}
template <typename T>
inline constexpr vec<4, T>::vec(const vec<3, T>& v)
: x(v.x), y(v.y), z(v.z), w(1.f)
{}
template <typename T>
constexpr inline vec<4, T> vec<4, T>::operator-() const
{
return vec<4, T>(-x, -y, -z, -w);
}
template <typename T>
inline constexpr T & vec<4, T>::operator[](int i)
{
return val[i];
}
template <typename T>
inline constexpr T const& vec<4, T>::operator[](int i) const
{
return val[i];
}
template <typename T>
inline constexpr vec<4, T>& vec<4, T>::operator=(vec<4, T> const& v)
{
this->x = static_cast<T>(v.x);
this->y = static_cast<T>(v.y);
this->z = static_cast<T>(v.z);
this->w = static_cast<T>(v.w);
return *this;
}
template <typename T>
inline constexpr vec<4, T>& vec<4, T>::operator+=(vec<4, T> const& v)
{
*this = *this + vec<4, T>(v);
return *this;
}
template <typename T>
inline constexpr vec<4, T>& vec<4, T>::operator-=(vec<4, T> const& v)
{
*this = *this - vec<4, T>(v);
return *this;
}
template <typename T>
inline constexpr vec<4, T> operator+(vec<4, T> const& v1, vec<4, T> const& v2)
{
return vec<4, T>(v1.x + v2.x,
v1.y + v2.y,
v1.z + v2.z,
v1.w + v2.w);
}
template <typename T>
inline constexpr vec<4, T> operator-(vec<4, T> const& v1, vec<4, T> const& v2)
{
return vec<4, T>(v1.x - v2.x,
v1.y - v2.y,
v1.z - v2.z,
v1.w - v2.w);
}
template <typename T>
inline constexpr vec<4, T> operator*(vec<4, T> const& v1, vec<4, T> const& v2)
{
return vec<4, T>(v1.x * v2.x,
v1.y * v2.y,
v1.z * v2.z,
v1.w * v2.w);
}
template <typename T>
inline constexpr vec<4, T> operator*(vec<4, T> const& v1, T const& scalar)
{
return v1 * vec<4, T>(scalar);
}
template <typename T>
inline constexpr vec<4, T> operator*(T const& scalar, vec<4, T> const& v1)
{
return vec<4, T>(scalar) * v1;
}
template <typename T>
inline constexpr vec<4, T> operator/(vec<4, T> const& v1, vec<4, T> const& v2)
{
return vec<4, T>(v1.x / v2.x,
v1.y / v2.y,
v1.z / v2.z,
v1.w / v2.w);
}
template <typename T>
inline constexpr vec<4, T> operator/(vec<4, T> const& v1, T const& scalar)
{
return v1 / vec<4, T>(scalar);
}
template <typename T>
inline constexpr T dot(vec<4, T> const& v1, vec<4, T> const& v2)
{
vec<4, T> tmp(v1 * v2);
return tmp.x + tmp.y + tmp.z + tmp.w;
}
template <typename T>
inline constexpr vec<4, T> functor1(T (&func) (T const& x), vec<4, T> const& v)
{
return vec<4, T>(func(v.x), func(v.y), func(v.z), func(v.w));
}
template <typename T, typename U>
inline constexpr vec<4, U> functor1(U (&func) (T const& x), vec<4, T> const& v)
{
return vec<4, U>(func(v.x), func(v.y), func(v.z), func(v.w));
}

13
include/mesh.h Normal file
View File

@ -0,0 +1,13 @@
#ifdef __cplusplus
extern "C" {
#endif
struct mesh {
unsigned int vtx;
unsigned int idx;
unsigned int length;
};
#ifdef __cplusplus
}
#endif

982
include/model/test_scene.h Normal file
View File

@ -0,0 +1,982 @@
#pragma once
const int test_scene_Plane_triangles[] = {
0, 1, 2,
3, 4, 5,
6, 7, 8,
9, 10, 11,
12, 13, 14,
15, 16, 17,
18, 19, 20,
21, 22, 23,
24, 25, 26,
27, 28, 29,
30, 31, 32,
33, 34, 35,
36, 37, 38,
39, 40, 41,
42, 43, 44,
45, 46, 47,
48, 49, 50,
51, 52, 53,
54, 55, 56,
57, 58, 59,
60, 61, 62,
63, 64, 65,
66, 67, 68,
69, 70, 71,
72, 73, 74,
75, 76, 77,
78, 79, 80,
81, 82, 83,
84, 85, 86,
87, 88, 89,
90, 91, 92,
93, 94, 95,
96, 97, 98,
99, 100, 101,
102, 103, 104,
105, 106, 107,
108, 109, 110,
111, 112, 113,
114, 115, 116,
117, 118, 119,
120, 121, 122,
123, 124, 125,
126, 127, 128,
129, 130, 131,
132, 133, 134,
135, 136, 137,
138, 139, 140,
141, 142, 143,
144, 145, 146,
147, 148, 149,
150, 151, 152,
153, 154, 155,
156, 157, 158,
159, 160, 161,
162, 163, 164,
165, 166, 167,
168, 169, 170,
171, 172, 173,
174, 175, 176,
177, 178, 179,
180, 181, 182,
183, 184, 185,
186, 187, 188,
189, 190, 191,
192, 193, 194,
195, 196, 197,
198, 199, 200,
201, 202, 203,
204, 205, 206,
207, 208, 209,
210, 211, 212,
213, 214, 215,
216, 217, 218,
219, 220, 221,
222, 223, 224,
225, 226, 227,
228, 229, 230,
231, 232, 233,
234, 235, 236,
237, 238, 239,
240, 241, 242,
243, 244, 245,
246, 247, 248,
249, 250, 251,
252, 253, 254,
255, 256, 257,
258, 259, 260,
261, 262, 263,
264, 265, 266,
267, 268, 269,
270, 271, 272,
273, 274, 275,
276, 277, 278,
279, 280, 281,
282, 283, 284,
285, 286, 287,
288, 289, 290,
291, 292, 293,
294, 295, 296,
297, 298, 299,
300, 301, 302,
303, 304, 305,
306, 307, 308,
0, 309, 1,
3, 310, 4,
6, 311, 7,
9, 312, 10,
12, 313, 13,
15, 314, 16,
18, 315, 19,
21, 316, 22,
24, 317, 25,
27, 318, 28,
30, 319, 31,
33, 320, 34,
36, 321, 37,
39, 322, 40,
42, 323, 43,
45, 324, 46,
48, 325, 49,
51, 326, 52,
54, 327, 55,
57, 328, 58,
60, 329, 61,
63, 330, 64,
66, 331, 67,
69, 332, 70,
72, 333, 73,
75, 334, 76,
78, 335, 79,
81, 336, 82,
84, 337, 85,
87, 338, 88,
90, 339, 91,
95, 340, 341,
341, 342, 343,
343, 344, 345,
345, 346, 347,
347, 348, 349,
349, 350, 351,
351, 352, 353,
353, 354, 93,
93, 355, 356,
356, 357, 358,
358, 359, 360,
360, 361, 94,
94, 362, 363,
363, 364, 365,
365, 366, 367,
367, 368, 95,
95, 341, 343,
343, 345, 347,
347, 349, 351,
351, 353, 93,
93, 356, 358,
358, 360, 94,
94, 363, 365,
365, 367, 95,
95, 343, 347,
347, 351, 93,
93, 358, 94,
94, 365, 95,
95, 347, 93,
96, 369, 97,
99, 370, 100,
104, 371, 372,
372, 373, 374,
374, 375, 376,
376, 377, 378,
378, 379, 380,
380, 381, 382,
382, 383, 384,
384, 385, 102,
102, 386, 387,
387, 388, 389,
389, 390, 391,
391, 392, 103,
103, 393, 394,
394, 395, 396,
396, 397, 398,
398, 399, 104,
104, 372, 374,
374, 376, 378,
378, 380, 382,
382, 384, 102,
102, 387, 389,
389, 391, 103,
103, 394, 396,
396, 398, 104,
104, 374, 378,
378, 382, 102,
102, 389, 103,
103, 396, 104,
104, 378, 102,
105, 400, 106,
108, 401, 109,
111, 402, 112,
114, 403, 115,
117, 404, 118,
120, 405, 121,
123, 406, 124,
126, 407, 127,
129, 408, 130,
132, 409, 133,
135, 410, 136,
138, 411, 139,
141, 412, 142,
144, 413, 145,
147, 414, 148,
150, 415, 151,
153, 416, 154,
156, 417, 157,
159, 418, 160,
162, 419, 163,
165, 420, 166,
168, 421, 169,
171, 422, 172,
174, 423, 175,
177, 424, 178,
180, 425, 181,
183, 426, 184,
186, 427, 187,
189, 428, 190,
192, 429, 193,
197, 430, 431,
431, 432, 433,
433, 434, 435,
435, 436, 437,
438, 439, 440,
441, 442, 443,
444, 445, 446,
446, 447, 195,
195, 448, 449,
449, 450, 451,
451, 452, 453,
453, 454, 196,
455, 456, 457,
458, 459, 460,
461, 462, 463,
463, 464, 197,
197, 431, 433,
433, 435, 437,
437, 465, 444,
444, 446, 195,
195, 449, 451,
451, 453, 196,
196, 466, 461,
461, 463, 197,
197, 433, 437,
437, 444, 195,
195, 451, 196,
196, 461, 197,
197, 437, 195,
198, 467, 199,
201, 468, 202,
206, 469, 470,
470, 471, 472,
472, 473, 474,
474, 475, 476,
476, 477, 478,
478, 479, 480,
480, 481, 482,
482, 483, 204,
204, 484, 485,
485, 486, 487,
487, 488, 489,
489, 490, 205,
205, 491, 492,
492, 493, 494,
494, 495, 496,
496, 497, 206,
206, 470, 472,
472, 474, 476,
476, 478, 480,
480, 482, 204,
204, 485, 487,
487, 489, 205,
205, 492, 494,
494, 496, 206,
206, 472, 476,
476, 480, 204,
204, 487, 205,
205, 494, 206,
206, 476, 204,
207, 498, 208,
210, 499, 211,
213, 500, 214,
216, 501, 217,
219, 502, 220,
222, 503, 223,
225, 504, 226,
228, 505, 229,
231, 506, 232,
234, 507, 235,
237, 508, 238,
240, 509, 241,
243, 510, 244,
246, 511, 247,
249, 512, 250,
252, 513, 253,
255, 514, 256,
258, 515, 259,
261, 516, 262,
264, 517, 265,
267, 518, 268,
270, 519, 271,
273, 520, 274,
276, 521, 277,
279, 522, 280,
282, 523, 283,
285, 524, 286,
288, 525, 289,
291, 526, 292,
294, 527, 295,
528, 529, 530,
531, 532, 533,
534, 535, 536,
536, 537, 538,
538, 539, 540,
540, 541, 542,
542, 543, 544,
544, 545, 297,
546, 547, 548,
549, 550, 551,
552, 553, 554,
554, 555, 298,
298, 556, 557,
557, 558, 559,
559, 560, 561,
561, 562, 299,
299, 563, 534,
534, 536, 538,
538, 540, 542,
542, 544, 297,
297, 564, 552,
552, 554, 298,
298, 557, 559,
559, 561, 299,
299, 534, 538,
538, 542, 297,
297, 552, 298,
298, 559, 299,
299, 538, 297,
300, 565, 301,
303, 566, 304,
308, 567, 568,
568, 569, 570,
570, 571, 572,
572, 573, 574,
574, 575, 576,
576, 577, 578,
578, 579, 580,
580, 581, 306,
306, 582, 583,
583, 584, 585,
585, 586, 587,
587, 588, 307,
307, 589, 590,
590, 591, 592,
592, 593, 594,
594, 595, 308,
308, 568, 570,
570, 572, 574,
574, 576, 578,
578, 580, 306,
306, 583, 585,
585, 587, 307,
307, 590, 592,
592, 594, 308,
308, 570, 574,
574, 578, 306,
306, 585, 307,
307, 592, 308,
308, 574, 306,
};
const int test_scene_Plane_triangles_length = (sizeof (test_scene_Plane_triangles)) / (sizeof (test_scene_Plane_triangles[0]));
const float test_scene_vertices[] = {
1.000000f, 0.000000f, 1.000000f, 0.093750f, 0.031250f, -0.0000f, 1.0000f, -0.0000f,
-1.000000f, 0.000000f, -1.000000f, 0.031250f, 0.093750f, -0.0000f, 1.0000f, -0.0000f,
-1.000000f, 0.000000f, 1.000000f, 0.031250f, 0.031250f, -0.0000f, 1.0000f, -0.0000f,
0.000000f, 0.050000f, 0.000000f, 0.318803f, 0.919541f, 0.0980f, 0.9952f, -0.0000f,
0.009755f, 0.049039f, -1.000000f, 0.312010f, 0.810852f, 0.0980f, 0.9952f, -0.0000f,
0.000000f, 0.050000f, -1.000000f, 0.318803f, 0.810852f, 0.0980f, 0.9952f, -0.0000f,
0.009755f, 0.049039f, 0.000000f, 0.312010f, 0.919541f, 0.2903f, 0.9569f, -0.0000f,
0.019134f, 0.046194f, -1.000000f, 0.305217f, 0.810852f, 0.2903f, 0.9569f, -0.0000f,
0.009755f, 0.049039f, -1.000000f, 0.312010f, 0.810852f, 0.2903f, 0.9569f, -0.0000f,
0.019134f, 0.046194f, 0.000000f, 0.305217f, 0.919541f, 0.4714f, 0.8819f, -0.0000f,
0.027779f, 0.041574f, -1.000000f, 0.298423f, 0.810852f, 0.4714f, 0.8819f, -0.0000f,
0.019134f, 0.046194f, -1.000000f, 0.305217f, 0.810852f, 0.4714f, 0.8819f, -0.0000f,
0.027779f, 0.041573f, 0.000000f, 0.298423f, 0.919541f, 0.6344f, 0.7730f, -0.0000f,
0.035355f, 0.035355f, -1.000000f, 0.291630f, 0.810852f, 0.6344f, 0.7730f, -0.0000f,
0.027779f, 0.041574f, -1.000000f, 0.298423f, 0.810852f, 0.6344f, 0.7730f, -0.0000f,
0.035355f, 0.035355f, 0.000000f, 0.291630f, 0.919541f, 0.7730f, 0.6344f, -0.0000f,
0.041573f, 0.027779f, -1.000000f, 0.284837f, 0.810852f, 0.7730f, 0.6344f, -0.0000f,
0.035355f, 0.035355f, -1.000000f, 0.291630f, 0.810852f, 0.7730f, 0.6344f, -0.0000f,
0.041573f, 0.027778f, 0.000000f, 0.284837f, 0.919541f, 0.8819f, 0.4714f, -0.0000f,
0.046194f, 0.019134f, -1.000000f, 0.278044f, 0.810852f, 0.8819f, 0.4714f, -0.0000f,
0.041573f, 0.027779f, -1.000000f, 0.284837f, 0.810852f, 0.8819f, 0.4714f, -0.0000f,
0.046194f, 0.019134f, 0.000000f, 0.278044f, 0.919541f, 0.9569f, 0.2903f, -0.0000f,
0.049039f, 0.009755f, -1.000000f, 0.271251f, 0.810852f, 0.9569f, 0.2903f, -0.0000f,
0.046194f, 0.019134f, -1.000000f, 0.278044f, 0.810852f, 0.9569f, 0.2903f, -0.0000f,
0.049039f, 0.009754f, 0.000000f, 0.271251f, 0.919541f, 0.9952f, 0.0980f, -0.0000f,
0.050000f, 0.000000f, -1.000000f, 0.264458f, 0.810852f, 0.9952f, 0.0980f, -0.0000f,
0.049039f, 0.009755f, -1.000000f, 0.271251f, 0.810852f, 0.9952f, 0.0980f, -0.0000f,
0.050000f, -0.000000f, -0.000000f, 0.264458f, 0.919541f, 0.9952f, -0.0980f, -0.0000f,
0.049039f, -0.009754f, -1.000000f, 0.257665f, 0.810852f, 0.9952f, -0.0980f, -0.0000f,
0.050000f, 0.000000f, -1.000000f, 0.264458f, 0.810852f, 0.9952f, -0.0980f, -0.0000f,
0.049039f, -0.009755f, -0.000000f, 0.257665f, 0.919541f, 0.9569f, -0.2903f, -0.0000f,
0.046194f, -0.019134f, -1.000000f, 0.250872f, 0.810852f, 0.9569f, -0.2903f, -0.0000f,
0.049039f, -0.009754f, -1.000000f, 0.257665f, 0.810852f, 0.9569f, -0.2903f, -0.0000f,
0.046194f, -0.019134f, -0.000000f, 0.250872f, 0.919541f, 0.8819f, -0.4714f, -0.0000f,
0.041573f, -0.027778f, -1.000000f, 0.244079f, 0.810852f, 0.8819f, -0.4714f, -0.0000f,
0.046194f, -0.019134f, -1.000000f, 0.250872f, 0.810852f, 0.8819f, -0.4714f, -0.0000f,
0.041573f, -0.027779f, -0.000000f, 0.244079f, 0.919541f, 0.7730f, -0.6344f, -0.0000f,
0.035355f, -0.035355f, -1.000000f, 0.237286f, 0.810852f, 0.7730f, -0.6344f, -0.0000f,
0.041573f, -0.027778f, -1.000000f, 0.244079f, 0.810852f, 0.7730f, -0.6344f, -0.0000f,
0.035355f, -0.035355f, -0.000000f, 0.237286f, 0.919541f, 0.6344f, -0.7730f, -0.0000f,
0.027779f, -0.041573f, -1.000000f, 0.230493f, 0.810852f, 0.6344f, -0.7730f, -0.0000f,
0.035355f, -0.035355f, -1.000000f, 0.237286f, 0.810852f, 0.6344f, -0.7730f, -0.0000f,
0.027779f, -0.041574f, -0.000000f, 0.230493f, 0.919541f, 0.4714f, -0.8819f, -0.0000f,
0.019134f, -0.046194f, -1.000000f, 0.223699f, 0.810852f, 0.4714f, -0.8819f, -0.0000f,
0.027779f, -0.041573f, -1.000000f, 0.230493f, 0.810852f, 0.4714f, -0.8819f, -0.0000f,
0.019134f, -0.046194f, -0.000000f, 0.223699f, 0.919541f, 0.2903f, -0.9569f, -0.0000f,
0.009755f, -0.049039f, -1.000000f, 0.216906f, 0.810852f, 0.2903f, -0.9569f, -0.0000f,
0.019134f, -0.046194f, -1.000000f, 0.223699f, 0.810852f, 0.2903f, -0.9569f, -0.0000f,
0.009755f, -0.049039f, -0.000000f, 0.216906f, 0.919541f, 0.0980f, -0.9952f, -0.0000f,
0.000000f, -0.050000f, -1.000000f, 0.210113f, 0.810852f, 0.0980f, -0.9952f, -0.0000f,
0.009755f, -0.049039f, -1.000000f, 0.216906f, 0.810852f, 0.0980f, -0.9952f, -0.0000f,
0.000000f, -0.050000f, -1.000000f, 0.210113f, 0.810852f, -0.0980f, -0.9952f, -0.0000f,
-0.009755f, -0.049039f, -0.000000f, 0.203320f, 0.919541f, -0.0980f, -0.9952f, -0.0000f,
-0.009755f, -0.049039f, -1.000000f, 0.203320f, 0.810852f, -0.0980f, -0.9952f, -0.0000f,
-0.009755f, -0.049039f, -0.000000f, 0.203320f, 0.919541f, -0.2903f, -0.9569f, -0.0000f,
-0.019134f, -0.046194f, -1.000000f, 0.196527f, 0.810852f, -0.2903f, -0.9569f, -0.0000f,
-0.009755f, -0.049039f, -1.000000f, 0.203320f, 0.810852f, -0.2903f, -0.9569f, -0.0000f,
-0.019134f, -0.046194f, -0.000000f, 0.196527f, 0.919541f, -0.4714f, -0.8819f, -0.0000f,
-0.027779f, -0.041573f, -1.000000f, 0.189734f, 0.810852f, -0.4714f, -0.8819f, -0.0000f,
-0.019134f, -0.046194f, -1.000000f, 0.196527f, 0.810852f, -0.4714f, -0.8819f, -0.0000f,
-0.027779f, -0.041574f, -0.000000f, 0.189734f, 0.919541f, -0.6344f, -0.7730f, -0.0000f,
-0.035355f, -0.035355f, -1.000000f, 0.182941f, 0.810852f, -0.6344f, -0.7730f, -0.0000f,
-0.027779f, -0.041573f, -1.000000f, 0.189734f, 0.810852f, -0.6344f, -0.7730f, -0.0000f,
-0.035355f, -0.035355f, -0.000000f, 0.182941f, 0.919541f, -0.7730f, -0.6344f, -0.0000f,
-0.041573f, -0.027778f, -1.000000f, 0.176148f, 0.810852f, -0.7730f, -0.6344f, -0.0000f,
-0.035355f, -0.035355f, -1.000000f, 0.182941f, 0.810852f, -0.7730f, -0.6344f, -0.0000f,
-0.041573f, -0.027779f, -0.000000f, 0.176148f, 0.919541f, -0.8819f, -0.4714f, -0.0000f,
-0.046194f, -0.019134f, -1.000000f, 0.169355f, 0.810852f, -0.8819f, -0.4714f, -0.0000f,
-0.041573f, -0.027778f, -1.000000f, 0.176148f, 0.810852f, -0.8819f, -0.4714f, -0.0000f,
-0.046194f, -0.019134f, -0.000000f, 0.169355f, 0.919541f, -0.9569f, -0.2903f, -0.0000f,
-0.049039f, -0.009754f, -1.000000f, 0.162562f, 0.810852f, -0.9569f, -0.2903f, -0.0000f,
-0.046194f, -0.019134f, -1.000000f, 0.169355f, 0.810852f, -0.9569f, -0.2903f, -0.0000f,
-0.049039f, -0.009755f, -0.000000f, 0.162562f, 0.919541f, -0.9952f, -0.0980f, -0.0000f,
-0.050000f, 0.000000f, -1.000000f, 0.155769f, 0.810852f, -0.9952f, -0.0980f, -0.0000f,
-0.049039f, -0.009754f, -1.000000f, 0.162562f, 0.810852f, -0.9952f, -0.0980f, -0.0000f,
-0.050000f, -0.000000f, -0.000000f, 0.155769f, 0.919541f, -0.9952f, 0.0980f, -0.0000f,
-0.049039f, 0.009755f, -1.000000f, 0.148975f, 0.810852f, -0.9952f, 0.0980f, -0.0000f,
-0.050000f, 0.000000f, -1.000000f, 0.155769f, 0.810852f, -0.9952f, 0.0980f, -0.0000f,
-0.049039f, 0.009754f, 0.000000f, 0.148975f, 0.919541f, -0.9569f, 0.2903f, -0.0000f,
-0.046194f, 0.019134f, -1.000000f, 0.142182f, 0.810852f, -0.9569f, 0.2903f, -0.0000f,
-0.049039f, 0.009755f, -1.000000f, 0.148975f, 0.810852f, -0.9569f, 0.2903f, -0.0000f,
-0.046194f, 0.019134f, 0.000000f, 0.142182f, 0.919541f, -0.8819f, 0.4714f, -0.0000f,
-0.041573f, 0.027779f, -1.000000f, 0.135389f, 0.810852f, -0.8819f, 0.4714f, -0.0000f,
-0.046194f, 0.019134f, -1.000000f, 0.142182f, 0.810852f, -0.8819f, 0.4714f, -0.0000f,
-0.041573f, 0.027778f, 0.000000f, 0.135389f, 0.919541f, -0.7730f, 0.6344f, -0.0000f,
-0.035355f, 0.035355f, -1.000000f, 0.128596f, 0.810852f, -0.7730f, 0.6344f, -0.0000f,
-0.041573f, 0.027779f, -1.000000f, 0.135389f, 0.810852f, -0.7730f, 0.6344f, -0.0000f,
-0.035355f, 0.035355f, 0.000000f, 0.128596f, 0.919541f, -0.6344f, 0.7730f, -0.0000f,
-0.027779f, 0.041574f, -1.000000f, 0.121803f, 0.810852f, -0.6344f, 0.7730f, -0.0000f,
-0.035355f, 0.035355f, -1.000000f, 0.128596f, 0.810852f, -0.6344f, 0.7730f, -0.0000f,
-0.027779f, 0.041573f, 0.000000f, 0.121803f, 0.919541f, -0.4714f, 0.8819f, -0.0000f,
-0.019134f, 0.046194f, -1.000000f, 0.115010f, 0.810852f, -0.4714f, 0.8819f, -0.0000f,
-0.027779f, 0.041574f, -1.000000f, 0.121803f, 0.810852f, -0.4714f, 0.8819f, -0.0000f,
-0.019134f, -0.046194f, -0.000000f, 0.135804f, 0.708308f, -0.0000f, -0.0000f, 1.0000f,
0.046194f, -0.019134f, -0.000000f, 0.203968f, 0.736542f, -0.0000f, -0.0000f, 1.0000f,
0.019134f, 0.046194f, 0.000000f, 0.175734f, 0.804707f, -0.0000f, -0.0000f, 1.0000f,
-0.019134f, 0.046194f, 0.000000f, 0.115010f, 0.919541f, -0.2903f, 0.9569f, -0.0000f,
-0.009755f, 0.049039f, -1.000000f, 0.108217f, 0.810852f, -0.2903f, 0.9569f, -0.0000f,
-0.019134f, 0.046194f, -1.000000f, 0.115010f, 0.810852f, -0.2903f, 0.9569f, -0.0000f,
-0.009755f, 0.049039f, -1.000000f, 0.108217f, 0.810852f, -0.0980f, 0.9952f, -0.0000f,
0.000000f, 0.050000f, 0.000000f, 0.101424f, 0.919541f, -0.0980f, 0.9952f, -0.0000f,
0.000000f, 0.050000f, -1.000000f, 0.101424f, 0.810852f, -0.0980f, 0.9952f, -0.0000f,
0.009755f, -0.049039f, -1.000000f, 0.274636f, 0.705339f, -0.0000f, -0.0000f, -1.0000f,
-0.049039f, -0.009754f, -1.000000f, 0.213289f, 0.746329f, -0.0000f, -0.0000f, -1.0000f,
-0.009755f, 0.049039f, -1.000000f, 0.254280f, 0.807676f, -0.0000f, -0.0000f, -1.0000f,
1.000000f, 0.050000f, -0.000000f, 0.857352f, 0.280261f, -0.0000f, 0.9952f, -0.0980f,
0.000000f, 0.049039f, -0.009755f, 0.852554f, 0.203494f, -0.0000f, 0.9952f, -0.0980f,
0.000000f, 0.050000f, -0.000000f, 0.857352f, 0.203494f, -0.0000f, 0.9952f, -0.0980f,
1.000000f, 0.049039f, -0.009755f, 0.852554f, 0.280261f, -0.0000f, 0.9569f, -0.2903f,
0.000000f, 0.046194f, -0.019134f, 0.847756f, 0.203494f, -0.0000f, 0.9569f, -0.2903f,
0.000000f, 0.049039f, -0.009755f, 0.852554f, 0.203494f, -0.0000f, 0.9569f, -0.2903f,
1.000000f, 0.046194f, -0.019134f, 0.847756f, 0.280261f, -0.0000f, 0.8819f, -0.4714f,
0.000000f, 0.041574f, -0.027779f, 0.842958f, 0.203494f, -0.0000f, 0.8819f, -0.4714f,
0.000000f, 0.046194f, -0.019134f, 0.847756f, 0.203494f, -0.0000f, 0.8819f, -0.4714f,
1.000000f, 0.041573f, -0.027779f, 0.842958f, 0.280261f, -0.0000f, 0.7730f, -0.6344f,
0.000000f, 0.035355f, -0.035355f, 0.838161f, 0.203494f, -0.0000f, 0.7730f, -0.6344f,
0.000000f, 0.041574f, -0.027779f, 0.842958f, 0.203494f, -0.0000f, 0.7730f, -0.6344f,
1.000000f, 0.035355f, -0.035355f, 0.838161f, 0.280261f, -0.0000f, 0.6344f, -0.7730f,
-0.000000f, 0.027779f, -0.041573f, 0.833363f, 0.203494f, -0.0000f, 0.6344f, -0.7730f,
0.000000f, 0.035355f, -0.035355f, 0.838161f, 0.203494f, -0.0000f, 0.6344f, -0.7730f,
1.000000f, 0.027778f, -0.041574f, 0.833363f, 0.280261f, -0.0000f, 0.4714f, -0.8819f,
-0.000000f, 0.019134f, -0.046194f, 0.828565f, 0.203494f, -0.0000f, 0.4714f, -0.8819f,
-0.000000f, 0.027779f, -0.041573f, 0.833363f, 0.203494f, -0.0000f, 0.4714f, -0.8819f,
1.000000f, 0.019134f, -0.046194f, 0.828565f, 0.280261f, -0.0000f, 0.2903f, -0.9569f,
-0.000000f, 0.009755f, -0.049039f, 0.823767f, 0.203494f, -0.0000f, 0.2903f, -0.9569f,
-0.000000f, 0.019134f, -0.046194f, 0.828565f, 0.203494f, -0.0000f, 0.2903f, -0.9569f,
1.000000f, 0.009754f, -0.049039f, 0.823767f, 0.280261f, -0.0000f, 0.0980f, -0.9952f,
-0.000000f, 0.000000f, -0.050000f, 0.818969f, 0.203494f, -0.0000f, 0.0980f, -0.9952f,
-0.000000f, 0.009755f, -0.049039f, 0.823767f, 0.203494f, -0.0000f, 0.0980f, -0.9952f,
1.000000f, -0.000000f, -0.050000f, 0.818969f, 0.280261f, -0.0000f, -0.0980f, -0.9952f,
-0.000000f, -0.009754f, -0.049039f, 0.814171f, 0.203494f, -0.0000f, -0.0980f, -0.9952f,
-0.000000f, 0.000000f, -0.050000f, 0.818969f, 0.203494f, -0.0000f, -0.0980f, -0.9952f,
1.000000f, -0.009755f, -0.049039f, 0.814171f, 0.280261f, -0.0000f, -0.2903f, -0.9569f,
-0.000000f, -0.019134f, -0.046194f, 0.809373f, 0.203494f, -0.0000f, -0.2903f, -0.9569f,
-0.000000f, -0.009754f, -0.049039f, 0.814171f, 0.203494f, -0.0000f, -0.2903f, -0.9569f,
1.000000f, -0.019134f, -0.046194f, 0.809373f, 0.280261f, -0.0000f, -0.4714f, -0.8819f,
-0.000000f, -0.027778f, -0.041573f, 0.804575f, 0.203494f, -0.0000f, -0.4714f, -0.8819f,
-0.000000f, -0.019134f, -0.046194f, 0.809373f, 0.203494f, -0.0000f, -0.4714f, -0.8819f,
1.000000f, -0.027779f, -0.041574f, 0.804575f, 0.280261f, -0.0000f, -0.6344f, -0.7730f,
-0.000000f, -0.035355f, -0.035355f, 0.799777f, 0.203494f, -0.0000f, -0.6344f, -0.7730f,
-0.000000f, -0.027778f, -0.041573f, 0.804575f, 0.203494f, -0.0000f, -0.6344f, -0.7730f,
1.000000f, -0.035355f, -0.035355f, 0.799777f, 0.280261f, -0.0000f, -0.7730f, -0.6344f,
-0.000000f, -0.041573f, -0.027779f, 0.794979f, 0.203494f, -0.0000f, -0.7730f, -0.6344f,
-0.000000f, -0.035355f, -0.035355f, 0.799777f, 0.203494f, -0.0000f, -0.7730f, -0.6344f,
1.000000f, -0.041574f, -0.027779f, 0.794979f, 0.280261f, -0.0000f, -0.8819f, -0.4714f,
-0.000000f, -0.046194f, -0.019134f, 0.790181f, 0.203494f, -0.0000f, -0.8819f, -0.4714f,
-0.000000f, -0.041573f, -0.027779f, 0.794979f, 0.203494f, -0.0000f, -0.8819f, -0.4714f,
1.000000f, -0.046194f, -0.019134f, 0.790181f, 0.280261f, -0.0000f, -0.9569f, -0.2903f,
-0.000000f, -0.049039f, -0.009755f, 0.785383f, 0.203494f, -0.0000f, -0.9569f, -0.2903f,
-0.000000f, -0.046194f, -0.019134f, 0.790181f, 0.203494f, -0.0000f, -0.9569f, -0.2903f,
1.000000f, -0.049039f, -0.009755f, 0.785383f, 0.280261f, -0.0000f, -0.9952f, -0.0980f,
-0.000000f, -0.050000f, 0.000000f, 0.780586f, 0.203494f, -0.0000f, -0.9952f, -0.0980f,
-0.000000f, -0.049039f, -0.009755f, 0.785383f, 0.203494f, -0.0000f, -0.9952f, -0.0980f,
-0.000000f, -0.050000f, 0.000000f, 0.780586f, 0.203494f, -0.0000f, -0.9952f, 0.0980f,
1.000000f, -0.049039f, 0.009754f, 0.775788f, 0.280261f, -0.0000f, -0.9952f, 0.0980f,
-0.000000f, -0.049039f, 0.009755f, 0.775788f, 0.203494f, -0.0000f, -0.9952f, 0.0980f,
1.000000f, -0.049039f, 0.009754f, 0.775788f, 0.280261f, -0.0000f, -0.9569f, 0.2903f,
-0.000000f, -0.046194f, 0.019134f, 0.770990f, 0.203494f, -0.0000f, -0.9569f, 0.2903f,
-0.000000f, -0.049039f, 0.009755f, 0.775788f, 0.203494f, -0.0000f, -0.9569f, 0.2903f,
1.000000f, -0.046194f, 0.019134f, 0.770990f, 0.280261f, -0.0000f, -0.8819f, 0.4714f,
-0.000000f, -0.041573f, 0.027779f, 0.766192f, 0.203494f, -0.0000f, -0.8819f, 0.4714f,
-0.000000f, -0.046194f, 0.019134f, 0.770990f, 0.203494f, -0.0000f, -0.8819f, 0.4714f,
1.000000f, -0.041574f, 0.027778f, 0.766192f, 0.280261f, -0.0000f, -0.7730f, 0.6344f,
0.000000f, -0.035355f, 0.035355f, 0.761394f, 0.203494f, -0.0000f, -0.7730f, 0.6344f,
-0.000000f, -0.041573f, 0.027779f, 0.766192f, 0.203494f, -0.0000f, -0.7730f, 0.6344f,
1.000000f, -0.035355f, 0.035355f, 0.761394f, 0.280261f, -0.0000f, -0.6344f, 0.7730f,
0.000000f, -0.027778f, 0.041573f, 0.756596f, 0.203494f, -0.0000f, -0.6344f, 0.7730f,
0.000000f, -0.035355f, 0.035355f, 0.761394f, 0.203494f, -0.0000f, -0.6344f, 0.7730f,
1.000000f, -0.027779f, 0.041573f, 0.756596f, 0.280261f, -0.0000f, -0.4714f, 0.8819f,
0.000000f, -0.019134f, 0.046194f, 0.751798f, 0.203494f, -0.0000f, -0.4714f, 0.8819f,
0.000000f, -0.027778f, 0.041573f, 0.756596f, 0.203494f, -0.0000f, -0.4714f, 0.8819f,
1.000000f, -0.019134f, 0.046194f, 0.751798f, 0.280261f, -0.0000f, -0.2903f, 0.9569f,
0.000000f, -0.009754f, 0.049039f, 0.747000f, 0.203494f, -0.0000f, -0.2903f, 0.9569f,
0.000000f, -0.019134f, 0.046194f, 0.751798f, 0.203494f, -0.0000f, -0.2903f, 0.9569f,
1.000000f, -0.009755f, 0.049039f, 0.747000f, 0.280261f, -0.0000f, -0.0980f, 0.9952f,
0.000000f, 0.000000f, 0.050000f, 0.742202f, 0.203494f, -0.0000f, -0.0980f, 0.9952f,
0.000000f, -0.009754f, 0.049039f, 0.747000f, 0.203494f, -0.0000f, -0.0980f, 0.9952f,
1.000000f, -0.000000f, 0.050000f, 0.742202f, 0.280261f, -0.0000f, 0.0980f, 0.9952f,
0.000000f, 0.009755f, 0.049039f, 0.737404f, 0.203494f, -0.0000f, 0.0980f, 0.9952f,
0.000000f, 0.000000f, 0.050000f, 0.742202f, 0.203494f, -0.0000f, 0.0980f, 0.9952f,
1.000000f, 0.009754f, 0.049039f, 0.737404f, 0.280261f, -0.0000f, 0.2903f, 0.9569f,
0.000000f, 0.019134f, 0.046194f, 0.732606f, 0.203494f, -0.0000f, 0.2903f, 0.9569f,
0.000000f, 0.009755f, 0.049039f, 0.737404f, 0.203494f, -0.0000f, 0.2903f, 0.9569f,
1.000000f, 0.019134f, 0.046194f, 0.732606f, 0.280261f, -0.0000f, 0.4714f, 0.8819f,
0.000000f, 0.027779f, 0.041573f, 0.727808f, 0.203494f, -0.0000f, 0.4714f, 0.8819f,
0.000000f, 0.019134f, 0.046194f, 0.732606f, 0.203494f, -0.0000f, 0.4714f, 0.8819f,
1.000000f, 0.027778f, 0.041573f, 0.727808f, 0.280261f, -0.0000f, 0.6344f, 0.7730f,
0.000000f, 0.035355f, 0.035355f, 0.723011f, 0.203494f, -0.0000f, 0.6344f, 0.7730f,
0.000000f, 0.027779f, 0.041573f, 0.727808f, 0.203494f, -0.0000f, 0.6344f, 0.7730f,
1.000000f, 0.035355f, 0.035355f, 0.723011f, 0.280261f, -0.0000f, 0.7730f, 0.6344f,
0.000000f, 0.041574f, 0.027779f, 0.718213f, 0.203494f, -0.0000f, 0.7730f, 0.6344f,
0.000000f, 0.035355f, 0.035355f, 0.723011f, 0.203494f, -0.0000f, 0.7730f, 0.6344f,
1.000000f, 0.041573f, 0.027778f, 0.718213f, 0.280261f, -0.0000f, 0.8819f, 0.4714f,
0.000000f, 0.046194f, 0.019134f, 0.713415f, 0.203494f, -0.0000f, 0.8819f, 0.4714f,
0.000000f, 0.041574f, 0.027779f, 0.718213f, 0.203494f, -0.0000f, 0.8819f, 0.4714f,
1.000000f, -0.046194f, 0.019134f, 0.728101f, 0.131068f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.019134f, -0.046194f, 0.776245f, 0.151010f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.046194f, -0.019134f, 0.756303f, 0.199154f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.046194f, 0.019134f, 0.713415f, 0.280261f, -0.0000f, 0.9569f, 0.2903f,
0.000000f, 0.049039f, 0.009755f, 0.708617f, 0.203494f, -0.0000f, 0.9569f, 0.2903f,
0.000000f, 0.046194f, 0.019134f, 0.713415f, 0.203494f, -0.0000f, 0.9569f, 0.2903f,
0.000000f, 0.049039f, 0.009755f, 0.708617f, 0.203494f, -0.0000f, 0.9952f, 0.0980f,
1.000000f, 0.050000f, -0.000000f, 0.703819f, 0.280261f, -0.0000f, 0.9952f, 0.0980f,
0.000000f, 0.050000f, -0.000000f, 0.703819f, 0.203494f, -0.0000f, 0.9952f, 0.0980f,
-0.000000f, -0.049039f, -0.009755f, 0.826158f, 0.128971f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, -0.009754f, 0.049039f, 0.782829f, 0.157922f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.049039f, 0.009755f, 0.811780f, 0.201251f, -1.0000f, -0.0000f, -0.0000f,
-0.050000f, 0.000000f, 0.000000f, 0.908319f, 0.765721f, -0.9952f, -0.0000f, -0.0980f,
-0.049039f, 1.000000f, -0.009755f, 0.900433f, 0.891905f, -0.9952f, -0.0000f, -0.0980f,
-0.049039f, -0.000000f, -0.009755f, 0.900433f, 0.765721f, -0.9952f, -0.0000f, -0.0980f,
-0.049039f, 1.000000f, -0.009755f, 0.900433f, 0.891905f, -0.9569f, -0.0000f, -0.2903f,
-0.046194f, -0.000000f, -0.019134f, 0.892546f, 0.765721f, -0.9569f, -0.0000f, -0.2903f,
-0.049039f, -0.000000f, -0.009755f, 0.900433f, 0.765721f, -0.9569f, -0.0000f, -0.2903f,
-0.046194f, 1.000000f, -0.019134f, 0.892546f, 0.891905f, -0.8819f, -0.0000f, -0.4714f,
-0.041574f, -0.000000f, -0.027779f, 0.884660f, 0.765721f, -0.8819f, -0.0000f, -0.4714f,
-0.046194f, -0.000000f, -0.019134f, 0.892546f, 0.765721f, -0.8819f, -0.0000f, -0.4714f,
-0.041574f, 1.000000f, -0.027779f, 0.884660f, 0.891905f, -0.7730f, -0.0000f, -0.6344f,
-0.035355f, -0.000000f, -0.035355f, 0.876773f, 0.765721f, -0.7730f, -0.0000f, -0.6344f,
-0.041574f, -0.000000f, -0.027779f, 0.884660f, 0.765721f, -0.7730f, -0.0000f, -0.6344f,
-0.035355f, 1.000000f, -0.035355f, 0.876773f, 0.891905f, -0.6344f, -0.0000f, -0.7730f,
-0.027779f, -0.000000f, -0.041573f, 0.868887f, 0.765721f, -0.6344f, -0.0000f, -0.7730f,
-0.035355f, -0.000000f, -0.035355f, 0.876773f, 0.765721f, -0.6344f, -0.0000f, -0.7730f,
-0.027779f, 1.000000f, -0.041574f, 0.868887f, 0.891905f, -0.4714f, -0.0000f, -0.8819f,
-0.019134f, -0.000000f, -0.046194f, 0.861000f, 0.765721f, -0.4714f, -0.0000f, -0.8819f,
-0.027779f, -0.000000f, -0.041573f, 0.868887f, 0.765721f, -0.4714f, -0.0000f, -0.8819f,
-0.019134f, 1.000000f, -0.046194f, 0.861000f, 0.891905f, -0.2903f, -0.0000f, -0.9569f,
-0.009755f, -0.000000f, -0.049039f, 0.853114f, 0.765721f, -0.2903f, -0.0000f, -0.9569f,
-0.019134f, -0.000000f, -0.046194f, 0.861000f, 0.765721f, -0.2903f, -0.0000f, -0.9569f,
-0.009755f, 1.000000f, -0.049039f, 0.853114f, 0.891905f, -0.0980f, -0.0000f, -0.9952f,
-0.000000f, -0.000000f, -0.050000f, 0.845227f, 0.765721f, -0.0980f, -0.0000f, -0.9952f,
-0.009755f, -0.000000f, -0.049039f, 0.853114f, 0.765721f, -0.0980f, -0.0000f, -0.9952f,
-0.000000f, 1.000000f, -0.050000f, 0.845227f, 0.891905f, 0.0980f, -0.0000f, -0.9952f,
0.009754f, -0.000000f, -0.049039f, 0.837341f, 0.765721f, 0.0980f, -0.0000f, -0.9952f,
-0.000000f, -0.000000f, -0.050000f, 0.845227f, 0.765721f, 0.0980f, -0.0000f, -0.9952f,
0.009754f, 1.000000f, -0.049039f, 0.837341f, 0.891905f, 0.2903f, -0.0000f, -0.9569f,
0.019134f, -0.000000f, -0.046194f, 0.829455f, 0.765721f, 0.2903f, -0.0000f, -0.9569f,
0.009754f, -0.000000f, -0.049039f, 0.837341f, 0.765721f, 0.2903f, -0.0000f, -0.9569f,
0.019134f, 1.000000f, -0.046194f, 0.829455f, 0.891905f, 0.4714f, -0.0000f, -0.8819f,
0.027778f, -0.000000f, -0.041573f, 0.821568f, 0.765721f, 0.4714f, -0.0000f, -0.8819f,
0.019134f, -0.000000f, -0.046194f, 0.829455f, 0.765721f, 0.4714f, -0.0000f, -0.8819f,
0.027778f, 1.000000f, -0.041574f, 0.821568f, 0.891905f, 0.6344f, -0.0000f, -0.7730f,
0.035355f, -0.000000f, -0.035355f, 0.813682f, 0.765721f, 0.6344f, -0.0000f, -0.7730f,
0.027778f, -0.000000f, -0.041573f, 0.821568f, 0.765721f, 0.6344f, -0.0000f, -0.7730f,
0.035355f, 1.000000f, -0.035355f, 0.813682f, 0.891905f, 0.7730f, -0.0000f, -0.6344f,
0.041573f, -0.000000f, -0.027779f, 0.805795f, 0.765721f, 0.7730f, -0.0000f, -0.6344f,
0.035355f, -0.000000f, -0.035355f, 0.813682f, 0.765721f, 0.7730f, -0.0000f, -0.6344f,
0.041573f, 1.000000f, -0.027779f, 0.805795f, 0.891905f, 0.8819f, -0.0000f, -0.4714f,
0.046194f, -0.000000f, -0.019134f, 0.797909f, 0.765721f, 0.8819f, -0.0000f, -0.4714f,
0.041573f, -0.000000f, -0.027779f, 0.805795f, 0.765721f, 0.8819f, -0.0000f, -0.4714f,
0.046194f, 1.000000f, -0.019134f, 0.797909f, 0.891905f, 0.9569f, -0.0000f, -0.2903f,
0.049039f, -0.000000f, -0.009755f, 0.790022f, 0.765721f, 0.9569f, -0.0000f, -0.2903f,
0.046194f, -0.000000f, -0.019134f, 0.797909f, 0.765721f, 0.9569f, -0.0000f, -0.2903f,
0.049039f, 1.000000f, -0.009755f, 0.790022f, 0.891905f, 0.9952f, -0.0000f, -0.0980f,
0.050000f, 0.000000f, -0.000000f, 0.782136f, 0.765721f, 0.9952f, -0.0000f, -0.0980f,
0.049039f, -0.000000f, -0.009755f, 0.790022f, 0.765721f, 0.9952f, -0.0000f, -0.0980f,
0.050000f, 1.000000f, -0.000000f, 0.782136f, 0.891905f, 0.9952f, -0.0000f, 0.0980f,
0.049039f, 0.000000f, 0.009755f, 0.774249f, 0.765721f, 0.9952f, -0.0000f, 0.0980f,
0.050000f, 0.000000f, -0.000000f, 0.782136f, 0.765721f, 0.9952f, -0.0000f, 0.0980f,
0.049039f, 1.000000f, 0.009754f, 0.774249f, 0.891905f, 0.9569f, -0.0000f, 0.2903f,
0.046194f, 0.000000f, 0.019134f, 0.766363f, 0.765721f, 0.9569f, -0.0000f, 0.2903f,
0.049039f, 0.000000f, 0.009755f, 0.774249f, 0.765721f, 0.9569f, -0.0000f, 0.2903f,
0.046194f, 1.000000f, 0.019134f, 0.766363f, 0.891905f, 0.8819f, -0.0000f, 0.4714f,
0.041573f, 0.000000f, 0.027779f, 0.758476f, 0.765721f, 0.8819f, -0.0000f, 0.4714f,
0.046194f, 0.000000f, 0.019134f, 0.766363f, 0.765721f, 0.8819f, -0.0000f, 0.4714f,
0.041573f, 1.000000f, 0.027778f, 0.758476f, 0.891905f, 0.7730f, -0.0000f, 0.6344f,
0.035355f, 0.000000f, 0.035355f, 0.750590f, 0.765721f, 0.7730f, -0.0000f, 0.6344f,
0.041573f, 0.000000f, 0.027779f, 0.758476f, 0.765721f, 0.7730f, -0.0000f, 0.6344f,
0.035355f, 1.000000f, 0.035355f, 0.750590f, 0.891905f, 0.6344f, -0.0000f, 0.7730f,
0.027778f, 0.000000f, 0.041573f, 0.742703f, 0.765721f, 0.6344f, -0.0000f, 0.7730f,
0.035355f, 0.000000f, 0.035355f, 0.750590f, 0.765721f, 0.6344f, -0.0000f, 0.7730f,
0.027778f, 1.000000f, 0.041573f, 0.742703f, 0.891905f, 0.4714f, -0.0000f, 0.8819f,
0.019134f, 0.000000f, 0.046194f, 0.734817f, 0.765721f, 0.4714f, -0.0000f, 0.8819f,
0.027778f, 0.000000f, 0.041573f, 0.742703f, 0.765721f, 0.4714f, -0.0000f, 0.8819f,
0.019134f, 1.000000f, 0.046194f, 0.734817f, 0.891905f, 0.2903f, -0.0000f, 0.9569f,
0.009754f, 0.000000f, 0.049039f, 0.726930f, 0.765721f, 0.2903f, -0.0000f, 0.9569f,
0.019134f, 0.000000f, 0.046194f, 0.734817f, 0.765721f, 0.2903f, -0.0000f, 0.9569f,
0.009754f, 1.000000f, 0.049039f, 0.726930f, 0.891905f, 0.0980f, -0.0000f, 0.9952f,
-0.000000f, 0.000000f, 0.050000f, 0.719044f, 0.765721f, 0.0980f, -0.0000f, 0.9952f,
0.009754f, 0.000000f, 0.049039f, 0.726930f, 0.765721f, 0.0980f, -0.0000f, 0.9952f,
-0.000000f, 1.000000f, 0.050000f, 0.719044f, 0.891905f, -0.0980f, -0.0000f, 0.9952f,
-0.009755f, 0.000000f, 0.049039f, 0.711158f, 0.765721f, -0.0980f, -0.0000f, 0.9952f,
-0.000000f, 0.000000f, 0.050000f, 0.719044f, 0.765721f, -0.0980f, -0.0000f, 0.9952f,
-0.009755f, 1.000000f, 0.049039f, 0.711158f, 0.891905f, -0.2903f, -0.0000f, 0.9569f,
-0.019134f, 0.000000f, 0.046194f, 0.703271f, 0.765721f, -0.2903f, -0.0000f, 0.9569f,
-0.009755f, 0.000000f, 0.049039f, 0.711158f, 0.765721f, -0.2903f, -0.0000f, 0.9569f,
-0.019134f, 1.000000f, 0.046194f, 0.703271f, 0.891905f, -0.4714f, -0.0000f, 0.8819f,
-0.027779f, 0.000000f, 0.041573f, 0.695385f, 0.765721f, -0.4714f, -0.0000f, 0.8819f,
-0.019134f, 0.000000f, 0.046194f, 0.703271f, 0.765721f, -0.4714f, -0.0000f, 0.8819f,
-0.027779f, 1.000000f, 0.041573f, 0.695385f, 0.891905f, -0.6344f, -0.0000f, 0.7730f,
-0.035355f, 0.000000f, 0.035355f, 0.687498f, 0.765721f, -0.6344f, -0.0000f, 0.7730f,
-0.027779f, 0.000000f, 0.041573f, 0.695385f, 0.765721f, -0.6344f, -0.0000f, 0.7730f,
-0.035355f, 1.000000f, 0.035355f, 0.687498f, 0.891905f, -0.7730f, -0.0000f, 0.6344f,
-0.041574f, 0.000000f, 0.027779f, 0.679612f, 0.765721f, -0.7730f, -0.0000f, 0.6344f,
-0.035355f, 0.000000f, 0.035355f, 0.687498f, 0.765721f, -0.7730f, -0.0000f, 0.6344f,
-0.041574f, 1.000000f, 0.027778f, 0.679612f, 0.891905f, -0.8819f, -0.0000f, 0.4714f,
-0.046194f, 0.000000f, 0.019134f, 0.671725f, 0.765721f, -0.8819f, -0.0000f, 0.4714f,
-0.041574f, 0.000000f, 0.027779f, 0.679612f, 0.765721f, -0.8819f, -0.0000f, 0.4714f,
0.046194f, 1.000000f, 0.019134f, 0.695866f, 0.646672f, -0.0000f, 1.0000f, -0.0000f,
0.019134f, 1.000000f, -0.046194f, 0.775002f, 0.679451f, -0.0000f, 1.0000f, -0.0000f,
-0.046194f, 1.000000f, -0.019134f, 0.742222f, 0.758587f, -0.0000f, 1.0000f, -0.0000f,
-0.046194f, 1.000000f, 0.019134f, 0.671725f, 0.891905f, -0.9569f, -0.0000f, 0.2903f,
-0.049039f, 0.000000f, 0.009755f, 0.663839f, 0.765721f, -0.9569f, -0.0000f, 0.2903f,
-0.046194f, 0.000000f, 0.019134f, 0.671725f, 0.765721f, -0.9569f, -0.0000f, 0.2903f,
-0.049039f, 1.000000f, 0.009754f, 0.663839f, 0.891905f, -0.9952f, -0.0000f, 0.0980f,
-0.050000f, 0.000000f, 0.000000f, 0.655952f, 0.765721f, -0.9952f, -0.0000f, 0.0980f,
-0.049039f, 0.000000f, 0.009755f, 0.663839f, 0.765721f, -0.9952f, -0.0000f, 0.0980f,
0.049039f, -0.000000f, -0.009755f, 0.857044f, 0.643225f, -0.0000f, -1.0000f, -0.0000f,
0.009754f, 0.000000f, 0.049039f, 0.785823f, 0.690813f, -0.0000f, -1.0000f, -0.0000f,
-0.049039f, 0.000000f, 0.009755f, 0.833411f, 0.762034f, -0.0000f, -1.0000f, -0.0000f,
1.000000f, 0.000000f, -1.000000f, 0.093750f, 0.093750f, -0.0000f, 1.0000f, -0.0000f,
0.009755f, 0.049039f, 0.000000f, 0.312010f, 0.919541f, 0.0980f, 0.9952f, -0.0000f,
0.019134f, 0.046194f, 0.000000f, 0.305217f, 0.919541f, 0.2903f, 0.9569f, -0.0000f,
0.027779f, 0.041573f, 0.000000f, 0.298423f, 0.919541f, 0.4714f, 0.8819f, -0.0000f,
0.035355f, 0.035355f, 0.000000f, 0.291630f, 0.919541f, 0.6344f, 0.7730f, -0.0000f,
0.041573f, 0.027778f, 0.000000f, 0.284837f, 0.919541f, 0.7730f, 0.6344f, -0.0000f,
0.046194f, 0.019134f, 0.000000f, 0.278044f, 0.919541f, 0.8819f, 0.4714f, -0.0000f,
0.049039f, 0.009754f, 0.000000f, 0.271251f, 0.919541f, 0.9569f, 0.2903f, -0.0000f,
0.050000f, -0.000000f, -0.000000f, 0.264458f, 0.919541f, 0.9952f, 0.0980f, -0.0000f,
0.049039f, -0.009755f, -0.000000f, 0.257665f, 0.919541f, 0.9952f, -0.0980f, -0.0000f,
0.046194f, -0.019134f, -0.000000f, 0.250872f, 0.919541f, 0.9569f, -0.2903f, -0.0000f,
0.041573f, -0.027779f, -0.000000f, 0.244079f, 0.919541f, 0.8819f, -0.4714f, -0.0000f,
0.035355f, -0.035355f, -0.000000f, 0.237286f, 0.919541f, 0.7730f, -0.6344f, -0.0000f,
0.027779f, -0.041574f, -0.000000f, 0.230493f, 0.919541f, 0.6344f, -0.7730f, -0.0000f,
0.019134f, -0.046194f, -0.000000f, 0.223699f, 0.919541f, 0.4714f, -0.8819f, -0.0000f,
0.009755f, -0.049039f, -0.000000f, 0.216906f, 0.919541f, 0.2903f, -0.9569f, -0.0000f,
0.000000f, -0.050000f, -0.000000f, 0.210113f, 0.919541f, 0.0980f, -0.9952f, -0.0000f,
0.000000f, -0.050000f, -0.000000f, 0.210113f, 0.919541f, -0.0980f, -0.9952f, -0.0000f,
-0.019134f, -0.046194f, -0.000000f, 0.196527f, 0.919541f, -0.2903f, -0.9569f, -0.0000f,
-0.027779f, -0.041574f, -0.000000f, 0.189734f, 0.919541f, -0.4714f, -0.8819f, -0.0000f,
-0.035355f, -0.035355f, -0.000000f, 0.182941f, 0.919541f, -0.6344f, -0.7730f, -0.0000f,
-0.041573f, -0.027779f, -0.000000f, 0.176148f, 0.919541f, -0.7730f, -0.6344f, -0.0000f,
-0.046194f, -0.019134f, -0.000000f, 0.169355f, 0.919541f, -0.8819f, -0.4714f, -0.0000f,
-0.049039f, -0.009755f, -0.000000f, 0.162562f, 0.919541f, -0.9569f, -0.2903f, -0.0000f,
-0.050000f, -0.000000f, -0.000000f, 0.155769f, 0.919541f, -0.9952f, -0.0980f, -0.0000f,
-0.049039f, 0.009754f, 0.000000f, 0.148975f, 0.919541f, -0.9952f, 0.0980f, -0.0000f,
-0.046194f, 0.019134f, 0.000000f, 0.142182f, 0.919541f, -0.9569f, 0.2903f, -0.0000f,
-0.041573f, 0.027778f, 0.000000f, 0.135389f, 0.919541f, -0.8819f, 0.4714f, -0.0000f,
-0.035355f, 0.035355f, 0.000000f, 0.128596f, 0.919541f, -0.7730f, 0.6344f, -0.0000f,
-0.027779f, 0.041573f, 0.000000f, 0.121803f, 0.919541f, -0.6344f, 0.7730f, -0.0000f,
-0.019134f, 0.046194f, 0.000000f, 0.115010f, 0.919541f, -0.4714f, 0.8819f, -0.0000f,
0.009755f, 0.049039f, 0.000000f, 0.165947f, 0.807676f, -0.0000f, -0.0000f, 1.0000f,
0.000000f, 0.050000f, 0.000000f, 0.155769f, 0.808678f, -0.0000f, -0.0000f, 1.0000f,
-0.009755f, 0.049039f, 0.000000f, 0.145591f, 0.807676f, -0.0000f, -0.0000f, 1.0000f,
-0.019134f, 0.046194f, 0.000000f, 0.135804f, 0.804707f, -0.0000f, -0.0000f, 1.0000f,
-0.027779f, 0.041573f, 0.000000f, 0.126784f, 0.799886f, -0.0000f, -0.0000f, 1.0000f,
-0.035355f, 0.035355f, 0.000000f, 0.118878f, 0.793398f, -0.0000f, -0.0000f, 1.0000f,
-0.041573f, 0.027778f, 0.000000f, 0.112390f, 0.785492f, -0.0000f, -0.0000f, 1.0000f,
-0.046194f, 0.019134f, 0.000000f, 0.107569f, 0.776472f, -0.0000f, -0.0000f, 1.0000f,
-0.049039f, 0.009754f, 0.000000f, 0.104600f, 0.766685f, -0.0000f, -0.0000f, 1.0000f,
-0.050000f, -0.000000f, -0.000000f, 0.103598f, 0.756507f, -0.0000f, -0.0000f, 1.0000f,
-0.049039f, -0.009755f, -0.000000f, 0.104600f, 0.746329f, -0.0000f, -0.0000f, 1.0000f,
-0.046194f, -0.019134f, -0.000000f, 0.107569f, 0.736542f, -0.0000f, -0.0000f, 1.0000f,
-0.041573f, -0.027779f, -0.000000f, 0.112390f, 0.727523f, -0.0000f, -0.0000f, 1.0000f,
-0.035355f, -0.035355f, -0.000000f, 0.118878f, 0.719617f, -0.0000f, -0.0000f, 1.0000f,
-0.027779f, -0.041574f, -0.000000f, 0.126784f, 0.713129f, -0.0000f, -0.0000f, 1.0000f,
-0.009755f, -0.049039f, -0.000000f, 0.145591f, 0.705339f, -0.0000f, -0.0000f, 1.0000f,
0.000000f, -0.050000f, -0.000000f, 0.155769f, 0.704336f, -0.0000f, -0.0000f, 1.0000f,
0.009755f, -0.049039f, -0.000000f, 0.165947f, 0.705339f, -0.0000f, -0.0000f, 1.0000f,
0.019134f, -0.046194f, -0.000000f, 0.175734f, 0.708308f, -0.0000f, -0.0000f, 1.0000f,
0.027779f, -0.041574f, -0.000000f, 0.184753f, 0.713129f, -0.0000f, -0.0000f, 1.0000f,
0.035355f, -0.035355f, -0.000000f, 0.192659f, 0.719617f, -0.0000f, -0.0000f, 1.0000f,
0.041573f, -0.027779f, -0.000000f, 0.199147f, 0.727523f, -0.0000f, -0.0000f, 1.0000f,
0.049039f, -0.009755f, -0.000000f, 0.206937f, 0.746329f, -0.0000f, -0.0000f, 1.0000f,
0.050000f, -0.000000f, -0.000000f, 0.207940f, 0.756507f, -0.0000f, -0.0000f, 1.0000f,
0.049039f, 0.009754f, 0.000000f, 0.206937f, 0.766685f, -0.0000f, -0.0000f, 1.0000f,
0.046194f, 0.019134f, 0.000000f, 0.203968f, 0.776472f, -0.0000f, -0.0000f, 1.0000f,
0.041573f, 0.027778f, 0.000000f, 0.199147f, 0.785492f, -0.0000f, -0.0000f, 1.0000f,
0.035355f, 0.035355f, 0.000000f, 0.192659f, 0.793398f, -0.0000f, -0.0000f, 1.0000f,
0.027779f, 0.041573f, 0.000000f, 0.184753f, 0.799886f, -0.0000f, -0.0000f, 1.0000f,
-0.009755f, 0.049039f, 0.000000f, 0.108217f, 0.919541f, -0.2903f, 0.9569f, -0.0000f,
-0.009755f, 0.049039f, 0.000000f, 0.108217f, 0.919541f, -0.0980f, 0.9952f, -0.0000f,
0.000000f, 0.050000f, -1.000000f, 0.264458f, 0.808678f, -0.0000f, -0.0000f, -1.0000f,
0.009755f, 0.049039f, -1.000000f, 0.274636f, 0.807676f, -0.0000f, -0.0000f, -1.0000f,
0.019134f, 0.046194f, -1.000000f, 0.284423f, 0.804707f, -0.0000f, -0.0000f, -1.0000f,
0.027779f, 0.041574f, -1.000000f, 0.293443f, 0.799886f, -0.0000f, -0.0000f, -1.0000f,
0.035355f, 0.035355f, -1.000000f, 0.301348f, 0.793398f, -0.0000f, -0.0000f, -1.0000f,
0.041573f, 0.027779f, -1.000000f, 0.307837f, 0.785492f, -0.0000f, -0.0000f, -1.0000f,
0.046194f, 0.019134f, -1.000000f, 0.312658f, 0.776472f, -0.0000f, -0.0000f, -1.0000f,
0.049039f, 0.009755f, -1.000000f, 0.315627f, 0.766685f, -0.0000f, -0.0000f, -1.0000f,
0.050000f, 0.000000f, -1.000000f, 0.316629f, 0.756507f, -0.0000f, -0.0000f, -1.0000f,
0.049039f, -0.009754f, -1.000000f, 0.315627f, 0.746329f, -0.0000f, -0.0000f, -1.0000f,
0.046194f, -0.019134f, -1.000000f, 0.312658f, 0.736542f, -0.0000f, -0.0000f, -1.0000f,
0.041573f, -0.027778f, -1.000000f, 0.307837f, 0.727523f, -0.0000f, -0.0000f, -1.0000f,
0.035355f, -0.035355f, -1.000000f, 0.301348f, 0.719617f, -0.0000f, -0.0000f, -1.0000f,
0.027779f, -0.041573f, -1.000000f, 0.293443f, 0.713129f, -0.0000f, -0.0000f, -1.0000f,
0.019134f, -0.046194f, -1.000000f, 0.284423f, 0.708308f, -0.0000f, -0.0000f, -1.0000f,
0.000000f, -0.050000f, -1.000000f, 0.264458f, 0.704336f, -0.0000f, -0.0000f, -1.0000f,
-0.009755f, -0.049039f, -1.000000f, 0.254280f, 0.705339f, -0.0000f, -0.0000f, -1.0000f,
-0.019134f, -0.046194f, -1.000000f, 0.244493f, 0.708308f, -0.0000f, -0.0000f, -1.0000f,
-0.027779f, -0.041573f, -1.000000f, 0.235473f, 0.713129f, -0.0000f, -0.0000f, -1.0000f,
-0.035355f, -0.035355f, -1.000000f, 0.227568f, 0.719617f, -0.0000f, -0.0000f, -1.0000f,
-0.041573f, -0.027778f, -1.000000f, 0.221079f, 0.727523f, -0.0000f, -0.0000f, -1.0000f,
-0.046194f, -0.019134f, -1.000000f, 0.216258f, 0.736542f, -0.0000f, -0.0000f, -1.0000f,
-0.050000f, 0.000000f, -1.000000f, 0.212287f, 0.756507f, -0.0000f, -0.0000f, -1.0000f,
-0.049039f, 0.009755f, -1.000000f, 0.213289f, 0.766685f, -0.0000f, -0.0000f, -1.0000f,
-0.046194f, 0.019134f, -1.000000f, 0.216258f, 0.776472f, -0.0000f, -0.0000f, -1.0000f,
-0.041573f, 0.027779f, -1.000000f, 0.221079f, 0.785492f, -0.0000f, -0.0000f, -1.0000f,
-0.035355f, 0.035355f, -1.000000f, 0.227568f, 0.793398f, -0.0000f, -0.0000f, -1.0000f,
-0.027779f, 0.041574f, -1.000000f, 0.235473f, 0.799886f, -0.0000f, -0.0000f, -1.0000f,
-0.019134f, 0.046194f, -1.000000f, 0.244493f, 0.804707f, -0.0000f, -0.0000f, -1.0000f,
1.000000f, 0.049039f, -0.009755f, 0.852554f, 0.280261f, -0.0000f, 0.9952f, -0.0980f,
1.000000f, 0.046194f, -0.019134f, 0.847756f, 0.280261f, -0.0000f, 0.9569f, -0.2903f,
1.000000f, 0.041573f, -0.027779f, 0.842958f, 0.280261f, -0.0000f, 0.8819f, -0.4714f,
1.000000f, 0.035355f, -0.035355f, 0.838161f, 0.280261f, -0.0000f, 0.7730f, -0.6344f,
1.000000f, 0.027778f, -0.041574f, 0.833363f, 0.280261f, -0.0000f, 0.6344f, -0.7730f,
1.000000f, 0.019134f, -0.046194f, 0.828565f, 0.280261f, -0.0000f, 0.4714f, -0.8819f,
1.000000f, 0.009754f, -0.049039f, 0.823767f, 0.280261f, -0.0000f, 0.2903f, -0.9569f,
1.000000f, -0.000000f, -0.050000f, 0.818969f, 0.280261f, -0.0000f, 0.0980f, -0.9952f,
1.000000f, -0.009755f, -0.049039f, 0.814171f, 0.280261f, -0.0000f, -0.0980f, -0.9952f,
1.000000f, -0.019134f, -0.046194f, 0.809373f, 0.280261f, -0.0000f, -0.2903f, -0.9569f,
1.000000f, -0.027779f, -0.041574f, 0.804575f, 0.280261f, -0.0000f, -0.4714f, -0.8819f,
1.000000f, -0.035355f, -0.035355f, 0.799777f, 0.280261f, -0.0000f, -0.6344f, -0.7730f,
1.000000f, -0.041574f, -0.027779f, 0.794979f, 0.280261f, -0.0000f, -0.7730f, -0.6344f,
1.000000f, -0.046194f, -0.019134f, 0.790181f, 0.280261f, -0.0000f, -0.8819f, -0.4714f,
1.000000f, -0.049039f, -0.009755f, 0.785383f, 0.280261f, -0.0000f, -0.9569f, -0.2903f,
1.000000f, -0.050000f, -0.000000f, 0.780586f, 0.280261f, -0.0000f, -0.9952f, -0.0980f,
1.000000f, -0.050000f, -0.000000f, 0.780586f, 0.280261f, -0.0000f, -0.9952f, 0.0980f,
1.000000f, -0.046194f, 0.019134f, 0.770990f, 0.280261f, -0.0000f, -0.9569f, 0.2903f,
1.000000f, -0.041574f, 0.027778f, 0.766192f, 0.280261f, -0.0000f, -0.8819f, 0.4714f,
1.000000f, -0.035355f, 0.035355f, 0.761394f, 0.280261f, -0.0000f, -0.7730f, 0.6344f,
1.000000f, -0.027779f, 0.041573f, 0.756596f, 0.280261f, -0.0000f, -0.6344f, 0.7730f,
1.000000f, -0.019134f, 0.046194f, 0.751798f, 0.280261f, -0.0000f, -0.4714f, 0.8819f,
1.000000f, -0.009755f, 0.049039f, 0.747000f, 0.280261f, -0.0000f, -0.2903f, 0.9569f,
1.000000f, -0.000000f, 0.050000f, 0.742202f, 0.280261f, -0.0000f, -0.0980f, 0.9952f,
1.000000f, 0.009754f, 0.049039f, 0.737404f, 0.280261f, -0.0000f, 0.0980f, 0.9952f,
1.000000f, 0.019134f, 0.046194f, 0.732606f, 0.280261f, -0.0000f, 0.2903f, 0.9569f,
1.000000f, 0.027778f, 0.041573f, 0.727808f, 0.280261f, -0.0000f, 0.4714f, 0.8819f,
1.000000f, 0.035355f, 0.035355f, 0.723011f, 0.280261f, -0.0000f, 0.6344f, 0.7730f,
1.000000f, 0.041573f, 0.027778f, 0.718213f, 0.280261f, -0.0000f, 0.7730f, 0.6344f,
1.000000f, 0.046194f, 0.019134f, 0.713415f, 0.280261f, -0.0000f, 0.8819f, 0.4714f,
1.000000f, 0.049039f, -0.009755f, 0.749391f, 0.201251f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.050000f, -0.000000f, 0.742202f, 0.201959f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.049039f, 0.009754f, 0.735013f, 0.201251f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.046194f, 0.019134f, 0.728101f, 0.199154f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.041573f, 0.027778f, 0.721731f, 0.195749f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.035355f, 0.035355f, 0.716147f, 0.191166f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.027778f, 0.041573f, 0.711564f, 0.185583f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.019134f, 0.046194f, 0.708159f, 0.179212f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.019134f, 0.046194f, 0.708159f, 0.179212f, 1.0000f, -0.0000f, 0.0001f,
1.000000f, 0.009754f, 0.049039f, 0.706062f, 0.172300f, 1.0000f, -0.0000f, 0.0001f,
1.000000f, -0.000000f, 0.050000f, 0.705354f, 0.165111f, 1.0000f, -0.0000f, 0.0001f,
1.000000f, -0.000000f, 0.050000f, 0.705354f, 0.165111f, 1.0000f, -0.0000f, -0.0001f,
1.000000f, -0.009755f, 0.049039f, 0.706062f, 0.157922f, 1.0000f, -0.0000f, -0.0001f,
1.000000f, -0.019134f, 0.046194f, 0.708159f, 0.151010f, 1.0000f, -0.0000f, -0.0001f,
1.000000f, -0.019134f, 0.046194f, 0.708159f, 0.151010f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.027779f, 0.041573f, 0.711564f, 0.144639f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.035355f, 0.035355f, 0.716147f, 0.139055f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.041574f, 0.027778f, 0.721731f, 0.134473f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.049039f, 0.009754f, 0.735013f, 0.128971f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.050000f, -0.000000f, 0.742202f, 0.128263f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.049039f, -0.009755f, 0.749391f, 0.128971f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.046194f, -0.019134f, 0.756303f, 0.131068f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.041574f, -0.027779f, 0.762674f, 0.134473f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.035355f, -0.035355f, 0.768258f, 0.139055f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.027779f, -0.041574f, 0.772840f, 0.144639f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.019134f, -0.046194f, 0.776245f, 0.151010f, 1.0000f, -0.0000f, 0.0001f,
1.000000f, -0.009755f, -0.049039f, 0.778342f, 0.157922f, 1.0000f, -0.0000f, 0.0001f,
1.000000f, -0.000000f, -0.050000f, 0.779050f, 0.165111f, 1.0000f, -0.0000f, 0.0001f,
1.000000f, -0.000000f, -0.050000f, 0.779050f, 0.165111f, 1.0000f, -0.0000f, -0.0001f,
1.000000f, 0.009754f, -0.049039f, 0.778342f, 0.172300f, 1.0000f, -0.0000f, -0.0001f,
1.000000f, 0.019134f, -0.046194f, 0.776245f, 0.179212f, 1.0000f, -0.0000f, -0.0001f,
1.000000f, 0.019134f, -0.046194f, 0.776245f, 0.179212f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.027778f, -0.041574f, 0.772840f, 0.185583f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.035355f, -0.035355f, 0.768258f, 0.191166f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.041573f, -0.027779f, 0.762674f, 0.195749f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.000000f, 0.050000f, 0.705354f, 0.165111f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, -0.000000f, -0.050000f, 0.779050f, 0.165111f, 1.0000f, -0.0000f, -0.0000f,
1.000000f, 0.049039f, 0.009754f, 0.708617f, 0.280261f, -0.0000f, 0.9569f, 0.2903f,
1.000000f, 0.049039f, 0.009754f, 0.708617f, 0.280261f, -0.0000f, 0.9952f, 0.0980f,
0.000000f, 0.050000f, -0.000000f, 0.818969f, 0.201959f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.049039f, -0.009755f, 0.826158f, 0.201251f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.046194f, -0.019134f, 0.833070f, 0.199154f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.041574f, -0.027779f, 0.839441f, 0.195749f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.035355f, -0.035355f, 0.845024f, 0.191166f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, 0.027779f, -0.041573f, 0.849607f, 0.185583f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, 0.019134f, -0.046194f, 0.853012f, 0.179212f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, 0.009755f, -0.049039f, 0.855109f, 0.172300f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, 0.000000f, -0.050000f, 0.855817f, 0.165111f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, -0.009754f, -0.049039f, 0.855109f, 0.157922f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, -0.019134f, -0.046194f, 0.853012f, 0.151010f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, -0.027778f, -0.041573f, 0.849607f, 0.144639f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, -0.035355f, -0.035355f, 0.845024f, 0.139055f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, -0.041573f, -0.027779f, 0.839441f, 0.134473f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, -0.046194f, -0.019134f, 0.833070f, 0.131068f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, -0.050000f, 0.000000f, 0.818969f, 0.128263f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, -0.049039f, 0.009755f, 0.811780f, 0.128971f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, -0.046194f, 0.019134f, 0.804868f, 0.131068f, -1.0000f, -0.0000f, -0.0000f,
-0.000000f, -0.041573f, 0.027779f, 0.798497f, 0.134473f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, -0.035355f, 0.035355f, 0.792913f, 0.139055f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, -0.027778f, 0.041573f, 0.788331f, 0.144639f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, -0.019134f, 0.046194f, 0.784926f, 0.151010f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.000000f, 0.050000f, 0.782121f, 0.165111f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.009755f, 0.049039f, 0.782829f, 0.172300f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.019134f, 0.046194f, 0.784926f, 0.179212f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.027779f, 0.041573f, 0.788331f, 0.185583f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.035355f, 0.035355f, 0.792913f, 0.191166f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.041574f, 0.027779f, 0.798497f, 0.195749f, -1.0000f, -0.0000f, -0.0000f,
0.000000f, 0.046194f, 0.019134f, 0.804868f, 0.199154f, -1.0000f, -0.0000f, -0.0000f,
-0.050000f, 1.000000f, -0.000000f, 0.908319f, 0.891905f, -0.9952f, -0.0000f, -0.0980f,
-0.046194f, 1.000000f, -0.019134f, 0.892546f, 0.891905f, -0.9569f, -0.0000f, -0.2903f,
-0.041574f, 1.000000f, -0.027779f, 0.884660f, 0.891905f, -0.8819f, -0.0000f, -0.4714f,
-0.035355f, 1.000000f, -0.035355f, 0.876773f, 0.891905f, -0.7730f, -0.0000f, -0.6344f,
-0.027779f, 1.000000f, -0.041574f, 0.868887f, 0.891905f, -0.6344f, -0.0000f, -0.7730f,
-0.019134f, 1.000000f, -0.046194f, 0.861000f, 0.891905f, -0.4714f, -0.0000f, -0.8819f,
-0.009755f, 1.000000f, -0.049039f, 0.853114f, 0.891905f, -0.2903f, -0.0000f, -0.9569f,
-0.000000f, 1.000000f, -0.050000f, 0.845227f, 0.891905f, -0.0980f, -0.0000f, -0.9952f,
0.009754f, 1.000000f, -0.049039f, 0.837341f, 0.891905f, 0.0980f, -0.0000f, -0.9952f,
0.019134f, 1.000000f, -0.046194f, 0.829455f, 0.891905f, 0.2903f, -0.0000f, -0.9569f,
0.027778f, 1.000000f, -0.041574f, 0.821568f, 0.891905f, 0.4714f, -0.0000f, -0.8819f,
0.035355f, 1.000000f, -0.035355f, 0.813682f, 0.891905f, 0.6344f, -0.0000f, -0.7730f,
0.041573f, 1.000000f, -0.027779f, 0.805795f, 0.891905f, 0.7730f, -0.0000f, -0.6344f,
0.046194f, 1.000000f, -0.019134f, 0.797909f, 0.891905f, 0.8819f, -0.0000f, -0.4714f,
0.049039f, 1.000000f, -0.009755f, 0.790022f, 0.891905f, 0.9569f, -0.0000f, -0.2903f,
0.050000f, 1.000000f, -0.000000f, 0.782136f, 0.891905f, 0.9952f, -0.0000f, -0.0980f,
0.049039f, 1.000000f, 0.009754f, 0.774249f, 0.891905f, 0.9952f, -0.0000f, 0.0980f,
0.046194f, 1.000000f, 0.019134f, 0.766363f, 0.891905f, 0.9569f, -0.0000f, 0.2903f,
0.041573f, 1.000000f, 0.027778f, 0.758476f, 0.891905f, 0.8819f, -0.0000f, 0.4714f,
0.035355f, 1.000000f, 0.035355f, 0.750590f, 0.891905f, 0.7730f, -0.0000f, 0.6344f,
0.027778f, 1.000000f, 0.041573f, 0.742703f, 0.891905f, 0.6344f, -0.0000f, 0.7730f,
0.019134f, 1.000000f, 0.046194f, 0.734817f, 0.891905f, 0.4714f, -0.0000f, 0.8819f,
0.009754f, 1.000000f, 0.049039f, 0.726930f, 0.891905f, 0.2903f, -0.0000f, 0.9569f,
-0.000000f, 1.000000f, 0.050000f, 0.719044f, 0.891905f, 0.0980f, -0.0000f, 0.9952f,
-0.009755f, 1.000000f, 0.049039f, 0.711158f, 0.891905f, -0.0980f, -0.0000f, 0.9952f,
-0.019134f, 1.000000f, 0.046194f, 0.703271f, 0.891905f, -0.2903f, -0.0000f, 0.9569f,
-0.027779f, 1.000000f, 0.041573f, 0.695385f, 0.891905f, -0.4714f, -0.0000f, 0.8819f,
-0.035355f, 1.000000f, 0.035355f, 0.687498f, 0.891905f, -0.6344f, -0.0000f, 0.7730f,
-0.041574f, 1.000000f, 0.027778f, 0.679612f, 0.891905f, -0.7730f, -0.0000f, 0.6344f,
-0.046194f, 1.000000f, 0.019134f, 0.671725f, 0.891905f, -0.8819f, -0.0000f, 0.4714f,
-0.046194f, 1.000000f, -0.019134f, 0.742222f, 0.758587f, -0.0001f, 1.0000f, -0.0000f,
-0.049039f, 1.000000f, -0.009755f, 0.730860f, 0.762034f, -0.0001f, 1.0000f, -0.0000f,
-0.050000f, 1.000000f, -0.000000f, 0.719044f, 0.763198f, -0.0001f, 1.0000f, -0.0000f,
-0.050000f, 1.000000f, -0.000000f, 0.719044f, 0.763198f, 0.0001f, 1.0000f, -0.0000f,
-0.049039f, 1.000000f, 0.009754f, 0.707228f, 0.762034f, 0.0001f, 1.0000f, -0.0000f,
-0.046194f, 1.000000f, 0.019134f, 0.695866f, 0.758587f, 0.0001f, 1.0000f, -0.0000f,
-0.046194f, 1.000000f, 0.019134f, 0.695866f, 0.758587f, -0.0000f, 1.0000f, -0.0000f,
-0.041574f, 1.000000f, 0.027778f, 0.685394f, 0.752990f, -0.0000f, 1.0000f, -0.0000f,
-0.035355f, 1.000000f, 0.035355f, 0.676216f, 0.745458f, -0.0000f, 1.0000f, -0.0000f,
-0.027779f, 1.000000f, 0.041573f, 0.668683f, 0.736279f, -0.0000f, 1.0000f, -0.0000f,
-0.019134f, 1.000000f, 0.046194f, 0.663086f, 0.725808f, -0.0000f, 1.0000f, -0.0000f,
-0.009755f, 1.000000f, 0.049039f, 0.659640f, 0.714446f, -0.0000f, 1.0000f, -0.0000f,
-0.000000f, 1.000000f, 0.050000f, 0.658476f, 0.702630f, -0.0000f, 1.0000f, -0.0000f,
0.009754f, 1.000000f, 0.049039f, 0.659640f, 0.690813f, -0.0000f, 1.0000f, -0.0000f,
0.019134f, 1.000000f, 0.046194f, 0.663086f, 0.679451f, -0.0000f, 1.0000f, -0.0000f,
0.027778f, 1.000000f, 0.041573f, 0.668683f, 0.668980f, -0.0000f, 1.0000f, -0.0000f,
0.035355f, 1.000000f, 0.035355f, 0.676216f, 0.659801f, -0.0000f, 1.0000f, -0.0000f,
0.041573f, 1.000000f, 0.027778f, 0.685394f, 0.652269f, -0.0000f, 1.0000f, -0.0000f,
0.046194f, 1.000000f, 0.019134f, 0.695866f, 0.646672f, 0.0001f, 1.0000f, -0.0000f,
0.049039f, 1.000000f, 0.009754f, 0.707228f, 0.643225f, 0.0001f, 1.0000f, -0.0000f,
0.050000f, 1.000000f, -0.000000f, 0.719044f, 0.642061f, 0.0001f, 1.0000f, -0.0000f,
0.050000f, 1.000000f, -0.000000f, 0.719044f, 0.642061f, -0.0001f, 1.0000f, -0.0000f,
0.049039f, 1.000000f, -0.009755f, 0.730860f, 0.643225f, -0.0001f, 1.0000f, -0.0000f,
0.046194f, 1.000000f, -0.019134f, 0.742222f, 0.646672f, -0.0001f, 1.0000f, -0.0000f,
0.046194f, 1.000000f, -0.019134f, 0.742222f, 0.646672f, -0.0000f, 1.0000f, -0.0000f,
0.041573f, 1.000000f, -0.027779f, 0.752694f, 0.652269f, -0.0000f, 1.0000f, -0.0000f,
0.035355f, 1.000000f, -0.035355f, 0.761872f, 0.659801f, -0.0000f, 1.0000f, -0.0000f,
0.027778f, 1.000000f, -0.041574f, 0.769405f, 0.668980f, -0.0000f, 1.0000f, -0.0000f,
0.009754f, 1.000000f, -0.049039f, 0.778448f, 0.690813f, -0.0000f, 1.0000f, -0.0000f,
-0.000000f, 1.000000f, -0.050000f, 0.779612f, 0.702630f, -0.0000f, 1.0000f, -0.0000f,
-0.009755f, 1.000000f, -0.049039f, 0.778448f, 0.714446f, -0.0000f, 1.0000f, -0.0000f,
-0.019134f, 1.000000f, -0.046194f, 0.775002f, 0.725808f, -0.0000f, 1.0000f, -0.0000f,
-0.027779f, 1.000000f, -0.041574f, 0.769405f, 0.736279f, -0.0000f, 1.0000f, -0.0000f,
-0.035355f, 1.000000f, -0.035355f, 0.761872f, 0.745458f, -0.0000f, 1.0000f, -0.0000f,
-0.041574f, 1.000000f, -0.027779f, 0.752694f, 0.752990f, -0.0000f, 1.0000f, -0.0000f,
-0.050000f, 1.000000f, -0.000000f, 0.719044f, 0.763198f, -0.0000f, 1.0000f, -0.0000f,
0.050000f, 1.000000f, -0.000000f, 0.719044f, 0.642061f, -0.0000f, 1.0000f, -0.0000f,
-0.049039f, 1.000000f, 0.009754f, 0.663839f, 0.891905f, -0.9569f, -0.0000f, 0.2903f,
-0.050000f, 1.000000f, -0.000000f, 0.655952f, 0.891905f, -0.9952f, -0.0000f, 0.0980f,
-0.050000f, 0.000000f, 0.000000f, 0.845227f, 0.763198f, -0.0000f, -1.0000f, -0.0000f,
-0.049039f, -0.000000f, -0.009755f, 0.857044f, 0.762034f, -0.0000f, -1.0000f, -0.0000f,
-0.046194f, -0.000000f, -0.019134f, 0.868406f, 0.758587f, -0.0000f, -1.0000f, -0.0000f,
-0.041574f, -0.000000f, -0.027779f, 0.878877f, 0.752990f, -0.0000f, -1.0000f, -0.0000f,
-0.035355f, -0.000000f, -0.035355f, 0.888056f, 0.745458f, -0.0000f, -1.0000f, -0.0000f,
-0.027779f, -0.000000f, -0.041573f, 0.895588f, 0.736279f, -0.0000f, -1.0000f, -0.0000f,
-0.019134f, -0.000000f, -0.046194f, 0.901185f, 0.725808f, -0.0000f, -1.0000f, -0.0000f,
-0.009755f, -0.000000f, -0.049039f, 0.904632f, 0.714446f, -0.0000f, -1.0000f, -0.0000f,
-0.000000f, -0.000000f, -0.050000f, 0.905796f, 0.702630f, -0.0000f, -1.0000f, -0.0000f,
0.009754f, -0.000000f, -0.049039f, 0.904632f, 0.690813f, -0.0000f, -1.0000f, -0.0000f,
0.019134f, -0.000000f, -0.046194f, 0.901185f, 0.679451f, -0.0000f, -1.0000f, -0.0000f,
0.027778f, -0.000000f, -0.041573f, 0.895588f, 0.668980f, -0.0000f, -1.0000f, -0.0000f,
0.035355f, -0.000000f, -0.035355f, 0.888056f, 0.659801f, -0.0000f, -1.0000f, -0.0000f,
0.041573f, -0.000000f, -0.027779f, 0.878877f, 0.652269f, -0.0000f, -1.0000f, -0.0000f,
0.046194f, -0.000000f, -0.019134f, 0.868406f, 0.646672f, -0.0000f, -1.0000f, -0.0000f,
0.050000f, 0.000000f, -0.000000f, 0.845227f, 0.642061f, -0.0000f, -1.0000f, -0.0000f,
0.049039f, 0.000000f, 0.009755f, 0.833411f, 0.643225f, -0.0000f, -1.0000f, -0.0000f,
0.046194f, 0.000000f, 0.019134f, 0.822049f, 0.646672f, -0.0000f, -1.0000f, -0.0000f,
0.041573f, 0.000000f, 0.027779f, 0.811578f, 0.652269f, -0.0000f, -1.0000f, -0.0000f,
0.035355f, 0.000000f, 0.035355f, 0.802399f, 0.659801f, -0.0000f, -1.0000f, -0.0000f,
0.027778f, 0.000000f, 0.041573f, 0.794867f, 0.668980f, -0.0000f, -1.0000f, -0.0000f,
0.019134f, 0.000000f, 0.046194f, 0.789270f, 0.679451f, -0.0000f, -1.0000f, -0.0000f,
-0.000000f, 0.000000f, 0.050000f, 0.784659f, 0.702630f, -0.0000f, -1.0000f, -0.0000f,
-0.009755f, 0.000000f, 0.049039f, 0.785823f, 0.714446f, -0.0000f, -1.0000f, -0.0000f,
-0.019134f, 0.000000f, 0.046194f, 0.789270f, 0.725808f, -0.0000f, -1.0000f, -0.0000f,
-0.027779f, 0.000000f, 0.041573f, 0.794867f, 0.736279f, -0.0000f, -1.0000f, -0.0000f,
-0.035355f, 0.000000f, 0.035355f, 0.802399f, 0.745458f, -0.0000f, -1.0000f, -0.0000f,
-0.041574f, 0.000000f, 0.027779f, 0.811578f, 0.752990f, -0.0000f, -1.0000f, -0.0000f,
-0.046194f, 0.000000f, 0.019134f, 0.822049f, 0.758587f, -0.0000f, -1.0000f, -0.0000f,
};
const int test_scene_vertices_length = (sizeof (test_scene_vertices)) / (sizeof (test_scene_vertices[0]));

View File

@ -0,0 +1,18 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_model_test_scene_color_data_start __asm("_binary_model_test_scene_color_data_start");
extern uint32_t _binary_model_test_scene_color_data_end __asm("_binary_model_test_scene_color_data_end");
#define model_test_scene_color_data_start ((const char *)&_binary_model_test_scene_color_data_start)
#define model_test_scene_color_data_end ((const char *)&_binary_model_test_scene_color_data_end)
#define model_test_scene_color_data_size (model_test_scene_color_data_end - model_test_scene_color_data_start)
#ifdef __cplusplus
}
#endif

19
include/render.h Normal file
View File

@ -0,0 +1,19 @@
#pragma once
#include "state.h"
#ifdef __cplusplus
extern "C" {
#endif
void render(const struct state * state,
unsigned int program,
unsigned int program__trans,
unsigned int program__texture0,
unsigned int color,
unsigned int vertex_array,
int triangles_length);
#ifdef __cplusplus
}
#endif

19
include/shader.h Normal file
View File

@ -0,0 +1,19 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
unsigned int compile_shader(const char * name,
const void * vs,
const int vs_length,
const void * fs,
const int fs_length);
static const int shader_attrib_position = 0;
static const int shader_attrib_texture = 1;
static const int shader_attrib_normal = 2;
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,18 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_src_shader_scene_fs_glsl_start __asm("_binary_src_shader_scene_fs_glsl_start");
extern uint32_t _binary_src_shader_scene_fs_glsl_end __asm("_binary_src_shader_scene_fs_glsl_end");
#define src_shader_scene_fs_glsl_start ((const char *)&_binary_src_shader_scene_fs_glsl_start)
#define src_shader_scene_fs_glsl_end ((const char *)&_binary_src_shader_scene_fs_glsl_end)
#define src_shader_scene_fs_glsl_size ((uintptr_t)src_shader_scene_fs_glsl_end - (uintptr_t)src_shader_scene_fs_glsl_start)
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,18 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_src_shader_scene_vs_glsl_start __asm("_binary_src_shader_scene_vs_glsl_start");
extern uint32_t _binary_src_shader_scene_vs_glsl_end __asm("_binary_src_shader_scene_vs_glsl_end");
#define src_shader_scene_vs_glsl_start ((const char *)&_binary_src_shader_scene_vs_glsl_start)
#define src_shader_scene_vs_glsl_end ((const char *)&_binary_src_shader_scene_vs_glsl_end)
#define src_shader_scene_vs_glsl_size ((uintptr_t)src_shader_scene_vs_glsl_end - (uintptr_t)src_shader_scene_vs_glsl_start)
#ifdef __cplusplus
}
#endif

18
include/state.h Normal file
View File

@ -0,0 +1,18 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
struct state {
float rx;
float ry;
float rz;
float tx;
float ty;
float tz;
};
#ifdef __cplusplus
}
#endif

BIN
model/test_scene.blend Normal file

Binary file not shown.

1076
model/test_scene.obj Normal file

File diff suppressed because it is too large Load Diff

BIN
model/test_scene_color.data Normal file

Binary file not shown.

BIN
model/test_scene_color.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

22
src/depth_decode.py Normal file
View File

@ -0,0 +1,22 @@
import sys
import struct
with open(sys.argv[1], 'rb') as f:
buf = memoryview(f.read())
print("P2")
print("800 600")
print("65535")
for i in range(len(buf) // 4):
b = buf[i*4:i*4+4]
v, = struct.unpack("<f", b)
assert v >= 0.0 and v <= 1.0
depth16 = v * 65535
print(depth16, end='')
if i % 128 == 127:
print("", end='\n')
else:
print("", end=" ")

1512
src/gl.c Normal file

File diff suppressed because it is too large Load Diff

41
src/make.c Normal file
View File

@ -0,0 +1,41 @@
#include "glad/gl.h"
#include "make.h"
unsigned int make_buffer(unsigned int target,
const void * data,
size_t size)
{
unsigned int buffer;
glGenBuffers(1, &buffer);
glBindBuffer(target, buffer);
glBufferData(target, size, data, GL_STATIC_DRAW);
glBindBuffer(target, 0);
return buffer;
}
unsigned int make_texture(const void * data,
int internalformat,
int width,
int height,
int format,
int type)
{
unsigned int texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
float color[3] = {0.0, 0.0, 0.0};
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, color);
glTexImage2D(GL_TEXTURE_2D, 0, internalformat, width, height, 0, format, type, data);
glBindTexture(GL_TEXTURE_2D, 0);
return texture;
}

48
src/render.cpp Normal file
View File

@ -0,0 +1,48 @@
#include <math.h>
#include <stdio.h>
#include "glad/gl.h"
#include "render.h"
#include "math/float_types.hpp"
#include "math/transform.hpp"
mat4x4 perspective()
{
mat4x4 m1 = mat4x4(1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 1,
0, 0, -1, 0
);
return m1;
}
void render(const struct state * state,
unsigned int program,
unsigned int program__trans,
unsigned int program__texture0,
unsigned int color,
unsigned int vertex_array,
int triangles_length)
{
mat4x4 trans = perspective() * translate(vec3(0, 0, -2)) * scale(1.0f) * rotate_y(state->ry) * rotate_x(state->rx);
glEnable(GL_DEPTH_TEST);
glClearDepth(-1000.0f);
glDepthFunc(GL_GREATER);
glUniformMatrix4fv(program__trans, 1, GL_TRUE, &trans[0][0]);
glUniform1i(program__texture0, 0);
glClearColor(0.1, 0.2, 0.3, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(program);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, color);
glBindVertexArray(vertex_array);
glDrawElements(GL_TRIANGLES, triangles_length, GL_UNSIGNED_INT, 0);
}

66
src/shader.c Normal file
View File

@ -0,0 +1,66 @@
#include <stdio.h>
#include "glad/gl.h"
#include "shader.h"
unsigned int compile_shader(const char * name,
const void * vs,
const int vs_length,
const void * fs,
const int fs_length)
{
unsigned int vertex_shader;
vertex_shader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertex_shader, 1, (const char **)&vs, &vs_length);
glCompileShader(vertex_shader);
{
int success;
char info_log[512];
glGetShaderiv(vertex_shader, GL_COMPILE_STATUS, &success);
if(!success) {
glGetShaderInfoLog(vertex_shader, 512, NULL, info_log);
fprintf(stderr, "%s: vertex shader compile failed:\n%s\n", name, info_log);
}
}
unsigned int fragment_shader;
fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragment_shader, 1, (const char **)&fs, &fs_length);
glCompileShader(fragment_shader);
{
int success;
char info_log[512];
glGetShaderiv(fragment_shader, GL_COMPILE_STATUS, &success);
if(!success) {
glGetShaderInfoLog(fragment_shader, 512, NULL, info_log);
fprintf(stderr, "%s: fragment shader compile failed:\n%s\n", name, info_log);
}
}
unsigned int shader_program;
shader_program = glCreateProgram();
glAttachShader(shader_program, vertex_shader);
glAttachShader(shader_program, fragment_shader);
glBindAttribLocation(shader_program, shader_attrib_position, "v_position");
glBindAttribLocation(shader_program, shader_attrib_texture, "v_texture");
glBindAttribLocation(shader_program, shader_attrib_normal, "v_normal");
glLinkProgram(shader_program);
{
int success;
char info_log[512];
glGetProgramiv(shader_program, GL_LINK_STATUS, &success);
if(!success) {
glGetProgramInfoLog(shader_program, 512, NULL, info_log);
fprintf(stderr, "%s: program link failed:\n%s\n", name, info_log);
}
}
glDeleteShader(vertex_shader);
glDeleteShader(fragment_shader);
return shader_program;
}

15
src/shader/scene.fs.glsl Normal file
View File

@ -0,0 +1,15 @@
#version 130
uniform sampler2D texture0;
in vec2 f_texture;
in vec4 f_position;
void main()
{
vec2 coord = vec2(f_texture.x, 1.0 - f_texture.y);
vec4 c = texture2D(texture0, coord);
gl_FragColor = c;
//gl_FragColor = vec4(f_position.wwww);
}

17
src/shader/scene.vs.glsl Normal file
View File

@ -0,0 +1,17 @@
#version 130
in vec3 v_position;
in vec2 v_texture;
uniform mat4 trans;
out vec2 f_texture;
out vec4 f_position;
void main()
{
vec4 pos = trans * vec4(v_position, 1.0);
gl_Position = pos;
f_texture = v_texture;
f_position = pos;
}