public static extern void bgfx_vertex_pack(float* input, [MarshalAs(UnmanagedType.U1)] bool inputNormalized, VertexAttributeUsage attribute, ref VertexLayout.Data decl, IntPtr data, int index);
/// <summary> /// Unpack a vector from a vertex stream. /// </summary> /// <param name="output">A pointer to four floats that will receive the unpacked vector.</param> /// <param name="attribute">The usage of the vertex attribute.</param> /// <param name="layout">The layout of the vertex stream.</param> /// <param name="data">A pointer to the vertex data stream.</param> /// <param name="index">The index of the vertex within the stream.</param> public static void VertexUnpack(float *output, VertexAttributeUsage attribute, VertexLayout layout, IntPtr data, int index = 0) { NativeMethods.bgfx_vertex_unpack(output, attribute, ref layout.data, data, index); }
public static extern void bgfx_vertex_decl_add(ref VertexLayout.Data decl, VertexAttributeUsage attribute, byte count, VertexAttributeType type, [MarshalAs(UnmanagedType.U1)] bool normalized, [MarshalAs(UnmanagedType.U1)] bool asInt);
/// <summary> /// Determines whether the layout contains the given attribute. /// </summary> /// <param name="attribute">The attribute to check/</param> /// <returns><c>true</c> if the layout contains the attribute; otherwise, <c>false</c>.</returns> public unsafe bool HasAttribute(VertexAttributeUsage attribute) { fixed(Data *ptr = &data) return(ptr->Attributes[(int)attribute] != ushort.MaxValue); }
/// <summary> /// Packs a vector into vertex stream format. /// </summary> /// <param name="input">The four element vector to pack.</param> /// <param name="inputNormalized"><c>true</c> if the input vector is normalized.</param> /// <param name="attribute">The attribute usage of the vector data.</param> /// <param name="layout">The layout of the vertex stream.</param> /// <param name="data">The pointer to the vertex data stream.</param> /// <param name="index">The index of the vertex within the stream.</param> public static void VertexPack(float *input, bool inputNormalized, VertexAttributeUsage attribute, VertexLayout layout, IntPtr data, int index = 0) { NativeMethods.bgfx_vertex_pack(input, inputNormalized, attribute, ref layout.data, data, index); }
public static extern void bgfx_vertex_pack(float *input, [MarshalAs(UnmanagedType.U1)] bool inputNormalized, VertexAttributeUsage attribute, ref VertexLayout.Data decl, IntPtr data, int index);
public VertexAttributeCtr(EndianBinaryReader er) { Type = er.ReadUInt32(); Usage = (VertexAttributeUsage)er.ReadUInt32(); Flags = (VertexAttributeFlags)er.ReadUInt32(); }
/// <summary> /// Determines whether the layout contains the given attribute. /// </summary> /// <param name="attribute">The attribute to check/</param> /// <returns><c>true</c> if the layout contains the attribute; otherwise, <c>false</c>.</returns> public unsafe bool HasAttribute(VertexAttributeUsage attribute) { fixed (Data* ptr = &data) return ptr->Attributes[(int)attribute] != 0xff; }
/// <summary> /// Determines whether the layout contains the given attribute. /// </summary> /// <param name="attribute">The attribute to check/</param> /// <returns><c>true</c> if the layout contains the attribute; otherwise, <c>false</c>.</returns> public unsafe bool HasAttribute(VertexAttributeUsage attribute) { fixed(Data *ptr = &data) return(ptr->Attributes[(int)attribute] != 0xff); }
/// <summary> /// Starts a stream of vertex attribute additions to the layout. /// </summary> /// <param name="attribute">The kind of attribute to add.</param> /// <param name="count">The number of elements in the attribute (1, 2, 3, or 4).</param> /// <param name="type">The type of data described by the attribute.</param> /// <param name="normalized">if set to <c>true</c>, values will be normalized from a 0-255 range to 0.0 - 0.1 in the shader.</param> /// <param name="asInt">if set to <c>true</c>, the attribute is packaged as an integer in the shader.</param> /// <returns> /// This instance, for use in a fluent API. /// </returns> public VertexLayout Add(VertexAttributeUsage attribute, int count, VertexAttributeType type, bool normalized = false, bool asInt = false) { NativeMethods.bgfx_vertex_decl_add(ref data, attribute, (byte)count, type, normalized, asInt); return this; }
/// <summary> /// Gets the byte offset of a particular attribute in the layout. /// </summary> /// <param name="attribute">The attribute for which to get the offset.</param> /// <returns>The offset of the attribute, in bytes.</returns> public unsafe int GetOffset(VertexAttributeUsage attribute) { fixed (Data* ptr = &data) return ptr->Offset[(int)attribute]; }
/// <summary> /// Unpack a vector from a vertex stream. /// </summary> /// <param name="output">A pointer to four floats that will receive the unpacked vector.</param> /// <param name="attribute">The usage of the vertex attribute.</param> /// <param name="layout">The layout of the vertex stream.</param> /// <param name="data">A pointer to the vertex data stream.</param> /// <param name="index">The index of the vertex within the stream.</param> public static void VertexUnpack(float* output, VertexAttributeUsage attribute, VertexLayout layout, IntPtr data, int index = 0) { NativeMethods.bgfx_vertex_unpack(output, attribute, ref layout.data, data, index); }
/// <summary> /// Packs a vector into vertex stream format. /// </summary> /// <param name="input">The four element vector to pack.</param> /// <param name="inputNormalized"><c>true</c> if the input vector is normalized.</param> /// <param name="attribute">The attribute usage of the vector data.</param> /// <param name="layout">The layout of the vertex stream.</param> /// <param name="data">The pointer to the vertex data stream.</param> /// <param name="index">The index of the vertex within the stream.</param> public static void VertexPack(float* input, bool inputNormalized, VertexAttributeUsage attribute, VertexLayout layout, IntPtr data, int index = 0) { NativeMethods.bgfx_vertex_pack(input, inputNormalized, attribute, ref layout.data, data, index); }
public VertexParamAttributeCtr(VertexAttributeUsage Usage, params Single[] Attributes) : base() { Type = 0x80000000; Flags = VertexAttributeFlags.VertexParam; this.Usage = Usage; FormatType = DataType.GL_FLOAT; Scale = 1; NrAttributes = (uint)Attributes.Length; this.Attributes = Attributes; }
public static extern void bgfx_vertex_unpack(float* output, VertexAttributeUsage attribute, ref VertexLayout.Data decl, IntPtr data, int index);
/// <summary> /// Starts a stream of vertex attribute additions to the layout. /// </summary> /// <param name="attribute">The kind of attribute to add.</param> /// <param name="count">The number of elements in the attribute (1, 2, 3, or 4).</param> /// <param name="type">The type of data described by the attribute.</param> /// <param name="normalized">if set to <c>true</c>, values will be normalized from a 0-255 range to 0.0 - 0.1 in the shader.</param> /// <param name="asInt">if set to <c>true</c>, the attribute is packaged as an integer in the shader.</param> /// <returns> /// This instance, for use in a fluent API. /// </returns> public VertexLayout Add(VertexAttributeUsage attribute, int count, VertexAttributeType type, bool normalized = false, bool asInt = false) { NativeMethods.bgfx_vertex_layout_add(ref data, attribute, (byte)count, type, normalized, asInt); return(this); }
/// <summary> /// Gets the byte offset of a particular attribute in the layout. /// </summary> /// <param name="attribute">The attribute for which to get the offset.</param> /// <returns>The offset of the attribute, in bytes.</returns> public unsafe int GetOffset(VertexAttributeUsage attribute) { fixed(Data *ptr = &data) return(ptr->Offset[(int)attribute]); }
public static extern void bgfx_vertex_unpack(float *output, VertexAttributeUsage attribute, ref VertexLayout.Data decl, IntPtr data, int index);
public VertexStreamCtr(VertexAttributeUsage Usage, DataType FormatType, int NrComponents, int Offset, Single Scale = 1) : base() { Type = 0x40000001; Flags = 0; this.Usage = Usage; this.FormatType = FormatType; this.NrComponents = (uint)NrComponents; this.Scale = Scale; this.Offset = (uint)Offset; }