Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #91 from OpenGeoscience/change-uniform-origin
Browse files Browse the repository at this point in the history
Allow the modelViewOriginUniform to have the origin changed.
  • Loading branch information
manthey committed Feb 1, 2016
2 parents 6c8e331 + 2f9f3b2 commit 6c03ff8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/uniform.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ inherit(vgl.modelViewUniform, vgl.uniform);
* Create new instance of class modelViewOriginUniform.
*
* @param name
* @param uniform: a triplet of floats.
* @param {array} origin a triplet of floats.
* @returns {vgl.modelViewUniform}
*/
///////////////////////////////////////////////////////////////////////////////
Expand All @@ -247,13 +247,24 @@ vgl.modelViewOriginUniform = function (name, origin) {
if (name.length === 0) {
name = 'modelViewMatrix';
}
origin = origin || [0, 0, 0];

var m_origin = [origin[0], origin[1], origin[2] || 0];

vgl.uniform.call(this, vgl.GL.FLOAT_MAT4, name);

this.set(mat4.create());

/**
* Change the origin used by the uniform view matrix.
*
* @param {array} origin a triplet of floats.
*/
this.setOrigin = function (origin) {
origin = origin || [0, 0, 0];
m_origin = [origin[0], origin[1], origin[2] || 0];
};

/////////////////////////////////////////////////////////////////////////////
/**
* Update the uniform given a render state and shader program. This offsets
Expand Down Expand Up @@ -356,7 +367,6 @@ vgl.floatUniform = function (name, value) {

inherit(vgl.floatUniform, vgl.uniform);


///////////////////////////////////////////////////////////////////////////////
/**
* Create new instance of class normalMatrixUniform
Expand Down

0 comments on commit 6c03ff8

Please sign in to comment.