/// <summary> /// Property to return a vertex field by its context. /// </summary> public VertexField this[VertexFieldContext context] { get { return(this[context, 0]); } }
/// <summary> /// Constructor. /// </summary> /// <param name="stream">Stream to bind this field with.</param> /// <param name="fieldOffset">Position of the field within the field type.</param> /// <param name="context">The purpose of this field.</param> /// <param name="fieldType">Data type of the field.</param> /// <param name="index">Index of the item, only applicable to certain types of fields.</param> internal VertexField(short stream, short fieldOffset, VertexFieldContext context, VertexFieldType fieldType, byte index) { _stream = stream; _offset = fieldOffset; _context = context; _type = fieldType; _index = index; _size = (short)SizeOf(fieldType); }
/// <summary> /// Function to add a field to this vertex. /// </summary> /// <param name="stream">Stream to bind this field with.</param> /// <param name="fieldOffset">Offset of this field within the vertex type..</param> /// <param name="context">Context of this field.</param> /// <param name="fieldType">Data type of the field.</param> /// <param name="index">Index of the field, only required for certain types.</param> public void CreateField(short stream, short fieldOffset, VertexFieldContext context, VertexFieldType fieldType, byte index) { VertexField newField; // A new vertex field. newField = new VertexField(stream, fieldOffset, context, fieldType, index); _fields.Add(newField); _changed = true; _sizeChanged = true; }
/// <summary> /// Function to add a field to this vertex. /// </summary> /// <param name="stream">Stream to bind this field with.</param> /// <param name="fieldOffset">Offset of this field within the vertex type..</param> /// <param name="context">Context of this field.</param> /// <param name="fieldType">Data type of the field.</param> /// <param name="index">Index of the field, only required for certain types.</param> public void CreateField ( short stream , short fieldOffset , VertexFieldContext context , VertexFieldType fieldType , byte index ) { VertexField newField; // A new vertex field. newField = new VertexField(stream , fieldOffset , context , fieldType , index); _fields.Add(newField); _changed = true; _sizeChanged = true; }
/// <summary> /// Function to insert a vertex field at a specified index. /// </summary> /// <param name="stream">Stream to which the field will be bound.</param> /// <param name="fieldIndex">Index after which to insert.</param> /// <param name="fieldOffset">Offset of the field in the buffer.</param> /// <param name="context">Context of this field.</param> /// <param name="fieldType">Data type of this field.</param> /// <param name="index">Index of the vertex field, required for certain fields.</param> public void InsertField(short stream, int fieldIndex, short fieldOffset, VertexFieldContext context, VertexFieldType fieldType, byte index) { VertexField newField; // New _fields[i]. newField = new VertexField(stream, fieldOffset, context, fieldType, index); _fields.Insert(fieldIndex, newField); _changed = true; _sizeChanged = true; }
/// <summary> /// Function to update a vertex _fields[i]. /// </summary> /// <param name="stream">Stream to which the field is bound.</param> /// <param name="fieldIndex">Index of the field to update</param> /// <param name="fieldOffset">Offset within the buffer.</param> /// <param name="context">Context of this field.</param> /// <param name="fieldType">Data type of the field.</param> /// <param name="index">Index of the field, only required for certain types.</param> public void UpdateField(short stream, int fieldIndex, short fieldOffset, VertexFieldContext context, VertexFieldType fieldType, byte index) { if ((fieldIndex < 0) || (fieldIndex >= _fields.Count)) { throw new IndexOutOfRangeException("The index " + index.ToString() + " is not valid for this collection."); } _fields[fieldIndex] = new VertexField(stream, fieldOffset, context, fieldType, index); _changed = true; _sizeChanged = true; }
/// <summary> /// Function to remove a field from the vertex. /// </summary> /// <param name="stream">Stream to which the field is bound.</param> /// <param name="context">Context of the field we wish to remove.</param> public void Remove(short stream, VertexFieldContext context) { int i; // loop. for (i = _fields.Count - 1; i >= 0; i--) { if ((_fields[i].Context == context) && (_fields[i].Stream == stream)) { Remove(i); } } }
/// <summary> /// Function to retrieve whether this vertex definition contains a field of a particular context type. /// </summary> /// <param name="context">Context to check for.</param> /// <returns>TRUE if context exists, FALSE if not.</returns> public bool HasFieldContext(VertexFieldContext context) { int i; // loop. for (i = 0; i < _fields.Count; i++) { if (_fields[i].Context == context) { return(true); } } return(false); }
/// <summary> /// Function to retrieve whether this vertex definition contains a field of a particular context type. /// </summary> /// <param name="stream">Stream to check.</param> /// <param name="context">Context to check for.</param> /// <returns>TRUE if context exists, FALSE if not.</returns> public bool HasFieldContext(short stream, VertexFieldContext context) { int i; // loop. for (i = 0; i < _fields.Count; i++) { if ((_fields[i].Context == context) && (_fields[i].Stream == stream)) { return(true); } } return(false); }
/// <summary> /// Property to return a vertex field by its context. /// </summary> public VertexField this[VertexFieldContext context, int fieldindex] { get { VertexField field; // Field in question for (int i = 0; i < _fields.Count; i++) { field = _fields[i]; if ((field.Context == context) && (field.Index == fieldindex)) { return(field); } } throw new ArgumentException("There is no vertex field context '" + context.ToString() + "' in this vertex type.", "context"); } }
/// <summary> /// Function to insert a vertex field at a specified index. /// </summary> /// <param name="stream">Stream to which the field will be bound.</param> /// <param name="fieldIndex">Index after which to insert.</param> /// <param name="fieldOffset">Offset of the field in the buffer.</param> /// <param name="context">Context of this field.</param> /// <param name="fieldType">Data type of this field.</param> public void InsertField(short stream, int fieldIndex, short fieldOffset, VertexFieldContext context, VertexFieldType fieldType) { InsertField(stream, fieldIndex, fieldOffset, context, fieldType, 0); }
/// <summary> /// Function to retrieve whether this vertex definition contains a field of a particular context type. /// </summary> /// <param name="stream">Stream to check.</param> /// <param name="context">Context to check for.</param> /// <returns>TRUE if context exists, FALSE if not.</returns> public bool HasFieldContext ( short stream , VertexFieldContext context ) { int i; // loop. for (i = 0 ; i < _fields.Count ; i++) { if ((_fields[i].Context == context) && (_fields[i].Stream == stream)) return true; } return false; }
/// <summary> /// Function to add a field to this vertex. /// </summary> /// <param name="stream">Stream to bind this field with.</param> /// <param name="fieldOffset">Offset of this field within the vertex type..</param> /// <param name="context">Context of this field.</param> /// <param name="fieldType">Data type of the field.</param> public void CreateField(short stream, short fieldOffset, VertexFieldContext context, VertexFieldType fieldType) { CreateField(stream, fieldOffset, context, fieldType, 0); }
/// <summary> /// Function to add a field to this vertex. /// </summary> /// <param name="stream">Stream to bind this field with.</param> /// <param name="fieldOffset">Offset of this field within the vertex type..</param> /// <param name="context">Context of this field.</param> /// <param name="fieldType">Data type of the field.</param> public void CreateField ( short stream , short fieldOffset , VertexFieldContext context , VertexFieldType fieldType ) { CreateField(stream , fieldOffset , context , fieldType , 0); }
/// <summary> /// Property to return a vertex field by its context. /// </summary> public VertexField this[VertexFieldContext context , int fieldindex] { get { VertexField field; // Field in question for (int i = 0 ; i < _fields.Count ; i++) { field = _fields[i]; if ((field.Context == context) && (field.Index == fieldindex)) return field; } throw new ArgumentException("There is no vertex field context '" + context.ToString() + "' in this vertex type." , "context"); } }
/// <summary> /// Property to return a vertex field by its context. /// </summary> public VertexField this[VertexFieldContext context] { get { return this[context , 0]; } }
/// <summary> /// Function to retrieve whether this vertex definition contains a field of a particular context type. /// </summary> /// <param name="context">Context to check for.</param> /// <returns>TRUE if context exists, FALSE if not.</returns> public bool HasFieldContext ( VertexFieldContext context ) { int i; // loop. for (i = 0 ; i < _fields.Count ; i++) { if (_fields[i].Context == context) return true; } return false; }
/// <summary> /// Function to insert a vertex field at a specified index. /// </summary> /// <param name="stream">Stream to which the field will be bound.</param> /// <param name="fieldIndex">Index after which to insert.</param> /// <param name="fieldOffset">Offset of the field in the buffer.</param> /// <param name="context">Context of this field.</param> /// <param name="fieldType">Data type of this field.</param> public void InsertField ( short stream , int fieldIndex , short fieldOffset , VertexFieldContext context , VertexFieldType fieldType ) { InsertField(stream , fieldIndex , fieldOffset , context , fieldType , 0); }
/// <summary> /// Function to update a vertex _fields[i]. /// </summary> /// <param name="stream">Stream to which the field is bound.</param> /// <param name="fieldIndex">Index of the field to update</param> /// <param name="fieldOffset">Offset within the buffer.</param> /// <param name="context">Context of this field.</param> /// <param name="fieldType">Data type of the field.</param> /// <param name="index">Index of the field, only required for certain types.</param> public void UpdateField ( short stream , int fieldIndex , short fieldOffset , VertexFieldContext context , VertexFieldType fieldType , byte index ) { if ((fieldIndex < 0) || (fieldIndex >= _fields.Count)) throw new IndexOutOfRangeException("The index " + index.ToString() + " is not valid for this collection."); _fields[fieldIndex] = new VertexField(stream , fieldOffset , context , fieldType , index); _changed = true; _sizeChanged = true; }
/// <summary> /// Function to insert a vertex field at a specified index. /// </summary> /// <param name="stream">Stream to which the field will be bound.</param> /// <param name="fieldIndex">Index after which to insert.</param> /// <param name="fieldOffset">Offset of the field in the buffer.</param> /// <param name="context">Context of this field.</param> /// <param name="fieldType">Data type of this field.</param> /// <param name="index">Index of the vertex field, required for certain fields.</param> public void InsertField ( short stream , int fieldIndex , short fieldOffset , VertexFieldContext context , VertexFieldType fieldType , byte index ) { VertexField newField; // New _fields[i]. newField = new VertexField(stream , fieldOffset , context , fieldType , index); _fields.Insert(fieldIndex , newField); _changed = true; _sizeChanged = true; }
/// <summary> /// Constructor. /// </summary> /// <param name="stream">Stream to bind this field with.</param> /// <param name="fieldOffset">Position of the field within the field type.</param> /// <param name="context">The purpose of this field.</param> /// <param name="fieldType">Data type of the field.</param> /// <param name="index">Index of the item, only applicable to certain types of fields.</param> internal VertexField(short stream,short fieldOffset, VertexFieldContext context, VertexFieldType fieldType, byte index) { _stream = stream; _offset = fieldOffset; _context = context; _type = fieldType; _index = index; _size = (short)SizeOf(fieldType); }
/// <summary> /// Function to remove a field from the vertex. /// </summary> /// <param name="stream">Stream to which the field is bound.</param> /// <param name="context">Context of the field we wish to remove.</param> public void Remove ( short stream , VertexFieldContext context ) { int i; // loop. for (i = _fields.Count - 1 ; i >= 0 ; i--) { if ((_fields[i].Context == context) && (_fields[i].Stream == stream)) Remove(i); } }