当前位置: 首页>>代码示例>>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;未经允许,请勿转载。