/* * Sweet is a small library for basic math and small matrix operations. * Copyright 2014 Luc Girod. * * This library is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef SWEET_MACRO #define SWEET_MACRO #include "sweet_overload_macro.h" #define vec2_new(...) _OVERLOAD_2_(__VA_ARGS__, vec2_new_2f, vec2_new_v3, NULL)(__VA_ARGS__) #define vec3_new(...) _OVERLOAD_3_(__VA_ARGS__, vec3_new_3f, vec3_new_v2_1f, vec3_new_v4, NULL)(__VA_ARGS__) #define vec4_new(...) _OVERLOAD_4_(__VA_ARGS__, vec4_new_4f, vec4_new_v2_2f, vec4_new_v3_1f, vec4_new_v4, NULL)(__VA_ARGS__) #define mat2_new(...) _OVERLOAD_4_(__VA_ARGS__, mat2_new_4f, mat2_new_3f, mat2_new_2v, mat2_new_m3, NULL)(__VA_ARGS__) #define mat3_new(...) _OVERLOAD_9_(__VA_ARGS__, mat3_new_9f, NULL, NULL, NULL, NULL, NULL, mat3_new_3v, mat3_new_2v, mat3_new_m4, NULL)(__VA_ARGS__) #define mat4_new(...) _OVERLOAD_4_(__VA_ARGS__, mat4_new_4v, mat4_new_3v, mat4_new_2v, mat4_new_m4, NULL)(__VA_ARGS__) #define mat2_insert_col(...) _OVERLOAD_4_(__VA_ARGS__, mat2_insert_col_2f, mat2_insert_col_1v, NULL, NULL)(__VA_ARGS__) #define mat3_insert_col(...) _OVERLOAD_5_(__VA_ARGS__, mat3_insert_col_3f, mat3_insert_col_1v1f, mat3_insert_col_1v, NULL, NULL)(__VA_ARGS__) #define mat4_insert_col(...) _OVERLOAD_6_(__VA_ARGS__, mat4_insert_col_4f, mat4_insert_col_1v2f, mat4_insert_col_1v1f, mat4_insert_col_1v, NULL, NULL)(__VA_ARGS__) #define swap(a, b, type) \ {\ type t;\ t = a;\ a = b;\ b = t;\ \ } #endif