本文整理汇总了C#中ObjectData.CollectData方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectData.CollectData方法的具体用法?C# ObjectData.CollectData怎么用?C# ObjectData.CollectData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectData
的用法示例。
在下文中一共展示了ObjectData.CollectData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNodeReferences
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;
}
示例2: AddChildJobs
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> Adds the scenarios objects as child jobs. </summary>
///
/// <param name="scenarioData"> Information describing the scenario. </param>
/// <param name="objectType"> Type of the object. </param>
private void AddChildJobs(ScenarioData scenarioData, TypeEnums.ObjectType objectType)
{
foreach (var scenarioObjectType in scenarioData.ScenarioObjectLists[objectType])
{
// Get the model tag
if (!BlamLib.Managers.TagIndex.IsValid(scenarioObjectType.ObjectTagDatum))
{
mMessageHandler.SendMessage("Failed to open {0}, child job not added", Path.GetFileName(scenarioObjectType.ObjectTagPath));
continue;
}
var objectData = new ObjectData();
objectData.CollectData(TagIndex, TagIndex[scenarioObjectType.ObjectTagDatum]);
// If no model was set don't continue
if (objectData.Model.IsNull)
{
continue;
}
if (!BlamLib.Managers.TagIndex.IsValid(objectData.Model))
{
mMessageHandler.SendMessage("Failed to open model tag for {0}, child job not added", Path.GetFileName(scenarioObjectType.ObjectTagPath));
continue;
}
// Add an extraction job for the model tag
var modelTagManager = TagIndex[objectData.Model];
var modelFile = Path.Combine(mModelExtractionData.TagsDirectory.Root
, mModelExtractionData.TagsDirectory.EndFolder
, modelTagManager.Name);
modelFile = Path.ChangeExtension(modelFile, "gbxmodel");
mModelExtractionData.JobInterface.AddJob(modelFile, mExtractionData);
}
}