/// <summary> /// <p>Adds a sprite to the list of batched sprites.</p> /// </summary> /// <param name="textureRef"><dd> <p>Pointer to an <strong><see cref="SharpDX.Direct3D9.Texture"/></strong> interface that represents the sprite texture.</p> </dd></param> /// <param name="srcRectRef"><dd> <p>Pointer to a <strong><see cref="RawRectangle"/></strong> structure that indicates the portion of the source texture to use for the sprite. If this parameter is <strong><c>null</c></strong>, then the entire source image is used for the sprite.</p> </dd></param> /// <param name="centerRef"><dd> <p>Pointer to a <strong><see cref="RawVector3"/></strong> vector that identifies the center of the sprite. If this argument is <strong><c>null</c></strong>, the point (0,0,0) is used, which is the upper-left corner.</p> </dd></param> /// <param name="positionRef"><dd> <p>Pointer to a <strong><see cref="RawVector3"/></strong> vector that identifies the position of the sprite. If this argument is <strong><c>null</c></strong>, the point (0,0,0) is used, which is the upper-left corner.</p> </dd></param> /// <param name="color"><dd> <p> <strong><see cref="RawColor4"/></strong> type. The color and alpha channels are modulated by this value. A value of 0xFFFFFFFF maintains the original source color and alpha data. Use the <strong>D3DCOLOR_RGBA</strong> macro to help generate this color.</p> </dd></param> /// <returns><p>If the method succeeds, the return value is <see cref="SharpDX.Result.Ok"/>. If the method fails, the return value can be one of the following: <see cref="SharpDX.Direct3D9.ResultCode.InvalidCall"/>, D3DXERR_INVALIDDATA.</p></returns> /// <remarks> /// <p>To scale, rotate, or translate a sprite, call <strong><see cref="SharpDX.Direct3D9.Sprite.SetTransform"/></strong> with a matrix that contains the scale, rotate, and translate (SRT) values, before calling <see cref="SharpDX.Direct3D9.Sprite.Draw"/>. For information about setting SRT values in a matrix, see Matrix Transforms.</p> /// </remarks> /// <msdn-id>bb174251</msdn-id> /// <unmanaged>HRESULT ID3DXSprite::Draw([In] IDirect3DTexture9* pTexture,[In] const RECT* pSrcRect,[In] const D3DXVECTOR3* pCenter,[In] const D3DXVECTOR3* pPosition,[In] D3DCOLOR Color)</unmanaged> /// <unmanaged-short>ID3DXSprite::Draw</unmanaged-short> public unsafe void Draw(SharpDX.Direct3D9.Texture textureRef, RawColorBGRA color, RawRectangle? srcRectRef = null, RawVector3? centerRef = null, RawVector3? positionRef = null) { RawRectangle localRect = default(RawRectangle); RawVector3 localCenter; RawVector3 localPosition; if (srcRectRef.HasValue) localRect = srcRectRef.Value; if (centerRef.HasValue) localCenter = centerRef.Value; if (positionRef.HasValue) localPosition = positionRef.Value; Draw(textureRef, srcRectRef.HasValue ? (IntPtr)(void*)&localRect : IntPtr.Zero, centerRef.HasValue ? (IntPtr)(void*)&localCenter : IntPtr.Zero, positionRef.HasValue ? (IntPtr)(void*)&localPosition : IntPtr.Zero, color); }
/// <summary> /// Initializes a new instance of the <see cref="RawPlane"/> struct. /// </summary> /// <param name="normal">The plane normal.</param> /// <param name="d">The plance distance.</param> public RawPlane(RawVector3 normal, float d) { Normal = normal; D = d; }
/// <summary> /// Gets an array of <see cref="RawVector3"/> from a <see cref="DataStream"/>. /// </summary> /// <param name="stream">The stream.</param> /// <param name="vertexCount">The vertex count.</param> /// <param name="stride">The stride.</param> /// <returns>An array of <see cref="RawVector3"/> </returns> public static RawVector3[] GetVectors(DataStream stream, int vertexCount, int stride) { unsafe { var results = new RawVector3[vertexCount]; for (int i = 0; i < vertexCount; i++) { results[i] = stream.Read<RawVector3>(); stream.Position += stride - sizeof(RawVector3); } return results; } }
private static unsafe Result Fill3DCallbackImpl(RawColor4* outVector, RawVector3* textCoord, RawVector3* textelSize, IntPtr data) { try { var handle = GCHandle.FromIntPtr(data); *outVector = ((Fill3DCallback)handle.Target)(*textCoord, *textelSize); } catch (SharpDXException exception) { return exception.ResultCode.Code; } catch (Exception) { return Result.Fail.Code; } return Result.Ok.Code; }