npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mat4.c

v1.0.0

Published

gl-matrix's mat4, in c, split into smaller pieces

Downloads

2

Readme

mat4.c stable

Part of a fork of @toji's gl-matrix in c, split into smaller pieces: this package contains glMatrix.mat4.

Usage

main.c


#include <mat4/type.h>
#include <mat4/create.h>

mat4 m4 = mat4_create();

gcc main.c -o main -Inode_modules/mat4.c/include

with cmake

CMakeLists.txt

cmake_minimum_required(VERSION 3.2)
project (mat4-test)
file(GLOB CMAKE_INCLUDES "node_modules/*/CMakeLists.txt")
include(${CMAKE_INCLUDES})
add_executable(main main.c)

API

mat4_adjoint(out:mat4, a:mat4)

Calculates the adjugate of a mat4

mat4_clone(a:mat4)

Creates a new mat4 initialized with values from an existing matrix

mat4_copy(out:mat4, a:mat4)

Copy the values from one mat4 to another

mat4_create()

Creates a new identity mat4

mat4_determinant(a:mat4)

Calculates the determinant of a mat4

mat4_fromQuat(out:mat4, q:quat4)

Creates a matrix from a quaternion rotation.

mat4_fromRotationTranslation(out:mat4, q:quat4, v:vec3)

Creates a matrix from a quaternion rotation and vector translation This is equivalent to (but much faster than):

  mat4_identity(dest);
  mat4_translate(dest, vec);
  mat4 quatMat = mat4_create();
  quat4_toMat4(quat, quatMat);
  mat4_multiply(dest, quatMat);

mat4_frustum(out:mat4, left:float, right:float, bottom:float, top:float, near:float, far:float)

Generates a frustum matrix with the given bounds

mat4_identity(out:mat4)

Set a mat4 to the identity matrix

mat4_invert(out:mat4, a:mat4)

Inverts a mat4

mat4_lookAt(out:mat4, eye:vec3, center:vec3, up:vec3)

Generates a look-at matrix with the given eye position, focal point, and up axis

mat4_multiply(out:mat4, a:mat4, b:mat4)

Multiplies two mat4's

mat4_ortho(out:mat4, left:float, right:float, bottom:float, top:float, near:float, far:float)

Generates a orthogonal projection matrix with the given bounds

mat4_perspective(out:mat4, fovy:float, aspect:float, near:float, far:float)

Generates a perspective projection matrix with the given bounds

mat4_perspectiveFromFieldOfView(out:mat4, fov:float[4], near:float, far:float)

Generates a perspective projection matrix with the given field of view.

mat4_rotate(out:mat4, a:mat4, rad:float, axis:vec3)

Rotates a mat4 by the given angle

mat4_rotateX(out:mat4, a:mat4, rad:float)

Rotates a matrix by the given angle around the X axis

mat4_rotateY(out:mat4, a:mat4, rad:float)

Rotates a matrix by the given angle around the Y axis

mat4_rotateZ(out:mat4, a:mat4, rad:float)

Rotates a matrix by the given angle around the Z axis

mat4_scale(out:mat4, a:mat4, v:vec3)

Scales the mat4 by the dimensions in the given vec3

mat4_translate(out:mat4, a:mat4, v:vec3)

Translate a mat4 by the given vector

mat4_transpose(out:mat4, a:mat4)

Transpose the values of a mat4

License

zlib. See LICENSE.md for details.