public static MemoryAccessInfo[] GetVertexAttributes(this IVertexBuilder firstVertex, int vertexCount, PackedEncoding vertexEncoding)
        {
            var tvg = firstVertex.GetGeometry().GetType();
            var tvm = firstVertex.GetMaterial().GetType();
            var tvs = firstVertex.GetSkinning().GetType();

            var attributes = new List <MemoryAccessInfo>();

            foreach (var finfo in tvg.GetFields())
            {
                var attribute = _GetMemoryAccessInfo(finfo);
                if (attribute.HasValue)
                {
                    attributes.Add(attribute.Value);
                }
            }

            foreach (var finfo in tvm.GetFields())
            {
                var attribute = _GetMemoryAccessInfo(finfo);
                if (attribute.HasValue)
                {
                    attributes.Add(attribute.Value);
                }
            }

            foreach (var finfo in tvs.GetFields())
            {
                var attribute = _GetMemoryAccessInfo(finfo);
                if (attribute.HasValue)
                {
                    var a = attribute.Value;
                    if (a.Name.StartsWith("JOINTS_", StringComparison.OrdinalIgnoreCase))
                    {
                        a.Encoding = vertexEncoding.JointsEncoding.Value;
                    }
                    if (a.Name.StartsWith("WEIGHTS_", StringComparison.OrdinalIgnoreCase))
                    {
                        a.Encoding = vertexEncoding.WeightsEncoding.Value;
                        if (a.Encoding != ENCODING.FLOAT)
                        {
                            a.Normalized = true;
                        }
                    }

                    attributes.Add(a);
                }
            }

            var array = attributes.ToArray();

            MemoryAccessInfo.SetInterleavedInfo(array, 0, vertexCount);

            return(array);
        }
Пример #2
0
        public static MemoryAccessInfo[] GetVertexAttributes(this IVertexBuilder firstVertex, int vertexCount, Schema2.EncodingType jointEncoding)
        {
            var tvg = firstVertex.GetGeometry().GetType();
            var tvm = firstVertex.GetMaterial().GetType();
            var tvs = firstVertex.GetSkinning().GetType();

            var attributes = new List <MemoryAccessInfo>();

            foreach (var finfo in tvg.GetFields())
            {
                var attribute = _GetMemoryAccessInfo(finfo);
                if (attribute.HasValue)
                {
                    attributes.Add(attribute.Value);
                }
            }

            foreach (var finfo in tvm.GetFields())
            {
                var attribute = _GetMemoryAccessInfo(finfo);
                if (attribute.HasValue)
                {
                    attributes.Add(attribute.Value);
                }
            }

            foreach (var finfo in tvs.GetFields())
            {
                var attribute = _GetMemoryAccessInfo(finfo);
                if (attribute.HasValue)
                {
                    var a = attribute.Value;
                    if (a.Name.StartsWith("JOINTS_", StringComparison.OrdinalIgnoreCase))
                    {
                        a.Encoding = jointEncoding;
                    }

                    attributes.Add(a);
                }
            }

            var array = attributes.ToArray();

            MemoryAccessInfo.SetInterleavedInfo(array, 0, vertexCount);

            return(array);
        }
Пример #3
0
        public static MemoryAccessInfo[] GetVertexAttributes(this IVertexBuilder firstVertex, int vertexCount)
        {
            var tvg = firstVertex.GetGeometry().GetType();
            var tvm = firstVertex.GetMaterial().GetType();
            var tvs = firstVertex.GetSkinning().GetType();

            var attributes = new List <MemoryAccessInfo>();

            foreach (var finfo in tvg.GetFields())
            {
                var attribute = _GetMemoryAccessInfo(finfo);
                if (attribute.HasValue)
                {
                    attributes.Add(attribute.Value);
                }
            }

            foreach (var finfo in tvm.GetFields())
            {
                var attribute = _GetMemoryAccessInfo(finfo);
                if (attribute.HasValue)
                {
                    attributes.Add(attribute.Value);
                }
            }

            foreach (var finfo in tvs.GetFields())
            {
                var attribute = _GetMemoryAccessInfo(finfo);
                if (attribute.HasValue)
                {
                    attributes.Add(attribute.Value);
                }
            }

            var array = attributes.ToArray();

            MemoryAccessInfo.SetInterleavedInfo(array, 0, vertexCount);

            return(array);
        }