public static int GetGLType(VertexElementType type) { switch (type) { case VertexElementType.Float1: case VertexElementType.Float2: case VertexElementType.Float3: case VertexElementType.Float4: return(Gl.GL_FLOAT); case VertexElementType.Short1: case VertexElementType.Short2: case VertexElementType.Short3: case VertexElementType.Short4: return(Gl.GL_SHORT); case VertexElementType.Color: case VertexElementType.Color_ABGR: case VertexElementType.Color_ARGB: case VertexElementType.UByte4: return(Gl.GL_UNSIGNED_BYTE); default: return(0); } ; }
/// <summary> /// /// </summary> /// <param name="type"></param> /// <returns></returns> public static int ConvertEnum(VertexElementType type) { switch (type) { case VertexElementType.Float1: case VertexElementType.Float2: case VertexElementType.Float3: case VertexElementType.Float4: return(Gl.GL_FLOAT); case VertexElementType.Short1: case VertexElementType.Short2: case VertexElementType.Short3: case VertexElementType.Short4: return(Gl.GL_SHORT); case VertexElementType.Color: case VertexElementType.Color_ABGR: case VertexElementType.Color_ARGB: case VertexElementType.UByte4: return(Gl.GL_UNSIGNED_BYTE); } // should never reach this return(0); }
/// <summary> /// Adds a new VertexElement to this declaration. /// </summary> /// <remarks> /// This method adds a single element (positions, normals etc) to the /// vertex declaration. <b>Please read the information in <see cref="VertexDeclaration"/> about /// the importance of ordering and structure for compatibility with older D3D drivers</b>. /// </remarks> /// <param name="source"> /// The binding index of HardwareVertexBuffer which will provide the source for this element. /// </param> /// <param name="offset">The offset in bytes where this element is located in the buffer.</param> /// <param name="type">The data format of the element (3 floats, a color etc).</param> /// <param name="semantic">The meaning of the data (position, normal, diffuse color etc).</param> /// <param name="index">Optional index for multi-input elements like texture coordinates.</param> public virtual VertexElement AddElement(ushort source, int offset, VertexElementType type, VertexElementSemantic semantic, int index) { VertexElement element = new VertexElement(source, offset, type, semantic, index); elements.Add(element); return(element); }
private static bool ShaderVarMatches(ref ShaderFieldInfo varInfo, VertexElementType type, int count) { if (varInfo.Scope != ShaderFieldScope.Attribute) { return(false); } Type elementPrimitive = varInfo.Type.GetElementPrimitive(); Type requiredPrimitive = null; switch (type) { case VertexElementType.Byte: requiredPrimitive = typeof(byte); break; case VertexElementType.Float: requiredPrimitive = typeof(float); break; } if (elementPrimitive != requiredPrimitive) { return(false); } int elementCount = varInfo.Type.GetElementCount(); if (count != elementCount * varInfo.ArrayLength) { return(false); } return(true); }
public VertexElement(VertexElementType type, int count, int offset, int stride) { this.Type = type; this.Count = count; this.Offset = offset; this.Stride = stride; }
private static VertexElementUsage ConvertVertexUsage(VertexElementType elementType) { switch (elementType) { case VertexElementType.Position2D: case VertexElementType.Position3D: return VertexElementUsage.Position; case VertexElementType.Normal: return VertexElementUsage.Normal; case VertexElementType.Tangent: return VertexElementUsage.Tangent; case VertexElementType.Color: return VertexElementUsage.Color; case VertexElementType.TextureUV: case VertexElementType.TextureUVW: case VertexElementType.LightMapUV: case VertexElementType.ExtraUV: return VertexElementUsage.TextureCoordinate; case VertexElementType.SkinIndices: return VertexElementUsage.BlendIndices; case VertexElementType.SkinWeights: return VertexElementUsage.BlendWeight; default: throw new ElementUsageNotSupported(elementType); } }
internal VertexElement(string fieldName, IntPtr offset, VertexElementType type, int count) { this.fieldName = fieldName; this.offset = offset; this.type = type; this.count = count; }
public override void ModifyElement(int elemIndex, short source, int offset, VertexElementType type, VertexElementSemantic semantic, int index) { base.ModifyElement(elemIndex, source, offset, type, semantic, index); needsRebuild = true; }
private static VertexElementUsage ConvertVertexUsage(VertexElementType elementType) { switch (elementType) { case VertexElementType.Position2D: case VertexElementType.Position3D: return(VertexElementUsage.Position); case VertexElementType.Normal: return(VertexElementUsage.Normal); case VertexElementType.Tangent: return(VertexElementUsage.Tangent); case VertexElementType.Color: return(VertexElementUsage.Color); case VertexElementType.TextureUV: case VertexElementType.TextureUVW: case VertexElementType.LightMapUV: case VertexElementType.ExtraUV: return(VertexElementUsage.TextureCoordinate); case VertexElementType.SkinIndices: return(VertexElementUsage.BlendIndices); case VertexElementType.SkinWeights: return(VertexElementUsage.BlendWeight); default: throw new ElementUsageNotSupported(elementType); } }
public void CreationWithInvalidTypeThrows() { const VertexElementType InvalidType = (VertexElementType)0; Assert.Throws <VertexElement.ElementTypeNotYetSupported>( () => new VertexElement(InvalidType)); }
public VertexElement(ushort source, uint offset, VertexElementType theType, VertexElementSemantic semantic) : this(OgrePINVOKE.new_VertexElement__SWIG_2(source, offset, (int)theType, (int)semantic), true) { if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
internal VertexElement(IntPtr offset, VertexElementType type, int count, VertexElementRole role) { this.offset = offset; this.type = type; this.count = count; this.role = role; }
public static D3D.DeclarationType ConvertEnum(VertexElementType type) { // we only need to worry about a few types with D3D switch (type) { case VertexElementType.Color: return(D3D.DeclarationType.Color); case VertexElementType.Float1: return(D3D.DeclarationType.Float1); case VertexElementType.Float2: return(D3D.DeclarationType.Float2); case VertexElementType.Float3: return(D3D.DeclarationType.Float3); case VertexElementType.Float4: return(D3D.DeclarationType.Float4); case VertexElementType.Short2: return(D3D.DeclarationType.Short2); case VertexElementType.Short4: return(D3D.DeclarationType.Short4); case VertexElementType.UByte4: return(D3D.DeclarationType.Ubyte4); } // switch // keep the compiler happy return(D3D.DeclarationType.Float3); }
private static bool ShaderVarMatches(ref ShaderFieldInfo varInfo, VertexElementType type, int count) { //if (varInfo.Scope != ShaderFieldScope.Attribute) return false; Type elementPrimitive = varInfo.Type.GetElementPrimitive(); Type requiredPrimitive = null; switch (type) { case VertexElementType.Byte: requiredPrimitive = typeof(byte); break; case VertexElementType.Float: requiredPrimitive = typeof(float); break; } // ToDo: Bugfix to allow Color (byte to float) conversion if (elementPrimitive != requiredPrimitive && !(elementPrimitive == typeof(float) && requiredPrimitive == typeof(byte))) { return(false); } int elementCount = varInfo.Type.GetElementCount(); if (count != elementCount * varInfo.ArrayLength) { return(false); } return(true); }
public VertexElement(VertexElementUsage usage, int usageIndex, VertexElementType type) : this() { this.Usage = usage; this.UsageIndex = usageIndex; this.Type = type; }
public override Axiom.Graphics.VertexElement InsertElement(int position, short source, int offset, VertexElementType type, VertexElementSemantic semantic, int index) { _releaseDeclaration(); return(base.InsertElement(position, source, offset, type, semantic, index)); }
private static VertexElementFormat ConvertVertexType(VertexElementType elementType) { switch (elementType) { case VertexElementType.Position2D: case VertexElementType.TextureUV: case VertexElementType.LightMapUV: case VertexElementType.ExtraUV: return(VertexElementFormat.Vector2); case VertexElementType.Position3D: case VertexElementType.Normal: case VertexElementType.Tangent: case VertexElementType.TextureUVW: return(VertexElementFormat.Vector3); case VertexElementType.Color: return(VertexElementFormat.Color); case VertexElementType.SkinIndices: return(VertexElementFormat.Short2); case VertexElementType.SkinWeights: return(VertexElementFormat.NormalizedShort2); default: throw new ElementTypeNotSupported(elementType); } }
public static All GetGLType(VertexElementType type) { switch (type) { case VertexElementType.Float1: case VertexElementType.Float2: case VertexElementType.Float3: case VertexElementType.Float4: return(All.Float); case VertexElementType.Short1: case VertexElementType.Short2: case VertexElementType.Short3: case VertexElementType.Short4: return(All.Short); case VertexElementType.Color: case VertexElementType.Color_ARGB: case VertexElementType.Color_ABGR: case VertexElementType.UByte4: return(All.UnsignedByte); default: return(0); } }
public virtual VertexElement AddElement(VertexElementType theType, VertexElementSemantic semantic) { VertexElement ve = mSubMesh.vertexData.vertexDeclaration.AddElement(0, offset, theType, semantic); offset += VertexElement.GetTypeSize(theType); return(ve); }
public void modifyElement(ushort elem_index, ushort source, uint offset, VertexElementType theType, VertexElementSemantic semantic) { OgrePINVOKE.VertexDeclaration_modifyElement__SWIG_1(swigCPtr, elem_index, source, offset, (int)theType, (int)semantic); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public static void convertColourValue(VertexElementType srcType, VertexElementType dstType, SWIGTYPE_p_unsigned_int ptr) { OgrePINVOKE.VertexElement_convertColourValue__SWIG_0((int)srcType, (int)dstType, SWIGTYPE_p_unsigned_int.getCPtr(ptr)); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public VertexElementLayout(int stream, int offset, VertexElementType type, VertexElementUsage usage, int usageIndex) { Stream = stream; Offset = offset; Type = type; Usage = usage; UsageIndex = usageIndex; }
public BufferBindingBuilder AddElement( VertexElementType type, VertexElementSemantic semantic, byte semanticIndex = 0 ) { var elemIdx = mBinding._elementCount++; ref var elem = ref mBinding._elements[elemIdx];
public void convertPackedColour(VertexElementType srcType, VertexElementType destType) { OgrePINVOKE.VertexData_convertPackedColour(swigCPtr, (int)srcType, (int)destType); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public VertexElement(int slot, int elems, VertexElementType type, bool normalized, int offset) { Slot = slot; Elements = elems; Type = type; Normalized = normalized; Offset = offset; }
public override Axiom.Graphics.VertexElement InsertElement( int position, short source, int offset, VertexElementType type, VertexElementSemantic semantic, int index ) { Axiom.Graphics.VertexElement element = base.InsertElement( position, source, offset, type, semantic, index ); needsRebuild = true; return element; }
public VertexElement( short source, int offset, VertexElementType type, VertexElementSemantic semantic, int index ) { this.source = source; this.offset = offset; this.type = type; this.semantic = semantic; this.index = index; }
//int index; public VertexElement(int source, int offset, VertexElementType type, VertexElementSemantic semantic) //, int index = 0 ) { this.source = source; this.offset = offset; this.type = type; this.semantic = semantic; //this.index = index; }
public virtual VertexElement AddElement(ushort source, VertexElementType theType, VertexElementSemantic semantic) { VertexElement ve = mSubMesh.vertexData.vertexDeclaration.AddElement(source, offset, theType, semantic); offset += VertexElement.GetTypeSize(theType); return ve; }
public override Axiom.Graphics.VertexElement AddElement( short source, int offset, VertexElementType type, VertexElementSemantic semantic, int index ) { Axiom.Graphics.VertexElement element = base.AddElement( source, offset, type, semantic, index ); needsRebuild = true; return element; }
/// <summary> /// Constructor. /// </summary> /// <param name="source">The source vertex buffer, as bound to an index using <see cref="VertexBufferBinding"/>.</param> /// <param name="offset">The offset in the buffer that this element starts at.</param> /// <param name="type">The type of element.</param> /// <param name="semantic">The meaning of the element.</param> /// <param name="index">Index of the item, only applicable for some elements like texture coords.</param> public VertexElement(ushort source, int offset, VertexElementType type, VertexElementSemantic semantic, int index) { this.source = source; this.offset = offset; this.type = type; this.semantic = semantic; this.index = index; }
public void GetAsVec2(Mesh mesh, List <int> subMeshIndices, ref Vector2[] outData) { VertexElementType elType = (VertexElementType)m_elType; Vector2[] data = null; switch (elType) { case VertexElementType.kPosition: VertexBakerLib.LogError("Type Not Supported: " + elType); break; case VertexElementType.kNormal: VertexBakerLib.LogError("Type Not Supported: " + elType); break; case VertexElementType.kTangent: VertexBakerLib.LogError("Type Not Supported: " + elType); break; case VertexElementType.kColor: VertexBakerLib.LogError("Type Not Supported: " + elType); break; case VertexElementType.kUV0: data = mesh.uv; break; case VertexElementType.kUV1: data = mesh.uv2; break; case VertexElementType.kUV2: data = mesh.uv3; break; case VertexElementType.kUV3: data = mesh.uv4; break; default: VertexBakerLib.LogError("Type Not Supported: " + elType); outData = null; break; } if (subMeshIndices != null) { outData = new Vector2[subMeshIndices.Count]; for (int i = 0, k = subMeshIndices.Count; i < k; ++i) { outData[i] = data[subMeshIndices[i]]; } } else { outData = data; } }
internal static ActiveAttribType Convert(VertexElementType type) { if (!attribTypes.ContainsKey(type)) { throw new NotSupportedException("type is not supported"); } return(attribTypes[type]); }
public override VertexElement AddElement(short source, int offset, VertexElementType type, VertexElementSemantic semantic, int index) { var element = base.AddElement(source, offset, type, semantic, index); needsRebuild = true; return(element); }
/// <summary> /// Adds a vertex element to the vertexData and allocates the vertex /// buffer and populates it with the information in the data array. /// This variant uses the data in the mesh to determine appropriate /// settings for the vertexBufferUsage and useVertexShadowBuffer /// parameters. /// </summary> /// <param name="vertexData"> /// the vertex data object whose vertex declaration and buffer /// bindings must be modified to include the reference to the new /// buffer /// </param> /// <param name="type">the type of vertex element being added</param> /// <param name="semantic">the semantic of the element being added</param> /// <param name="bindIdx">the index that will be used for this buffer</param> /// <param name="index">the texture index to which this buffer will apply (or 0)</param> /// <param name="data">the raw data that will be used to populate the buffer</param> internal void AllocateBuffer(VertexData vertexData, VertexElementType type, VertexElementSemantic semantic, ushort bindIdx, int index, int[] data) { AllocateBuffer(vertexData, type, semantic, bindIdx, index, data, m_AxiomMesh.VertexBufferUsage, m_AxiomMesh.UseVertexShadowBuffer); }
private VertexDeclaration(Type dataType, int typeIndex) { TypeInfo dataTypeInfo = dataType.GetTypeInfo(); if (dataTypeInfo.IsClass) { throw new InvalidOperationException("Vertex formats need to be structs. Classes are not supported."); } FieldInfo[] fields = dataTypeInfo.DeclaredFieldsDeep().Where(m => !m.IsStatic).ToArray(); this.dataType = dataType; this.typeIndex = typeIndex; this.size = Marshal.SizeOf(dataType); this.elements = new VertexElement[fields.Length]; for (int i = 0; i < fields.Length; i++) { VertexElementRole role = VertexElementRole.Unknown; VertexElementType type = VertexElementType.Unknown; int count = 0; VertexElementAttribute attrib = fields[i].GetAttributesCached <VertexElementAttribute>().FirstOrDefault(); if (attrib != null) { role = attrib.Role; type = attrib.Type; count = attrib.Count; } if (type == VertexElementType.Unknown || count == 0) { DetermineElement(fields[i].FieldType, out type, out count); } if (type == VertexElementType.Unknown || count == 0) { throw new InvalidOperationException(string.Format("Unable to determine type of field {2}, vertex format {1}. Add a {0} to specify it explicitly", typeof(VertexElementAttribute).Name, dataType.Name, fields[i].Name)); } this.elements[i] = new VertexElement( Marshal.OffsetOf(dataType, fields[i].Name), type, count, role); } // Add this declaration to the static by-TypeIndex lookup while (delcarationByIndex.Count <= this.typeIndex) { delcarationByIndex.Add(null); } delcarationByIndex[this.typeIndex] = this; }
/// <summary> /// /// </summary> /// <param name="type"></param> /// <returns></returns> public static int ConvertEnum(VertexElementType type) { switch(type) { case VertexElementType.Float1: case VertexElementType.Float2: case VertexElementType.Float3: case VertexElementType.Float4: return Gl.GL_FLOAT; case VertexElementType.Short1: case VertexElementType.Short2: case VertexElementType.Short3: case VertexElementType.Short4: return Gl.GL_SHORT; case VertexElementType.Color: case VertexElementType.UByte4: return Gl.GL_UNSIGNED_BYTE; } // should never reach this return 0; }
private static VertexElementFormat ConvertVertexType(VertexElementType elementType) { switch (elementType) { case VertexElementType.Position2D: case VertexElementType.TextureUV: case VertexElementType.LightMapUV: case VertexElementType.ExtraUV: return VertexElementFormat.Vector2; case VertexElementType.Position3D: case VertexElementType.Normal: case VertexElementType.Tangent: case VertexElementType.TextureUVW: return VertexElementFormat.Vector3; case VertexElementType.Color: return VertexElementFormat.Color; case VertexElementType.SkinIndices: return VertexElementFormat.Short2; case VertexElementType.SkinWeights: return VertexElementFormat.NormalizedShort2; default: throw new ElementTypeNotSupported(elementType); } }
public virtual VertexElement InsertElement( int position, short source, int offset, VertexElementType type, VertexElementSemantic semantic, int index ) { if ( position >= elements.Count ) { return AddElement( source, offset, type, semantic, index ); } VertexElement element = new VertexElement( source, offset, type, semantic, index ); elements.Insert( position, element ); return element; }
/// <summary> /// Constructor. /// </summary> /// <param name="source">The source vertex buffer, as bound to an index using <see cref="VertexBufferBinding"/>.</param> /// <param name="offset">The offset in the buffer that this element starts at.</param> /// <param name="type">The type of element.</param> /// <param name="semantic">The meaning of the element.</param> public VertexElement( short source, int offset, VertexElementType type, VertexElementSemantic semantic ) : this( source, offset, type, semantic, 0 ) { }
public static int ConvertColorValue( ColorEx color, VertexElementType colorVertexElementType ) { switch (colorVertexElementType) { #if AXIOM_PLATFORM == AXIOM_PLATFORM_WIN32 default: #endif case VertexElementType.Color_ARGB: return color.ToARGB(); #if AXIOM_PLATFORM != OGRE_PLATFORM_WIN32 default: #endif case VertexElementType.Color_ABGR: return color.ToABGR(); } }
/// <summary> /// Returns proper enum for a base type multiplied by a value. This is helpful /// when working with tex coords especially since you might not know the number /// of texture dimensions at runtime, and when creating the VertexBuffer you will /// have to get a VertexElementType based on that amount to creating the VertexElement. /// </summary> /// <param name="type">Data type.</param> /// <param name="count">Multiplier.</param> /// <returns> /// A <see cref="VertexElementType"/> that represents the requested type and count. /// </returns> /// <example> /// MultiplyTypeCount(VertexElementType.Float1, 3) returns VertexElementType.Float3. /// </example> public static VertexElementType MultiplyTypeCount( VertexElementType type, int count ) { switch ( type ) { case VertexElementType.Float1: switch ( count ) { case 1: return VertexElementType.Float1; case 2: return VertexElementType.Float2; case 3: return VertexElementType.Float3; case 4: return VertexElementType.Float4; } break; case VertexElementType.Short1: switch ( count ) { case 1: return VertexElementType.Short1; case 2: return VertexElementType.Short2; case 3: return VertexElementType.Short3; case 4: return VertexElementType.Short4; } break; } throw new Exception( "Cannot multiply base vertex element type: " + type.ToString() ); }
public override void ModifyElement( int elemIndex, short source, int offset, VertexElementType type, VertexElementSemantic semantic, int index ) { base.ModifyElement( elemIndex, source, offset, type, semantic, index ); needsRebuild = true; }
public static XFG.VertexElementFormat Convert( VertexElementType type, bool tex ) { // if (tex) // return XFG.Graphics.VertexElementFormat.Unused; // we only need to worry about a few types with Xna switch ( type ) { case VertexElementType.Color: return XFG.VertexElementFormat.Color; case VertexElementType.Float1: return XFG.VertexElementFormat.Single; case VertexElementType.Float2: return XFG.VertexElementFormat.Vector2; case VertexElementType.Float3: return XFG.VertexElementFormat.Vector3; case VertexElementType.Float4: return XFG.VertexElementFormat.Vector4; case VertexElementType.Short2: return XFG.VertexElementFormat.Short2; //case VertexElementType.Short3: //return XFG.VertexElementFormat.Short2; case VertexElementType.Short4: return XFG.VertexElementFormat.Short4; case VertexElementType.UByte4: return XFG.VertexElementFormat.Byte4; } // switch // keep the compiler happy return XFG.VertexElementFormat.Vector3;// Float3; }
public virtual void ModifyElement( int elemIndex, short source, int offset, VertexElementType type, VertexElementSemantic semantic, int index ) { elements[ elemIndex ] = new VertexElement( source, offset, type, semantic, index ); }
public void ModifyElement( int elemIndex, short source, int offset, VertexElementType type, VertexElementSemantic semantic ) { ModifyElement( elemIndex, source, offset, type, semantic, 0 ); }
/// <summary> /// /// </summary> /// <param name="type"></param> /// <returns></returns> public static All GetGLType( VertexElementType type ) { switch ( type ) { case VertexElementType.Float1: case VertexElementType.Float2: case VertexElementType.Float3: case VertexElementType.Float4: return All.Float; case VertexElementType.Short1: case VertexElementType.Short2: case VertexElementType.Short3: case VertexElementType.Short4: return All.Short; case VertexElementType.Color: case VertexElementType.Color_ABGR: case VertexElementType.Color_ARGB: case VertexElementType.UByte4: return All.UnsignedByte; default: return 0; } }
public static int GetTypeCount( VertexElementType type ) { switch ( type ) { case VertexElementType.Color: return 1; case VertexElementType.Float1: return 1; case VertexElementType.Float2: return 2; case VertexElementType.Float3: return 3; case VertexElementType.Float4: return 4; case VertexElementType.Short1: return 1; case VertexElementType.Short2: return 2; case VertexElementType.Short3: return 3; case VertexElementType.Short4: return 4; case VertexElementType.UByte4: return 4; } return 0; }
public static int GetGLType( VertexElementType type ) { switch ( type ) { case VertexElementType.Float1: case VertexElementType.Float2: case VertexElementType.Float3: case VertexElementType.Float4: return Gl.GL_FLOAT; case VertexElementType.Short1: case VertexElementType.Short2: case VertexElementType.Short3: case VertexElementType.Short4: return Gl.GL_SHORT; case VertexElementType.Color: case VertexElementType.Color_ABGR: case VertexElementType.Color_ARGB: case VertexElementType.UByte4: return Gl.GL_UNSIGNED_BYTE; default: return 0; } ; }
public VertexElement AddElement( short source, int offset, VertexElementType type, VertexElementSemantic semantic ) { return AddElement( source, offset, type, semantic, 0 ); }
public VertexElement InsertElement( int position, short source, int offset, VertexElementType type, VertexElementSemantic semantic ) { return InsertElement( position, source, offset, type, semantic, 0 ); }
public virtual VertexElement AddElement( short source, int offset, VertexElementType type, VertexElementSemantic semantic, int index ) { VertexElement element = new VertexElement( source, offset, type, semantic, index ); elements.Add( element ); return element; }
public static D3D.DeclarationType ConvertEnum( VertexElementType type ) { // we only need to worry about a few types with D3D switch ( type ) { case VertexElementType.Color_ABGR: case VertexElementType.Color_ARGB: case VertexElementType.Color: return D3D.DeclarationType.Color; case VertexElementType.Float1: return D3D.DeclarationType.Float1; case VertexElementType.Float2: return D3D.DeclarationType.Float2; case VertexElementType.Float3: return D3D.DeclarationType.Float3; case VertexElementType.Float4: return D3D.DeclarationType.Float4; case VertexElementType.Short2: return D3D.DeclarationType.Short2; case VertexElementType.Short4: return D3D.DeclarationType.Short4; case VertexElementType.UByte4: return D3D.DeclarationType.Ubyte4; } // switch // keep the compiler happy return D3D.DeclarationType.Float3; }
/// <summary> /// Utility method for helping to calculate offsets. /// </summary> public static int GetTypeSize( VertexElementType type ) { switch ( type ) { case VertexElementType.Color_ABGR: case VertexElementType.Color_ARGB: case VertexElementType.Color: return Marshal.SizeOf( typeof( int ) ); case VertexElementType.Float1: return Marshal.SizeOf( typeof( float ) ); case VertexElementType.Float2: return Marshal.SizeOf( typeof( float ) ) * 2; case VertexElementType.Float3: return Marshal.SizeOf( typeof( float ) ) * 3; case VertexElementType.Float4: return Marshal.SizeOf( typeof( float ) ) * 4; case VertexElementType.Short1: return Marshal.SizeOf( typeof( short ) ); case VertexElementType.Short2: return Marshal.SizeOf( typeof( short ) ) * 2; case VertexElementType.Short3: return Marshal.SizeOf( typeof( short ) ) * 3; case VertexElementType.Short4: return Marshal.SizeOf( typeof( short ) ) * 4; case VertexElementType.UByte4: return Marshal.SizeOf( typeof( byte ) ) * 4; } // end switch // keep the compiler happy return 0; }
public static GLenum GetGLType( VertexElementType type ) { return GLES2HardwareBufferManagerBase.GetGLType( type ); }
/// <summary> /// Utility method which returns the count of values in a given type. /// </summary> public static int GetTypeCount( VertexElementType type ) { switch ( type ) { case VertexElementType.Color_ABGR: case VertexElementType.Color_ARGB: case VertexElementType.Color: return 1; case VertexElementType.Float1: return 1; case VertexElementType.Float2: return 2; case VertexElementType.Float3: return 3; case VertexElementType.Float4: return 4; case VertexElementType.Short1: return 1; case VertexElementType.Short2: return 2; case VertexElementType.Short3: return 3; case VertexElementType.Short4: return 4; case VertexElementType.UByte4: return 4; } // end switch // keep the compiler happy return 0; }
public virtual VertexElement AddElement(VertexElementType theType, VertexElementSemantic semantic) { return this.AddElement((ushort)0, theType, semantic); }
public static int GetTypeSize( VertexElementType type ) { switch ( type ) { case VertexElementType.Color: return Marshal.SizeOf( typeof( int ) ); case VertexElementType.Float1: return Marshal.SizeOf( typeof( float ) ); case VertexElementType.Float2: return Marshal.SizeOf( typeof( float ) ) * 2; case VertexElementType.Float3: return Marshal.SizeOf( typeof( float ) ) * 3; case VertexElementType.Float4: return Marshal.SizeOf( typeof( float ) ) * 4; case VertexElementType.Short1: return Marshal.SizeOf( typeof( short ) ); case VertexElementType.Short2: return Marshal.SizeOf( typeof( short ) ) * 2; case VertexElementType.Short3: return Marshal.SizeOf( typeof( short ) ) * 3; case VertexElementType.Short4: return Marshal.SizeOf( typeof( short ) ) * 4; case VertexElementType.UByte4: return Marshal.SizeOf( typeof( byte ) ) * 4; } return 0; }