@@ -91,33 +91,18 @@ function camera.lookInDirection(x,y,z, directionTowards,pitchTowards)
91
91
end
92
92
93
93
-- recreate the camera's view matrix from its current values
94
- -- and send the matrix to the shader specified, or the default shader
95
- function camera .updateViewMatrix (shaderGiven )
96
- local shader = shaderGiven or g3d .shader
94
+ function camera .updateViewMatrix ()
97
95
camera .viewMatrix :setViewMatrix (camera .position , camera .target , camera .up )
98
- shader :send (" viewMatrix" , camera .viewMatrix )
99
96
end
100
97
101
98
-- recreate the camera's projection matrix from its current values
102
- -- and send the matrix to the shader specified, or the default shader
103
- function camera .updateProjectionMatrix (shaderGiven )
104
- local shader = shaderGiven or g3d .shader
99
+ function camera .updateProjectionMatrix ()
105
100
camera .projectionMatrix :setProjectionMatrix (camera .fov , camera .nearClip , camera .farClip , camera .aspectRatio )
106
- shader :send (" projectionMatrix" , camera .projectionMatrix )
107
101
end
108
102
109
103
-- recreate the camera's orthographic projection matrix from its current values
110
- -- and send the matrix to the shader specified, or the default shader
111
- function camera .updateOrthographicMatrix (shaderGiven , size )
112
- local shader = shaderGiven or g3d .shader
104
+ function camera .updateOrthographicMatrix (size )
113
105
camera .projectionMatrix :setOrthographicMatrix (camera .fov , size or 5 , camera .nearClip , camera .farClip , camera .aspectRatio )
114
- shader :send (" projectionMatrix" , camera .projectionMatrix )
115
- end
116
-
117
- -- sends the camera's view and projection matrices to the given shader
118
- function camera .sendMatricesToShader (shader )
119
- shader :send (" viewMatrix" , camera .viewMatrix )
120
- shader :send (" projectionMatrix" , camera .projectionMatrix )
121
106
end
122
107
123
108
-- simple first person camera movement with WASD
0 commit comments