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

◆ CopyData< T >() [3/3]

static unsafe void Microsoft.Xna.Framework.Graphics.Texture3D.CopyData< T > ( void * pData,
int rowPitch,
int slicePitch,
T[] data,
int dataIndex,
int elementCount,
_D3DVOLUME_DESC * pVolume,
uint dwLockWidth,
uint dwLockHeight,
uint dwLockDepth,
[MarshalAs(UnmanagedType.U1)] bool isSetting )
inlinestaticpackage
Type Constraints
T :struct 

Definition at line 110 of file Texture3D.cs.

110 : struct
111 {
112 if (pVolume == null)
113 {
114 return;
115 }
116 fixed (T* ptr2 = &data[dataIndex])
117 {
118 byte* ptr = (byte*)pData;
119 byte* ptr3 = (byte*)ptr2;
120 uint num = (uint)System.Runtime.CompilerServices.Unsafe.SizeOf<T>();
121 uint num2 = Texture.GetExpectedByteSizeFromFormat(*(_D3DFORMAT*)pVolume) / num * num * dwLockWidth;
122 if (0 >= dwLockDepth)
123 {
124 return;
125 }
126 uint num3 = dwLockDepth;
127 do
128 {
129 byte* ptr4 = ptr;
130 if (0 < dwLockHeight)
131 {
132 uint num4 = dwLockHeight;
133 do
134 {
135 if (*(int*)pVolume == 21)
136 {
137 if (isSetting)
138 {
139 Texture.SwapBgr(ptr4, ptr3, num2);
140 }
141 else
142 {
143 Texture.SwapBgr(ptr3, ptr4, num2);
144 }
145 }
146 else if (isSetting)
147 {
148 _003CModule_003E.memcpy_s(ptr4, num2, ptr3, num2);
149 }
150 else
151 {
152 _003CModule_003E.memcpy_s(ptr3, num2, ptr4, num2);
153 }
154 ptr4 = rowPitch + ptr4;
155 ptr3 = (int)num2 + ptr3;
156 num4--;
157 }
158 while (num4 != 0);
159 }
160 ptr = slicePitch + ptr;
161 num3--;
162 }
163 while (num3 != 0);
164 }
165 }

References Microsoft.Xna.Framework.Graphics.Texture.GetExpectedByteSizeFromFormat(), and Microsoft.Xna.Framework.Graphics.Texture.SwapBgr().