Hi,
there is no HeightFieldProcessor in DigitalRune Geometry. But you can create your own height-field processor.
If you already have the height data stored in an XML-file you could do something like this:
Create a custom content importer that loads the XML-file.
using System.Xml;
using Microsoft.Xna.Framework.Content.Pipeline;
namespace CustomContentProcessor
{
[ContentImporter(".xml", DisplayName = "XML File Importer")]
public class XmlFileImporter : ContentImporter<XmlDocument>
{
public override XmlDocument Import(string filename, ContentImporterContext context)
{
XmlDocument document = new XmlDocument();
document.Load(filename);
return document;
}
}
}
Create a custom content processor that parses the XML-file and creates a height-field.
using System.Xml;
using DigitalRune.Geometry.Shapes;
using Microsoft.Xna.Framework.Content.Pipeline;
namespace CustomContentProcessor
{
[ContentProcessor(DisplayName = "Height-Field Processor")]
public class HeightFieldProcessor : ContentProcessor<XmlDocument, HeightField>
{
public override HeightField Process(XmlDocument input, ContentProcessorContext context)
{
// 1. Parse XML data.
// 2. Create a HeightField.
HeightField heightField = new HeightField();
heightField.WidthX = ...
heightField.WidthZ = ...
heightField.Array = ...
return heightField;
}
}
}
At runtime you can simply load the height-field:
HeightField heightField = Content.Load<HeightField>("XmlFile");
You content pipeline extension project needs to reference the DigitalRune DLLs including
DigitalRune.Mathematics.Content.Pipeline.dll and
DigitalRune.Geometry.Content.Pipeline.dll.