///-------------------------------------------------------------------------------------------------
        /// <summary>	Creates the node list. </summary>
        ///-------------------------------------------------------------------------------------------------
        private void CreateNodeList()
        {
            // Get all of the object instances to include
            var objectInstances = mScenarioDataProvider.GetObjectInstances();

            for (int i = 0; i < objectInstances.Count; i++)
            {
                var objectInstance = objectInstances[i];

                // Create a node for the object instance
                ColladaNCName nodeName = "";
                if (objectInstance.ObjectName == null)
                {
                    if (!TagIndex.IsValid(objectInstance.ObjectType.ObjectTagDatum))
                    {
                        throw new ColladaException("Failed to load the object type tag {0}", objectInstance.ObjectType.ObjectTagPath);
                    }

                    ColladaNCName objectName = Path.GetFileNameWithoutExtension(mTagIndex[objectInstance.ObjectType.ObjectTagDatum].Name);

                    nodeName = i.ToString() + "-" + objectName;
                }
                else
                {
                    nodeName = objectInstance.ObjectName.Name;
                }

                var node = CreateNode(nodeName, "", "", Enums.ColladaNodeType.NODE);

                // Set the nodes position
                var translate = new Core.ColladaTranslate();
                translate.SetTranslate(objectInstance.Position, 100);
                node.Add(translate);

                // Set the nodes rotation
                node.AddRange(
                    ColladaUtilities.CreateRotationSet(objectInstance.Rotation.R, objectInstance.Rotation.P, objectInstance.Rotation.Y
                                                       , new LowLevel.Math.real_vector3d(1, 0, 0)
                                                       , new LowLevel.Math.real_vector3d(0, -1, 0)
                                                       , new LowLevel.Math.real_vector3d(0, 0, 1)
                                                       , ColladaUtilities.ColladaRotationOrder.XYZ)
                    );

                var nodeIdList = GetNodeReferences(objectInstance.ObjectType, objectInstance.Permutation.ToString("D2"));
                if (nodeIdList.Count > 0)
                {
                    node.InstanceNode = new List <ColladaInstanceNode>();
                    foreach (var nodeId in nodeIdList)
                    {
                        node.InstanceNode.Add(new ColladaInstanceNode()
                        {
                            URL = "#" + nodeId
                        });
                    }
                }

                listNode.Add(node);
            }
        }
        private List <string> GetNodeReferences(ScenarioData.ScenarioObject objectType, string permutation)
        {
            var nodeIds = new List <string>();

            // Add geometry instances to the node
            if (!TagIndex.IsValid(objectType.ObjectTagDatum))
            {
                throw new ColladaException("Failed to load the object type tag {0}", objectType.ObjectTagPath);
            }

            var objectName = Path.GetFileNameWithoutExtension(objectType.ObjectTagPath);

            objectName += "-perm" + permutation;

            // Collect data about the object
            var objectData = new ObjectData();

            objectData.CollectData(mTagIndex, mTagIndex[objectType.ObjectTagDatum]);
            if (!TagIndex.IsValid(objectData.Model))
            {
                return(nodeIds);
            }

            if (COLLADAFile.LibraryNodes == null)
            {
                AddLibraryNodes();
            }

            // Collect data about the model
            var modelData = new ModelData();

            modelData.CollectData(mTagIndex, mTagIndex[objectData.Model]);

            // Get all of the geometries that make up the permutation at the highest lod
            var geometryList = modelData.GetGeometries(permutation, Blam.Halo1.TypeEnums.LevelOfDetailEnum.SuperHigh);

            // Add geometry instances for all geometries
            foreach (var geometrySet in geometryList)
            {
                var name = objectName + "-" + geometrySet.Name;

                ColladaNCName           nodeName = name;
                ColladaID <ColladaNode> nodeId   = name;

                nodeIds.Add(nodeId);

                if (COLLADAFile.LibraryNodes.Node.Exists(node => node.ID == nodeId.ToString()))
                {
                    break;
                }

                // Create shader references for all shaders used by the geometry
                var materialReferences = new MaterialReferenceList();
                foreach (var shader in geometrySet.Shaders)
                {
                    ColladaNCName symbolName = shader.MaterialName;
                    ColladaID <Fx.ColladaMaterial> shaderName = shader.MaterialName;

                    var url = ColladaUtilities.BuildExternalReference(modelData,
                                                                      colladaSettings.RootDirectory,
                                                                      shaderName);

                    materialReferences.Add(new MaterialReference(shaderName, url, symbolName));
                }

                // Build the geometry reference URL and add the geometry instance
                string geometryURL = ColladaUtilities.BuildExternalReference(modelData,
                                                                             colladaSettings.RootDirectory,
                                                                             new ColladaID <Core.ColladaGeometry>(geometrySet.Name));

                var nodeType = CreateNode(nodeName, "", nodeId, Enums.ColladaNodeType.NODE);
                nodeType.Add(CreateInstanceGeometry(geometryURL, geometrySet.Name, materialReferences));

                COLLADAFile.LibraryNodes.Node.Add(nodeType);
            }

            return(nodeIds);
        }