Esempio n. 1
0
 public VertexElement(short stream, short offset, IAFormat format, IASemantic semantic, byte usageIndex)
 {
     Stream     = stream;
     Offset     = offset;
     Format     = format;
     Semantic   = semantic;
     UsageIndex = usageIndex;
 }
Esempio n. 2
0
 public IndexedBufferView(IntPtr vertexPter, VertexDescriptor vd, IASemantic semantic, int usageIndex, IntPtr indicesPter, int istride, int icount)
 {
     this.vertexPter  = (byte *)vertexPter + vd.OffsetOf(semantic, usageIndex);
     this.vstride     = vd.Size;
     this.indicesPter = (byte *)indicesPter;
     this.istride     = istride;
     this.icount      = icount;
 }
Esempio n. 3
0
 public VertexElementAttribute(IASemantic semantic, byte usageIndex = 0, short stream = 0, IAFormat type = IAFormat.Unused, short offset = -1)
 {
     this.Semantic   = semantic;
     this.UsageIndex = usageIndex;
     this.Stream     = stream;
     this.Format     = type;
     this.Offset     = offset;
 }
Esempio n. 4
0
 public BufferView <T> GetVertexBufferView <T>(IASemantic usage, int index = 0) where T : struct
 {
     if (_vbStream == IntPtr.Zero)
     {
         _vbStream = _vb.Map(MapType.ReadWrite);
     }
     return(new BufferView <T>(_vbStream, _vd, usage, index, _vertexCount));
 }
Esempio n. 5
0
 public BufferView GetVertexViewStream(IASemantic semantic, int index = 0)
 {
     if (_vbStream == null)
     {
         _vbStream = _vb.Map(MapType.ReadWrite);
     }
     return(new BufferView(_vbStream, _vd, semantic, index));
 }
        public int SizeOf(IASemantic semantic, int usageIndex)
        {
            for (int i = 0; i < elements.Length; i++)
            {
                if (elements[i].Semantic == semantic && elements[i].UsageIndex == usageIndex)
                {
                    return(SizeOfElement(elements[i].Format));
                }
            }

            return(-1);
        }
        public int OffsetOf(IASemantic semantic, int usageIndex)
        {
            for (int i = 0; i < elements.Length; i++)
            {
                if (elements[i].Semantic == semantic && elements[i].UsageIndex == usageIndex)
                {
                    return(elements[i].Offset);
                }
            }

            return(-1);
        }
Esempio n. 8
0
        public IndexedBufferView <T> GetIndexedBufferView <T>(IASemantic semantic, int index = 0) where T : struct
        {
            if (_vbStream == IntPtr.Zero)
            {
                _vbStream = _vb.Map(MapType.ReadWrite);
            }
            if (_ibStream == IntPtr.Zero)
            {
                _ibStream = _ib.Map(MapType.ReadWrite);
            }

            return(new IndexedBufferView <T>(_vbStream, _vd, semantic, index, _ibStream, _ib.Stride, (int)_ib.SizeInBytes / _ib.Stride));
        }
Esempio n. 9
0
        public IEnumerable <T> GetVertexAttrib <T>(int boneIndex, IASemantic usage, int index)
            where T : struct
        {
            var attrib      = _mesh.GetVertexBufferView <T>(usage, index);
            var boneIndices = _mesh.GetVertexBufferView <float>(IASemantic.BlendIndices, 0);

            for (int i = 0; i < attrib.Count; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (boneIndices[i + j] == boneIndex)
                    {
                        yield return(attrib[i]);
                    }
                }
            }
        }
Esempio n. 10
0
 public BufferView(IntPtr baseAddr, VertexDescriptor vd, IASemantic semantic, int usageIndex)
 {
     pter   = baseAddr;
     offset = vd.OffsetOf(semantic, usageIndex);
     stride = vd.Size;
 }
 public bool HaveDeclarationUsage(IASemantic declarationUsage)
 {
     return(presentSemantics[(int)declarationUsage]);
 }