UNPKG

ts-game-engine

Version:

Simple WebGL game/render engine written in TypeScript

22 lines (21 loc) 960 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Mesh_1 = require("./Mesh"); const gl_matrix_1 = require("gl-matrix"); class QuadMesh extends Mesh_1.Mesh { constructor(scene) { super(scene); const vertexData = new Float32Array([ //Position Color Normal UV0 -0.5, +0.5, +0.0, 0, 1, 0, 1, 0, 0, 1, 0, 1, -0.5, -0.5, +0.0, 0, 0, 0, 1, 0, 0, 1, 0, 0, +0.5, +0.5, +0.0, 1, 1, 0, 1, 0, 0, 1, 1, 1, +0.5, -0.5, +0.0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ]); const vertexFormat = 1 /* Position */ | 2 /* Color */ | 4 /* Normal */ | 8 /* UV0 */; this.SetVertexData(vertexFormat, 5 /* TriangleStrip */, 4, vertexData, false); this.SetBounds(gl_matrix_1.vec3.fromValues(-0.5, -0.5, 0.0), gl_matrix_1.vec3.fromValues(0.5, 0.5, 0.0)); this.isLoaded = true; } } exports.QuadMesh = QuadMesh;