コード例 #1
0
ファイル: BufferRL.cs プロジェクト: tksuoran/renderstack_net
        public VertexStreamRL VertexStreamRL(IProgram program)
        {
            if (vertexStreamsRL.ContainsKey(program))
            {
                return(vertexStreamsRL[program]);
            }
            var bindings = vertexStreamsRL[program] = new VertexStreamRL();
            var mappings = program.AttributeMappings;

            mappings.BindAttributes(bindings, program, vertexFormat);
            return(bindings);
        }
コード例 #2
0
        public void BindAttributes(VertexStreamRL vertexStream, IProgram program, VertexFormat vertexFormat)
        {
            foreach (var mapping in mappings)
            {
                var programAttribute = program.Attribute(mapping.Name);
                if (programAttribute == null)
                {
                    continue;
                }
                var vertexFormatAttribute = vertexFormat.FindAttribute(mapping.SrcUsage, mapping.SrcIndex);
                if (vertexFormatAttribute == null)
                {
                    continue;
                }

                vertexStream.Add(
                    mapping,
                    vertexFormatAttribute,
                    vertexFormat.Stride,
                    programAttribute.Slot
                    );
            }
        }