Created
January 3, 2018 22:32
-
-
Save anden3/926d4d77bf43b3e658c9ad64d24fa79c to your computer and use it in GitHub Desktop.
DrawStuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var world = shared.worldMatrix; | |
| mat4.identity(world); | |
| mat4.translate(world, world, vec3.fromValues(0, -20, 0)); | |
| setWorldViewProjection(); | |
| // Square | |
| { | |
| let matrix = mat4.create(); | |
| gl.uniformMatrix4fv(shared.modelMatrixLocation, false, matrix); | |
| gl.bindVertexArray(shared.square.vertexArray); | |
| gl.drawArrays(gl.TRIANGLES, 0, shared.square.vertexCount); | |
| } | |
| // House | |
| { | |
| let matrix = mat4.create(); | |
| let q = quat.create(); | |
| quat.rotateZ(q, q, time); | |
| mat4.fromRotationTranslation(matrix, q, [-20, 15, 0]); | |
| gl.uniformMatrix4fv(shared.modelMatrixLocation, false, matrix); | |
| gl.bindVertexArray(shared.house.vertexArray); | |
| gl.drawArrays(gl.TRIANGLES, 0, shared.house.vertexCount); | |
| } | |
| // House 2 | |
| { | |
| let matrix = mat4.create(); | |
| let q = quat.create(); | |
| quat.rotateZ(q, q, time); | |
| mat4.fromRotationTranslation(matrix, q, [20, 15, 0]); | |
| gl.uniformMatrix4fv(shared.modelMatrixLocation, false, matrix); | |
| gl.bindVertexArray(shared.house2.vertexArray); | |
| gl.drawElements(gl.TRIANGLES, shared.house2.vertexCount, gl.UNSIGNED_BYTE, 0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment