@@ -57,26 +57,24 @@ if (cc._renderType === cc._RENDER_TYPE_WEBGL) {
57
57
case cc . Director . PROJECTION_2D :
58
58
cc . kmGLMatrixMode ( cc . KM_GL_PROJECTION ) ;
59
59
cc . kmGLLoadIdentity ( ) ;
60
- var orthoMatrix = new cc . kmMat4 ( ) ;
61
- cc . kmMat4OrthographicProjection (
62
- orthoMatrix ,
60
+ var orthoMatrix = cc . math . Matrix4 . createOrthographicProjection (
63
61
- ox ,
64
- size . width - ox ,
62
+ size . width - ox ,
65
63
- oy ,
66
- size . height - oy ,
64
+ size . height - oy ,
67
65
- 1024 , 1024 ) ;
68
66
cc . kmGLMultMatrix ( orthoMatrix ) ;
69
67
cc . kmGLMatrixMode ( cc . KM_GL_MODELVIEW ) ;
70
68
cc . kmGLLoadIdentity ( ) ;
71
69
break ;
72
70
case cc . Director . PROJECTION_3D :
73
71
var zeye = _t . getZEye ( ) ;
74
- var matrixPerspective = new cc . kmMat4 ( ) , matrixLookup = new cc . kmMat4 ( ) ;
72
+ var matrixPerspective = new cc . math . Matrix4 ( ) , matrixLookup = new cc . math . Matrix4 ( ) ;
75
73
cc . kmGLMatrixMode ( cc . KM_GL_PROJECTION ) ;
76
74
cc . kmGLLoadIdentity ( ) ;
77
75
78
76
// issue #1334
79
- cc . kmMat4PerspectiveProjection ( matrixPerspective , 60 , size . width / size . height , 0.1 , zeye * 2 ) ;
77
+ matrixPerspective = cc . math . Matrix4 . createPerspectiveProjection ( 60 , size . width / size . height , 0.1 , zeye * 2 ) ;
80
78
81
79
cc . kmGLMultMatrix ( matrixPerspective ) ;
82
80
@@ -85,7 +83,7 @@ if (cc._renderType === cc._RENDER_TYPE_WEBGL) {
85
83
var eye = new cc . math . Vec3 ( - ox + size . width / 2 , - oy + size . height / 2 , zeye ) ;
86
84
var center = new cc . math . Vec3 ( - ox + size . width / 2 , - oy + size . height / 2 , 0.0 ) ;
87
85
var up = new cc . math . Vec3 ( 0.0 , 1.0 , 0.0 ) ;
88
- cc . kmMat4LookAt ( matrixLookup , eye , center , up ) ;
86
+ matrixLookup . lookAt ( eye , center , up ) ;
89
87
cc . kmGLMultMatrix ( matrixLookup ) ;
90
88
break ;
91
89
case cc . Director . PROJECTION_CUSTOM :
@@ -238,11 +236,10 @@ if (cc._renderType === cc._RENDER_TYPE_WEBGL) {
238
236
} ;
239
237
240
238
_p . convertToGL = function ( uiPoint ) {
241
- var transform = new cc . kmMat4 ( ) ;
239
+ var transform = new cc . math . Matrix4 ( ) ;
242
240
cc . GLToClipTransform ( transform ) ;
243
241
244
- var transformInv = new cc . kmMat4 ( ) ;
245
- cc . kmMat4Inverse ( transformInv , transform ) ;
242
+ var transformInv = transform . inverse ( ) ;
246
243
247
244
// Calculate z=0 using -> transform*[0, 0, 0, 1]/w
248
245
var zClip = transform . mat [ 14 ] / transform . mat [ 15 ] ;
@@ -253,7 +250,7 @@ if (cc._renderType === cc._RENDER_TYPE_WEBGL) {
253
250
} ;
254
251
255
252
_p . convertToUI = function ( glPoint ) {
256
- var transform = new cc . kmMat4 ( ) ;
253
+ var transform = new cc . math . Matrix4 ( ) ;
257
254
cc . GLToClipTransform ( transform ) ;
258
255
259
256
var clipCoord = new cc . math . Vec3 ( glPoint . x , glPoint . y , 0.0 ) ;
0 commit comments