當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript gl-matrix.mat3類代碼示例

本文整理匯總了TypeScript中gl-matrix.mat3的典型用法代碼示例。如果您正苦於以下問題:TypeScript mat3類的具體用法?TypeScript mat3怎麽用?TypeScript mat3使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了mat3類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: InverseTransform

 /**
  * returns the inverse of transformation matrix 
  * @readonly
  * @type {GLM.IArray}
  */
 public get InverseTransform(): GLM.IArray {
     if (this.mInverseTransVersion !== this.mVersion) {
         mat3.invert(this.mCachedInverse, this.mTransformation);
         this.mInverseTransVersion = this.mVersion;
     }
     //TODO should reset mIsTransformationDirty to false, maybe should also call an abstract function so children of this class can do some recalculations as well 
     return this.mCachedInverse;
 }
開發者ID:MehdiZonjy,項目名稱:book-viewer,代碼行數:13,代碼來源:movable-object.ts

示例2: constructor

 constructor(
   readonly type: BoneType,
   readonly basis: Triple<vec3>,
   readonly prevJoint: vec3,
   readonly nextJoint: vec3,
   readonly width: number
 ) {
   const difference = vec3.subtract(vec3.create(), this.nextJoint, this.prevJoint);
   this.length = vec3.length(difference);
   this.basisMatrix = mat3.fromValues(
     this.basis[0][0], this.basis[0][1], this.basis[0][2],
     this.basis[1][0], this.basis[1][1], this.basis[1][2],
     this.basis[2][0], this.basis[2][1], this.basis[2][2]
   );
   this.left = mat3.determinant(this.basisMatrix) < 0;
   this.center = vec3.lerp(vec3.create(), this.prevJoint, this.nextJoint, 0.5);
   this.direction = Bone.createBoneDirection(this.basisMatrix);
   this.matrix = Bone.createBoneMatrix(this.basisMatrix, this.center, this.left);
 }
開發者ID:alexeden,項目名稱:dotstar-node,代碼行數:19,代碼來源:bone.ts

示例3: createProjection

 /**
  * Creates Orthographic projection matrix 
  * 
  * @private
  * @param {number} width
  * @param {number} height
  */
 private createProjection(width: number, height: number) {
     this.mProjection = mat3.create();
     this.mProjection[0] = 2 / width;
     this.mProjection[4] = -2 / height;
     this.mProjection[6] = -1;
     this.mProjection[7] = 1;
     /*
         2 / width, 0, 0,
         0, -2 / height, 0,
         -1, 1, 1
     */
 }
開發者ID:MehdiZonjy,項目名稱:book-viewer,代碼行數:19,代碼來源:camera.ts

示例4: constructor

  private constructor(
    data: HandData
  ) {
    this.armBasis = data.armBasis.map(basis => vec3.fromValues(...basis)) as Triple<vec3>;
    this.armWidth = data.armWidth;
    this.confidence = data.confidence;
    this.direction = vec3.fromValues(...data.direction);
    this.elbow = vec3.fromValues(...data.elbow);
    this.grabStrength = data.grabStrength;
    this.id = data.id;
    this.palmNormal = vec3.fromValues(...data.palmNormal);
    this.palmPosition = vec3.fromValues(...data.palmPosition);
    this.palmVelocity = vec3.fromValues(...data.palmVelocity);
    this.palmWidth = data.palmWidth;
    this.pinchStrength = data.pinchStrength;
    this.r = mat3.fromValues(
      data.r[0][0], data.r[0][1], data.r[0][2],
      data.r[1][0], data.r[1][1], data.r[1][2],
      data.r[2][0], data.r[2][1], data.r[2][2]
    );
    this.s = data.s;
    this.sphereCenter = vec3.fromValues(...data.sphereCenter);
    this.sphereRadius = data.sphereRadius;
    this.stabilizedPalmPosition = vec3.fromValues(...data.stabilizedPalmPosition);
    this.t = vec3.fromValues(...data.t);
    this.timeVisible = data.timeVisible;
    this.type = data.type;
    this.wrist = vec3.fromValues(...data.wrist);


    this.pointables = [];
    this.fingers = {};

    this.arm = new Bone(
      BoneType.arm,
      this.armBasis,
      this.elbow,
      this.wrist,
      this.armWidth
    );

    this.pitch = Math.atan2(this.direction[1], -this.direction[2]);
    this.yaw = Math.atan2(this.direction[0], -this.direction[2]);
    this.roll = Math.atan2(this.palmNormal[0], -this.palmNormal[1]);
  }
開發者ID:alexeden,項目名稱:dotstar-node,代碼行數:45,代碼來源:hand.ts

示例5: constructor

  constructor(){
    this.verticalFlipMatrix = mat2d.create();
    this.viewportToSquareMatrix = mat2d.create();
    this.viewportFromSquareMatrix = mat2d.create();
    this.mapToTileMatrix = mat2d.create();
    this.mapFromTileMatrix = mat2d.create();
    this.squareToMapMatrix = mat2d.create();
    this.squareFromMapMatrix = mat2d.create();
    this.clipToSquareMatrix = mat2d.create();
    this.clipFromSquareMatrix = mat2d.create();
    this.viewportToClipMatrix = mat2d.create();

    this.mapToViewportMatrix = mat3.create();

    mat2d.fromScaling(this.verticalFlipMatrix, [1, -1]);
    mat2d.fromScaling(this.squareToMapMatrix, [1, 1]);
    mat2d.invert(this.squareFromMapMatrix, this.squareToMapMatrix);

    this.setMapSize(128);
  }
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:20,代碼來源:Perspective.ts

示例6:

  lambertFragmentShaderEs300
} from '../shaders/Lambert.glsl';
import {
  phongFragmentShaderEs100,
  phongFragmentShaderEs300
} from '../shaders/Phong.glsl';
import { vertexShaderEs100, vertexShaderEs300 } from '../shaders/Vertex.glsl';
import ShaderParser from '../utils/ShaderParser';
import { capabilities } from './Capabilities';
import * as CONSTANTS from './Constants';
import * as GL from './GL';
import Program from './Program';
import UniformBuffers from './UniformBuffers';

let gl: WebGL2RenderingContext | WebGLRenderingContext;
const normalMatrix: mat3 = mat3.create();
const inversedModelViewMatrix: mat4 = mat4.create();

interface Options {
  name?: string;
  type?: string;
  uniforms?: any;
  fov?: number;
  hookVertexPre?: string;
  hookVertexMain?: string;
  hookVertexEnd?: string;
  hookFragmentPre?: string;
  hookFragmentMain?: string;
  hookFragmentEnd?: string;
  vertexShader?: string;
  fragmentShader?: string;
開發者ID:davidpaulrosser,項目名稱:leonardo,代碼行數:31,代碼來源:Material.ts

示例7: Projection

 /**
  * Projection Matrix 
  * 
  * @readonly
  * @type {GLM.IArray}
  */
 public get Projection(): GLM.IArray {
     return mat3.clone(this.mProjection);
 }
開發者ID:MehdiZonjy,項目名稱:book-viewer,代碼行數:9,代碼來源:camera.ts

示例8: updateViewWorld

    /**
     * recalculate {mViewWorld} matrix
     * 
     * @protected
     * @param {GLM.IArray} view
     */
    protected updateViewWorld(view: GLM.IArray) {
        mat3.multiply(this.mViewWorld, view, this.Transformations);

    }
開發者ID:MehdiZonjy,項目名稱:book-viewer,代碼行數:10,代碼來源:base-sprite.ts

示例9: reset

 /*    public set Scale(scale) {
         this.mIsTransformationDirty = true;
 
     }*/
 /**
  * resets transformation matrix to identity matrix 
  */
 public reset() {
     mat3.identity(this.mTransformation);
     this.mVersion++;
 }
開發者ID:MehdiZonjy,項目名稱:book-viewer,代碼行數:11,代碼來源:movable-object.ts

示例10: recalculate

 /**
  * clipPos = clipFromSquare * squareFromMap * verticalFlip * mapPos
  */
 private recalculate(){
   mat3.fromMat2d(this.mapToViewportMatrix, this.verticalFlipMatrix);
   mul2d(this.mapToViewportMatrix, this.squareFromMapMatrix, this.mapToViewportMatrix);
   mul2d(this.mapToViewportMatrix, this.clipFromSquareMatrix, this.mapToViewportMatrix);
 }
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:8,代碼來源:Perspective.ts


注:本文中的gl-matrix.mat3類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。