Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetValueVector2()

unsafe Vector2 Microsoft.Xna.Framework.Graphics.EffectParameter.GetValueVector2 ( )
inline

Definition at line 1925 of file EffectParameter.cs.

1926 {
1927 Vector2 result = default(Vector2);
1928 ID3DXBaseEffect* ptr;
1929 if (pElementCollection.Count == 0)
1930 {
1931 switch (_paramClass)
1932 {
1933 case EffectParameterClass.Scalar:
1934 {
1935 ptr = pEffect;
1936 System.Runtime.CompilerServices.Unsafe.SkipInit(out float num);
1937 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, int>)(int)(*(uint*)(*(int*)ptr + 124)))((nint)ptr, _handle, &num);
1938 if (num2 < 0)
1939 {
1940 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
1941 }
1942 result.Y = num;
1943 result.X = num;
1944 return result;
1945 }
1946 case EffectParameterClass.Vector:
1947 break;
1948 default:
1949 throw new InvalidCastException();
1950 }
1951 if (_columns != 2 || _rows != 1)
1952 {
1953 throw new InvalidCastException();
1954 }
1955 }
1956 ptr = pEffect;
1957 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR4 d3DXVECTOR);
1958 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 140)))((nint)ptr, _handle, &d3DXVECTOR);
1959 if (num3 < 0)
1960 {
1961 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
1962 }
1963 result.X = *(float*)(&d3DXVECTOR);
1964 result.Y = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 4));
1965 return result;
1966 }

References Microsoft.Xna.Framework.Graphics.EffectParameter._columns, Microsoft.Xna.Framework.Graphics.EffectParameter._handle, Microsoft.Xna.Framework.Graphics.EffectParameter._paramClass, Microsoft.Xna.Framework.Graphics.EffectParameter._rows, Microsoft.Xna.Framework.Graphics.EffectParameterCollection.Count, Microsoft.Xna.Framework.Graphics.GraphicsHelpers.GetExceptionFromResult(), Microsoft.Xna.Framework.Graphics.EffectParameter.pEffect, and Microsoft.Xna.Framework.Graphics.EffectParameter.pElementCollection.

Referenced by Microsoft.Xna.Framework.Graphics.EffectAnnotation.GetValueVector2().