@@ -167,6 +167,23 @@ namespace ed {
167167 matrix = glm::perspectiveFov (45 .0f , view[0 ], view[1 ], z[0 ], z[1 ]);
168168 } break ;
169169
170+ case FunctionShaderVariable::MatrixPerspectiveVFovLH: {
171+ float fov = *LoadFloat (var->Arguments , 0 );
172+ float * view = LoadFloat (var->Arguments , 1 );
173+ float * z = LoadFloat (var->Arguments , 3 );
174+
175+ matrix = glm::perspective (fov, view[0 ] / view[1 ], z[0 ], z[1 ]);
176+ } break ;
177+
178+ case FunctionShaderVariable::MatrixPerspectiveHFovLH: {
179+ float * view = LoadFloat (var->Arguments , 1 );
180+ float aspect = view[0 ] / view[1 ];
181+ float fov = *LoadFloat (var->Arguments , 0 ) / aspect;
182+ float * z = LoadFloat (var->Arguments , 3 );
183+
184+ matrix = glm::perspective (fov, aspect, z[0 ], z[1 ]);
185+ } break ;
186+
170187 case FunctionShaderVariable::MatrixRotationAxis: {
171188 float * axis = LoadFloat (var->Arguments , 0 );
172189 float angle = *LoadFloat (var->Arguments , 3 );
@@ -297,6 +314,14 @@ namespace ed {
297314 *LoadFloat (var->Arguments , 2 ) = 0 .1f ;
298315 *LoadFloat (var->Arguments , 3 ) = 100 .0f ;
299316 break ;
317+ case FunctionShaderVariable::MatrixPerspectiveVFovLH:
318+ case FunctionShaderVariable::MatrixPerspectiveHFovLH:
319+ *LoadFloat (var->Arguments , 0 ) = glm::half_pi<float >();
320+ *LoadFloat (var->Arguments , 1 ) = 800 ;
321+ *LoadFloat (var->Arguments , 2 ) = 600 ;
322+ *LoadFloat (var->Arguments , 3 ) = 0 .1f ;
323+ *LoadFloat (var->Arguments , 4 ) = 100 .0f ;
324+ break ;
300325 case FunctionShaderVariable::MatrixRotationAxis:
301326 *LoadFloat (var->Arguments , 0 ) = 1 ;
302327 break ;
@@ -324,6 +349,8 @@ namespace ed {
324349 case FunctionShaderVariable::MatrixOrthographicLH: return 4 ;
325350 case FunctionShaderVariable::MatrixPerspectiveFovLH: return 4 ;
326351 case FunctionShaderVariable::MatrixPerspectiveLH: return 4 ;
352+ case FunctionShaderVariable::MatrixPerspectiveVFovLH: return 5 ;
353+ case FunctionShaderVariable::MatrixPerspectiveHFovLH: return 5 ;
327354 case FunctionShaderVariable::MatrixRotationAxis: return 4 ;
328355 case FunctionShaderVariable::MatrixRotationNormal: return 4 ;
329356 case FunctionShaderVariable::MatrixRotationRollPitchYaw: return 3 ;
0 commit comments