How to use the gl-mat4.create function in gl-mat4

To help you get started, we’ve selected a few gl-mat4 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andyhall / glsl-projectron / index.js View on Github external
function paint( xRot, yRot ) {
	
	if (!initialized) { return }
	if (polyBuffersOutdated) {
		// buffers out of sync w/ arrays since last mutation wasn't kept
		vertBuffer.update( polys.vertArr )
		colBuffer.update( polys.colArr )
	}
	
	// rotation matrix (simple Euler angles)
	camMatrix = mat4.create()
	mat4.rotateY(camMatrix, camMatrix, yRot)
	mat4.rotateX(camMatrix, camMatrix, xRot)
	// paint polygons
	drawData( SCREEN, perspective, camMatrix )
}
github andyhall / glsl-projectron / src / index.js View on Github external
function paint(xRot, yRot) {
		if (polyBuffersOutdated) {
			// buffers out of sync w/ arrays since last mutation wasn't kept
			vertBuffer.update(polys.getVertArray())
			colBuffer.update(polys.getColorArray())
		}
		// rotation matrix (simple Euler angles)
		camMatrix = mat4.create()
		mat4.rotateY(camMatrix, camMatrix, xRot || 0)
		mat4.rotateX(camMatrix, camMatrix, yRot || 0)
		// paint polygons
		drawData(null, perspective, camMatrix)
	}
github Erkaman / pnp-gui / example / index.js View on Github external
function centerGeometry(geo, scale) {

    // Calculate the bounding box.
    var bb = boundingBox(geo.positions);

    // Translate the geometry center to the origin.
    var translate = [-0.5 * (bb[0][0] + bb[1][0]), -0.5 * (bb[0][1] + bb[1][1]), -0.5 * (bb[0][2] + bb[1][2])];
    var m = mat4.create();
    mat4.scale(m, m, [scale, scale, scale]);
    mat4.translate(m, m, translate);

    geo.positions = transform(geo.positions, m)
}
github shama / first-person-camera / first-person-camera.js View on Github external
FirstPersonCamera.prototype.view = function(out) {
  if (!out) out = mat4.create()
  mat4.rotateX(out, out, this.rotation[0])
  mat4.rotateY(out, out, this.rotation[1])
  mat4.rotateZ(out, out, this.rotation[2] - Math.PI)
  mat4.translate(out, out, [-this.position[0], -this.position[1], -this.position[2]])
  return out
}
github djalbat / xgl / lib / position.js View on Github external
value: function fromZCoordinate(zCoordinate) {
      var xCoordinate = defaultXCoordinate,
          yCoordinate = defaultYCoordinate,
          coordinateVector = [xCoordinate, yCoordinate, zCoordinate],
          matrix = mat4.create();

      mat4.translate(matrix, matrix, coordinateVector);

      var position = new Position(matrix);

      return position;
    }
  }]);

gl-mat4

gl-matrix's mat4, split into smaller pieces

Zlib
Latest version published 7 years ago

Package Health Score

56 / 100
Full package analysis