本文整理匯總了TypeScript中gl-matrix.vec2.fromValues方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript vec2.fromValues方法的具體用法?TypeScript vec2.fromValues怎麽用?TypeScript vec2.fromValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gl-matrix.vec2
的用法示例。
在下文中一共展示了vec2.fromValues方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(gl : WebGLRenderingContext, width=0, height=width){
this.gl = gl;
this.texture = gl.createTexture() || (() => {throw new Error("Could not make texture")})();
this.width = width;
this.height = height;
this.size = vec2.fromValues(width, height);
this.halfSize = vec2.fromValues(width/2, height/2);
this.inverseSize = vec2.fromValues(1/width, 1/height);
this.bind();
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.NEAREST);
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.NEAREST);
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE);
}
示例2: Float32Array
// common
import { glMatrix, vec2, mat2, mat3, mat4, vec3, vec4, mat2d, quat } from "gl-matrix";
var outVal: number;
var outBool: boolean;
var outStr: string;
let vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
let vec2A = vec2.fromValues(1, 2);
let vec2B = vec2.fromValues(3, 4);
let vec3A = vec3.fromValues(1, 2, 3);
let vec3B = vec3.fromValues(3, 4, 5);
let vec4A = vec4.fromValues(1, 2, 3, 4);
let vec4B = vec4.fromValues(3, 4, 5, 6);
let mat2A = mat2.fromValues(1, 2, 3, 4);
let mat2B = mat2.fromValues(1, 2, 3, 4);
let mat2dA = mat2d.fromValues(1, 2, 3, 4, 5, 6);
let mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6);
let mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
let mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
let mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let quatA = quat.fromValues(1, 2, 3, 4);
let quatB = quat.fromValues(5, 6, 7, 8);
let outVec2 = vec2.create();
let outVec3 = vec3.create();
let outVec4 = vec4.create();
let outMat2 = mat2.create();
let outMat2d = mat2d.create();
示例3: transformPointInverse
/**
* apply inverse transformation to a point
*
* @param {number} x
* @param {number} y
* @returns {GLM.IArray} transformed point
*/
public transformPointInverse(x: number, y: number): GLM.IArray {
let point = vec2.fromValues(x, y);
vec2.transformMat3(point, point, this.InverseTransform);
return point;
}
示例4: transformPoint
/**
* apply transformation to a point
*
* @param {number} x
* @param {number} y
* @returns {GLM.IArray} transformed point
*/
public transformPoint(x: number, y: number): GLM.IArray {
let point = vec2.fromValues(x, y);
vec2.transformMat3(point, point, this.Transformations);
return point;
}
示例5: postScale
/**
* apply scale
* @param {number} scaleX
* @param {number} scaleY
*/
public postScale(scaleX: number, scaleY: number) {
mat3.scale(this.mTransformation, this.mTransformation, vec2.fromValues(scaleX, scaleY));
this.mVersion++;
}
示例6: postTranslation
/**
* apply translation
* @param {number} deltaX
* @param {number} deltaY
*/
public postTranslation(deltaX: number, deltaY: number) {
mat3.translate(this.mTransformation, this.mTransformation, vec2.fromValues(deltaX, deltaY));
this.mVersion++;
}