本文整理汇总了C++中Heightmap::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ Heightmap::Size方法的具体用法?C++ Heightmap::Size怎么用?C++ Heightmap::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Heightmap
的用法示例。
在下文中一共展示了Heightmap::Size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
LandscapeEditorDrawSystem::eErrorType LandscapeEditorDrawSystem::Init()
{
if (!heightmapProxy)
{
Heightmap* heightmap = baseLandscape->GetHeightmap();
if (heightmap == NULL || heightmap->Size() == 0)
{
return LANDSCAPE_EDITOR_SYSTEM_HEIGHTMAP_ABSENT;
}
heightmapProxy = new HeightmapProxy(baseLandscape->GetHeightmap()->Clone(NULL));
}
if (!customColorsProxy)
{
customColorsProxy = new CustomColorsProxy((int32)GetTextureSize(Landscape::TEXTURE_TILE_FULL));
}
if (!visibilityToolProxy)
{
visibilityToolProxy = new VisibilityToolProxy((int32)GetTextureSize(Landscape::TEXTURE_TILE_FULL));
}
if (!rulerToolProxy)
{
rulerToolProxy = new RulerToolProxy((int32)GetTextureSize(Landscape::TEXTURE_TILE_FULL));
}
return LANDSCAPE_EDITOR_SYSTEM_NO_ERRORS;
}
示例2: GetHeightAtPoint
float32 LandscapeEditorDrawSystem::GetHeightAtPoint(const Vector2& point)
{
Heightmap *heightmap = GetHeightmapProxy();
int32 x = (int32)point.x;
int32 y = (int32)point.y;
DVASSERT_MSG((x >= 0 && x < heightmap->Size()) && (y >= 0 && y < heightmap->Size()),
"Point must be in heightmap coordinates");
int32 index = x + y * heightmap->Size();
float32 height = heightmap->Data()[index];
float32 maxHeight = GetLandscapeMaxHeight();
height *= maxHeight;
height /= Heightmap::MAX_VALUE;
return height;
}
示例3: UpdateHeightmap
void LandscapeEditorHeightmap::UpdateHeightmap(const Rect &updatedRect)
{
Heightmap *heightmap = landscapesController->GetCurrentHeightmap();
Rect clippedRect;
clippedRect.x = (float32)Clamp((int32)updatedRect.x, 0, heightmap->Size()-1);
clippedRect.y = (float32)Clamp((int32)updatedRect.y, 0, heightmap->Size()-1);
clippedRect.dx = Clamp((updatedRect.x + updatedRect.dx), 0.f, (float32)heightmap->Size() - 1.f) - clippedRect.x;
clippedRect.dy = Clamp((updatedRect.y + updatedRect.dy), 0.f, (float32)heightmap->Size() - 1.f) - clippedRect.y;
if(heightmapNode)
{
heightmapNode->UpdateHeightmapRect(clippedRect);
}
landscapesController->HeghtWasChanged(clippedRect);
}
示例4: 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;
}
示例5: GetDropperHeight
float32 LandscapeEditorHeightmap::GetDropperHeight()
{
Vector3 landSize;
AABBox3 transformedBox;
workingLandscape->GetBoundingBox().GetTransformedBox(*workingLandscape->GetWorldTransformPtr(), transformedBox);
landSize = transformedBox.max - transformedBox.min;
Heightmap *heightmap = landscapesController->GetCurrentHeightmap();
int32 index = (int32)(landscapePoint.x + landscapePoint.y * heightmap->Size());
float32 height = heightmap->Data()[index];
float32 maxHeight = landSize.z;
return (height / Heightmap::MAX_VALUE * maxHeight);
}
示例6: TextureDidChanged
void LandscapeEditorHeightmap::TextureDidChanged(const String &forKey)
{
if("property.landscape.texture.heightmap" == forKey)
{
savedPath = workingLandscape->GetHeightmapPathname();
Heightmap *heightmap = landscapesController->GetCurrentHeightmap();
landscapeSize = heightmap->Size();
CreateHeightmapUndo();
}
else if("property.landscape.texture.tilemask" == forKey)
{
CreateTilemaskImage();
}
}
示例7: ShowAction
void LandscapeEditorHeightmap::ShowAction()
{
prevToolSize = 0.f;
SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
landscapesController = activeScene->GetLandscapesController();
landscapesController->CreateEditorLandscape();
SafeRetain(landscapesController);
savedPath = workingLandscape->GetHeightmapPathname();
Heightmap *heightmap = landscapesController->GetCurrentHeightmap();
landscapeSize = heightmap->Size();
landscapesController->CursorEnable();
CreateTilemaskImage();
}