* Get a matrix from world-space to screen-space
()
| 783 | * Get a matrix from world-space to screen-space |
| 784 | */ |
| 785 | getWorldToScreenMatrix() { |
| 786 | const modelMatrix = this.states.uModelMatrix; |
| 787 | const viewMatrix = this.states.uViewMatrix; |
| 788 | const projectionMatrix = this.states.uPMatrix; |
| 789 | const projectedToScreenMatrix = new Matrix(4); |
| 790 | projectedToScreenMatrix.scale(this.width, this.height, 1); |
| 791 | projectedToScreenMatrix.translate([0.5, 0.5, 0.5]); |
| 792 | projectedToScreenMatrix.scale(0.5, -0.5, 0.5); |
| 793 | |
| 794 | const modelViewMatrix = modelMatrix.copy().mult(viewMatrix); |
| 795 | const modelViewProjectionMatrix = modelViewMatrix.mult(projectionMatrix); |
| 796 | const worldToScreenMatrix = modelViewProjectionMatrix |
| 797 | .mult(projectedToScreenMatrix); |
| 798 | return worldToScreenMatrix; |
| 799 | } |
| 800 | |
| 801 | ////////////////////////////////////////////// |
| 802 | // COLOR |
no test coverage detected