public virtual void ReadInput( Dictionary<int, List<InputSourceCollection>> inputSources, Dictionary<string, VertexSet> vertexSets, XmlNode node, ColladaMeshInfo meshInfo ) { InputSourceCollection input = null; string source = node.Attributes[ "source" ].Value; // Get the part after the '#' source = source.Substring( 1 ); string semantic = node.Attributes[ "semantic" ].Value; int inputIndex = inputSources.Count; if( node.Attributes[ "idx" ] != null ) inputIndex = int.Parse( node.Attributes[ "idx" ].Value ); if( !inputSources.ContainsKey( inputIndex ) ) inputSources[ inputIndex ] = new List<InputSourceCollection>(); if( semantic == "VERTEX" ) { VertexSet vertexSet = vertexSets[ source ]; // Dereference the vertex input and add that instead. if( inputSources != null ) { VertexInputSource vertexInput = new VertexInputSource(); foreach( InputSourceCollection tmp in vertexSet.vertexEntries ) vertexInput.AddSource( tmp ); inputSources[ inputIndex ].Add( vertexInput ); } } else { if( !Accessors.ContainsKey( source ) ) { Debug.Assert( false, "Missing accessor for source: " + source ); return; } Accessor accessor = Accessors[ source ]; if( inputSources != null ) { input = new InputSource( source, semantic, accessor ); inputSources[ inputIndex ].Add( input ); } } }
public override void ReadInput( Dictionary<int, List<InputSourceCollection>> inputSources, Dictionary<string, VertexSet> vertexSets, XmlNode node, ColladaMeshInfo meshInfo ) { InputSourceCollection input = null; string source = node.Attributes[ "source" ].Value; // Get the part after the '#' source = source.Substring( 1 ); string semantic = node.Attributes[ "semantic" ].Value; int inputIndex = inputSources.Count; if( node.Attributes[ "offset" ] != null ) inputIndex = int.Parse( node.Attributes[ "offset" ].Value ); int inputSet = -1; if( node.Attributes[ "set" ] != null ) inputSet = int.Parse( node.Attributes[ "set" ].Value ); if( !inputSources.ContainsKey( inputIndex ) ) inputSources[ inputIndex ] = new List<InputSourceCollection>(); if( semantic == "VERTEX" ) { VertexSet vertexSet = vertexSets[ source ]; // Dereference the vertex input and add that instead. if( inputSources != null ) { VertexInputSource vertexInput = new VertexInputSource(); foreach( InputSourceCollection tmp in vertexSet.vertexEntries ) vertexInput.AddSource( tmp ); inputSources[ inputIndex ].Add( vertexInput ); } } else { if( !Accessors.ContainsKey( source ) ) { string msg = string.Format( "Missing accessor for source: {0}", source ); throw new Exception( msg ); } Accessor accessor = Accessors[ source ]; if( inputSources != null ) { input = new InputSource( source, semantic, accessor, inputSet ); inputSources[ inputIndex ].Add( input ); } } }