Exemple #1
0
 public static extern void bgfx_vertex_pack(float* input, [MarshalAs(UnmanagedType.U1)] bool inputNormalized, VertexAttributeUsage attribute, ref VertexLayout.Data decl, IntPtr data, int index);
Exemple #2
0
 /// <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);
 }
Exemple #3
0
 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);
Exemple #4
0
 /// <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);
 }
Exemple #5
0
 /// <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);
 }
Exemple #6
0
 public static extern void bgfx_vertex_pack(float *input, [MarshalAs(UnmanagedType.U1)] bool inputNormalized, VertexAttributeUsage attribute, ref VertexLayout.Data decl, IntPtr data, int index);
Exemple #7
0
 public VertexAttributeCtr(EndianBinaryReader er)
 {
     Type = er.ReadUInt32();
     Usage = (VertexAttributeUsage)er.ReadUInt32();
     Flags = (VertexAttributeFlags)er.ReadUInt32();
 }
Exemple #8
0
 /// <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;
 }
Exemple #9
0
 /// <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);
 }
Exemple #10
0
 /// <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;
 }
Exemple #11
0
 /// <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];
 }
Exemple #12
0
 /// <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);
 }
Exemple #13
0
 /// <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);
 }
Exemple #14
0
 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;
 }
Exemple #15
0
 public static extern void bgfx_vertex_unpack(float* output, VertexAttributeUsage attribute, ref VertexLayout.Data decl, IntPtr data, int index);
Exemple #16
0
 /// <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);
 }
Exemple #17
0
 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);
Exemple #18
0
 /// <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]);
 }
Exemple #19
0
 public static extern void bgfx_vertex_unpack(float *output, VertexAttributeUsage attribute, ref VertexLayout.Data decl, IntPtr data, int index);
Exemple #20
0
 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;
 }