GNM is a lightweight mathematics library which is C++ implementation followed GLSL Specifications.
Features:
- Header only library
- Usages are in complete accord with GLSL
- Supports all types and operations for mathematics part of GLSL
- Supports swizzle operation as GLSL
- Supports Intel instruction (SSE2/SSE4/AVX...)
- Supports quaternion
- Any C++11 compiler
- Other features are in progress...
Example Code:
#include "gnm.h"
GNM_USING_NAMESPACE
int main() {
vec3 camera_pos(10.0f, 10.0f, 10.0f);
vec3 view_pos(0.0f);
vec3 normal(1.0f, 1.0f, 1.0f);
vec3 albedo = vec3(0.75f);
vec3 metallic = vec3(0.25f);
vec3 f0 = vec3(0.04);
vec3 diffuse = albedo * 0.96 * (1.0 - metallic);
vec3 specular = mix(f0, albedo, metallic);
vec3 v = normalize(camera_pos.xyz - view_pos.xyz);
float n_dot_v = clamp(abs(dot(normal, v)), 0.001f, 1.0f);
return 0;
}
-
CMake
3.15 or later : http://www.cmake.org/cmake/resources/software.htmlNote: Add CMake to ${Path} environment variable.
- Run build.bat, choose the selection to generate .sln
- Open .sln with Visual Studio, and building.