Git Product home page Git Product logo

whmath's Introduction

whmath

C++ SIMD header-only math library targeting game/engine development mixing features of:

Description

file description
math.hpp template prototypes describe intended implementations

Sources

get clone --recurse-submodules --recursive http://github.com/jopadan/whmath
cd whmath

Building

cmake . --install-prefix=/usr
make install

Optimization

Change CMakeLists.txt compile flags to fit your needs:

add_compile_options(-march=native -mfpmath=sse+387 -mveclibabi=svml -O3)

Usage

#include <whmath/math.hpp>

using namespace math;

/* single float scalar */
sca::f32          s = 213.0f;

/* unsigned byte vector of size 4 */
vec::u8<4>        a = { 43, 52, 32, 53 };

/* single float vector of size 4 */
vec::f32<4>       b = { 32.0, 54.0, 43.0, 34.0 };

/* unsigned short integer bitfield with 3 color components */
col::u16<5,6,5>   c = { 24, 12, 12 };

/* unsigned short integer bitfield with 4 color components */
col::u16<4,4,4,4> d = { 24, 12, 12, 8 };

/* unsigned char integer vector with 4 color components */
col::u8<4>        e = { 24, 12, 12, 8 };

/* floating point vector with 4 color components */
col::f32<4>       f = { 24.0f, 12.0f, 12.0f, 8.0f };

/* 3d vector product */
mat::f32<3, 3> m3 = mat::f32<3,3>::identity();
m3[2] = prd::cross<sca::f32, 3>(m3[0], m3[1]);

/* 4d vector product */
mat::f32<4, 4> m4 = mat::f32<4,4>::identity();
m4[3] = prd::cross<sca::f32, 4>(m4[0], m4[1], m4[2]);

Links

whmath's People

Contributors

jopadan avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.