Переглянути джерело

Add mat3 from floats and TMat3 | TMat4 * Vec (#812)

Monad 5 роки тому
батько
коміт
32adb90258
2 змінених файлів з 2 додано та 0 видалено
  1. 1 0
      hxsl/Checker.hx
  2. 1 0
      hxsl/HlslOut.hx

+ 1 - 0
hxsl/Checker.hx

@@ -1015,6 +1015,7 @@ class Checker {
 			switch( ([for( a in args ) a.t]) ) {
 			case [TMat3x4 | TMat4]: type = TMat3;
 			case [TVec(3, VFloat), TVec(3, VFloat), TVec(3, VFloat)]: type = TMat3;
+			case [TFloat, TFloat, TFloat, TFloat, TFloat, TFloat, TFloat, TFloat, TFloat]: type = TMat3;
 			default:
 				error("Cannot apply " + g.toString() + " to these parameters", pos);
 			}

+ 1 - 0
hxsl/HlslOut.hx

@@ -318,6 +318,7 @@ class HlslOut {
 				decl("float3x3 mat3( float4x4 m ) { return (float3x3)m; }");
 				decl("float3x3 mat3( float4x3 m ) { return (float3x3)m; }");
 				decl("float3x3 mat3( float3 a, float3 b, float3 c ) { float3x3 m; m._m00_m10_m20 = a; m._m01_m11_m21 = b; m._m02_m12_m22 = c; return m; }");
+				decl("float3x3 mat3( float c00, float c01, float c02, float c10, float c11, float c12, float c20, float c21, float c22 ) { float3x3 m = { c00, c10, c20, c01, c11, c21, c02, c12, c22 }; return m; }");
 			case Mat2:
 				decl("float2x2 mat2( float4x4 m ) { return (float2x2)m; }");
 				decl("float2x2 mat2( float4x3 m ) { return (float2x2)m; }");