| 8162 | }; |
| 8163 | |
| 8164 | var projectVertex = function ( vertex ) { |
| 8165 | |
| 8166 | var position = vertex.position; |
| 8167 | var positionWorld = vertex.positionWorld; |
| 8168 | var positionScreen = vertex.positionScreen; |
| 8169 | |
| 8170 | positionWorld.copy( position ).applyMatrix4( _modelMatrix ); |
| 8171 | positionScreen.copy( positionWorld ).applyMatrix4( _viewProjectionMatrix ); |
| 8172 | |
| 8173 | var invW = 1 / positionScreen.w; |
| 8174 | |
| 8175 | positionScreen.x *= invW; |
| 8176 | positionScreen.y *= invW; |
| 8177 | positionScreen.z *= invW; |
| 8178 | |
| 8179 | vertex.visible = positionScreen.x >= -1 && positionScreen.x <= 1 && |
| 8180 | positionScreen.y >= -1 && positionScreen.y <= 1 && |
| 8181 | positionScreen.z >= -1 && positionScreen.z <= 1; |
| 8182 | |
| 8183 | }; |
| 8184 | |
| 8185 | var pushVertex = function ( x, y, z ) { |
| 8186 | |