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

◆ GetValueVector3()

unsafe Vector3 Microsoft.Xna.Framework.Graphics.EffectParameter.GetValueVector3 ( )
inline

Definition at line 2021 of file EffectParameter.cs.

2022 {
2023 Vector3 result = default(Vector3);
2024 ID3DXBaseEffect* ptr;
2025 if (pElementCollection.Count == 0)
2026 {
2027 switch (_paramClass)
2028 {
2029 case EffectParameterClass.Scalar:
2030 {
2031 ptr = pEffect;
2032 System.Runtime.CompilerServices.Unsafe.SkipInit(out float num);
2033 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, int>)(int)(*(uint*)(*(int*)ptr + 124)))((nint)ptr, _handle, &num);
2034 if (num2 < 0)
2035 {
2036 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
2037 }
2038 result.Z = num;
2039 result.Y = num;
2040 result.X = num;
2041 return result;
2042 }
2043 case EffectParameterClass.Vector:
2044 break;
2045 default:
2046 throw new InvalidCastException();
2047 }
2048 if (_columns != 3 || _rows != 1)
2049 {
2050 throw new InvalidCastException();
2051 }
2052 }
2053 ptr = pEffect;
2054 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR4 d3DXVECTOR);
2055 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 140)))((nint)ptr, _handle, &d3DXVECTOR);
2056 if (num3 < 0)
2057 {
2058 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
2059 }
2060 result.X = *(float*)(&d3DXVECTOR);
2061 result.Y = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 4));
2062 result.Z = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 8));
2063 return result;
2064 }

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.GetValueVector3().