本文整理汇总了C++中Heightmap::BuildFromImage方法的典型用法代码示例。如果您正苦于以下问题:C++ Heightmap::BuildFromImage方法的具体用法?C++ Heightmap::BuildFromImage怎么用?C++ Heightmap::BuildFromImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Heightmap
的用法示例。
在下文中一共展示了Heightmap::BuildFromImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ValidateHeightmapPathname
bool SceneValidator::ValidateHeightmapPathname(const FilePath &pathForValidation, Set<String> &errorsLog)
{
DVASSERT_MSG(!pathForChecking.IsEmpty(), "Need to set pathname for DataSource folder");
bool pathIsCorrect = IsPathCorrectForProject(pathForValidation);
if(pathIsCorrect)
{
String::size_type posPng = pathForValidation.GetAbsolutePathname().find(".png");
String::size_type posHeightmap = pathForValidation.GetAbsolutePathname().find(Heightmap::FileExtension());
pathIsCorrect = ((String::npos != posPng) || (String::npos != posHeightmap));
if(!pathIsCorrect)
{
errorsLog.insert(Format("Heightmap path %s is wrong", pathForValidation.GetAbsolutePathname().c_str()));
return false;
}
Heightmap *heightmap = new Heightmap();
if(String::npos != posPng)
{
Image *image = CreateTopLevelImage(pathForValidation);
pathIsCorrect = heightmap->BuildFromImage(image);
SafeRelease(image);
}
else
{
pathIsCorrect = heightmap->Load(pathForValidation);
}
if(!pathIsCorrect)
{
SafeRelease(heightmap);
errorsLog.insert(Format("Can't load Heightmap from path %s", pathForValidation.GetAbsolutePathname().c_str()));
return false;
}
pathIsCorrect = IsPowerOf2(heightmap->Size() - 1);
if(!pathIsCorrect)
{
errorsLog.insert(Format("Heightmap %s has wrong size", pathForValidation.GetAbsolutePathname().c_str()));
}
SafeRelease(heightmap);
return pathIsCorrect;
}
else
{
errorsLog.insert(Format("Path %s is incorrect for project %s", pathForValidation.GetAbsolutePathname().c_str(), pathForChecking.GetAbsolutePathname().c_str()));
}
return pathIsCorrect;
}