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

◆ SetValue() [1/18]

unsafe void Microsoft.Xna.Framework.Graphics.EffectParameter.SetValue ( [MarshalAs(UnmanagedType.U1)] bool value)
inline

Definition at line 1242 of file EffectParameter.cs.

1243 {
1244 if (pElementCollection.Count != 0)
1245 {
1246 throw new InvalidCastException();
1247 }
1248 EffectParameterClass paramClass = _paramClass;
1249 if (paramClass == EffectParameterClass.Vector && _rows == 1)
1250 {
1251 switch (_columns)
1252 {
1253 default:
1254 throw new InvalidCastException();
1255 case 4:
1256 {
1257 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR4 d3DXVECTOR3);
1258 *(float*)(&d3DXVECTOR3) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 4)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 8)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 12)) = ((!value) ? 0f : 1f))));
1259 ID3DXBaseEffect* ptr = pEffect;
1260 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 136)))((nint)ptr, _handle, &d3DXVECTOR3);
1261 if (num3 < 0)
1262 {
1263 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
1264 }
1265 break;
1266 }
1267 case 3:
1268 {
1269 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR3 d3DXVECTOR2);
1270 *(float*)(&d3DXVECTOR2) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR3, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 4)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR3, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 8)) = ((!value) ? 0f : 1f)));
1271 ID3DXBaseEffect* ptr = pEffect;
1272 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr + 128)))((nint)ptr, _handle, (float*)(&d3DXVECTOR2), 3u);
1273 if (num2 < 0)
1274 {
1275 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
1276 }
1277 break;
1278 }
1279 case 2:
1280 {
1281 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR2 d3DXVECTOR);
1282 *(float*)(&d3DXVECTOR) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR2, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 4)) = ((!value) ? 0f : 1f));
1283 ID3DXBaseEffect* ptr = pEffect;
1284 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr + 128)))((nint)ptr, _handle, (float*)(&d3DXVECTOR), 2u);
1285 if (num < 0)
1286 {
1287 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
1288 }
1289 break;
1290 }
1291 }
1292 return;
1293 }
1294 switch (paramClass)
1295 {
1296 case EffectParameterClass.Matrix:
1297 {
1298 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXMATRIX d3DXMATRIX);
1299 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 48)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 52)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 56)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 60)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 32)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 36)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 40)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 44)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 16)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 20)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 24)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 28)) = (*(float*)(&d3DXMATRIX) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 4)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 8)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 12)) = ((!value) ? 0f : 1f))))))))))))))));
1300 ID3DXBaseEffect* ptr = pEffect;
1301 int num6 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, int>)(int)(*(uint*)(*(int*)ptr + 152)))((nint)ptr, _handle, &d3DXMATRIX);
1302 if (num6 < 0)
1303 {
1304 throw GraphicsHelpers.GetExceptionFromResult((uint)num6);
1305 }
1306 break;
1307 }
1308 default:
1309 throw new InvalidCastException();
1310 case EffectParameterClass.Scalar:
1311 {
1312 int num4 = (value ? 1 : 0);
1313 ID3DXBaseEffect* ptr = pEffect;
1314 int num5 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int, int>)(int)(*(uint*)(*(int*)ptr + 88)))((nint)ptr, _handle, num4);
1315 if (num5 < 0)
1316 {
1317 throw GraphicsHelpers.GetExceptionFromResult((uint)num5);
1318 }
1319 break;
1320 }
1321 }
1322 }

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, Microsoft.Xna.Framework.Graphics.EffectParameter.pElementCollection, and System.value.