在调试 hightmap图生成 3d地形,在调用
terrain = Content.Load<Model>("terrain");语句时出现以下错误提示:
原因:
需要更改 HeightMapInfoContent.cs 文件中的以下方法中的 HeightMapInfo类和HeightMapInfoReader类的命名空间,改成你实际的命名空间名称,该命名空间名称应与你项目命名空间名称一致:
(注:上面说的两个类在HeightMapInfo.cs文件中。)
public override string GetRuntimeType(TargetPlatform targetPlatform)
{
...
}
public override string GetRuntimeReader(TargetPlatform targetPlatform)
{
...
}
{
...
}
public override string GetRuntimeReader(TargetPlatform targetPlatform)
{
...
}
如下图所示:
本例修改结果如下所示:
/// <summary>
/// Tells the content pipeline what CLR type the
/// data will be loaded into at runtime.
/// </summary>
public override string GetRuntimeType(TargetPlatform targetPlatform)
{
return "hightmapTerrain.HeightMapInfo, " +
"hightmapTerrain, Version=1.0.0.0, Culture=neutral";
}
/// <summary>
/// Tells the content pipeline what worker type
/// will be used to load the data.
/// </summary>
public override string GetRuntimeReader(TargetPlatform targetPlatform)
{
return "hightmapTerrain.HeightMapInfoReader, " +
"hightmapTerrain, Version=1.0.0.0, Culture=neutral";
}
/// Tells the content pipeline what CLR type the
/// data will be loaded into at runtime.
/// </summary>
public override string GetRuntimeType(TargetPlatform targetPlatform)
{
return "hightmapTerrain.HeightMapInfo, " +
"hightmapTerrain, Version=1.0.0.0, Culture=neutral";
}
/// <summary>
/// Tells the content pipeline what worker type
/// will be used to load the data.
/// </summary>
public override string GetRuntimeReader(TargetPlatform targetPlatform)
{
return "hightmapTerrain.HeightMapInfoReader, " +
"hightmapTerrain, Version=1.0.0.0, Culture=neutral";
}