本文整理汇总了C++中Texture::GenerateMipmaps方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::GenerateMipmaps方法的具体用法?C++ Texture::GenerateMipmaps怎么用?C++ Texture::GenerateMipmaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture::GenerateMipmaps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateLandscapeTilemap
void CommandCopyPasteHeightmap::UpdateLandscapeTilemap(DAVA::Image *image)
{
Texture* texture = Texture::CreateFromData(image->GetPixelFormat(), image->GetData(), image->GetWidth(), image->GetHeight(), false);
texture->relativePathname = tilemapSavedPathname;
texture->GenerateMipmaps();
texture->SetWrapMode(Texture::WRAP_REPEAT, Texture::WRAP_REPEAT);
LandscapeEditorBase* editor = GetActiveEditor();
if (editor)
{
editor->UpdateLandscapeTilemap(texture);
}
else
{
SceneEditorScreenMain *screen = dynamic_cast<SceneEditorScreenMain *>(UIScreenManager::Instance()->GetScreen());
EditorScene* scene = screen->FindCurrentBody()->bodyControl->GetScene();
Landscape* landscape = scene->GetLandscape(scene);
landscape->SetTexture(Landscape::TEXTURE_TILE_MASK, texture);
landscape->UpdateFullTiledTexture();
ImageLoader::Save(image, tilemapSavedPathname);
}
SafeRelease(texture);
}
示例2: UpdateCopypasteTool
void LandscapeEditorHeightmap::UpdateCopypasteTool(float32 timeElapsed)
{
if( (Vector2(-1.0f, -1.0f) != copyFromCenter)
&& (Vector2(-1.0f, -1.0f) != copyToCenter))
{
if(currentTool->copyTilemask)
{
if(tilemaskImage && toolImageTile)
{
tilemaskWasChanged = true;
float32 multiplier = (float32)tilemaskImage->GetWidth() / (float32)(landscapeSize);
int32 scaleSize = toolImageTile->GetWidth();
Vector2 posTo = landscapePoint * multiplier - Vector2((float32)scaleSize, (float32)scaleSize)/2.f;
Vector2 deltaPos = landscapePoint - copyToCenter;
Vector2 posFrom = (copyFromCenter + deltaPos) * multiplier - Vector2((float32)scaleSize, (float32)scaleSize)/2.f;
EditorHeightmap::DrawCopypasteRGBA(tilemaskImage, tilemaskImage, toolImageTile, posFrom, posTo, scaleSize, scaleSize);
Texture *tex = tilemaskTexture;
if(tex)
{
tex->TexImage(0, tilemaskImage->GetWidth(), tilemaskImage->GetHeight(), tilemaskImage->GetData(), 0);
//TODO: is code useful?
tex->GenerateMipmaps();
tex->SetWrapMode(Texture::WRAP_REPEAT, Texture::WRAP_REPEAT);
//ENDOFTODO
workingLandscape->UpdateFullTiledTexture();
}
}
}
if(currentTool->copyHeightmap)
{
int32 scaleSize = toolImage->GetWidth();
Vector2 posTo = landscapePoint - Vector2((float32)scaleSize, (float32)scaleSize)/2.f;
Vector2 deltaPos = landscapePoint - copyToCenter;
Vector2 posFrom = copyFromCenter + deltaPos - Vector2((float32)scaleSize, (float32)scaleSize)/2.f;
float32 koef = (currentTool->averageStrength * timeElapsed) * 2.0f;
EditorHeightmap *heightmap = dynamic_cast<EditorHeightmap *>(landscapesController->GetCurrentHeightmap());
DVASSERT(heightmap);
heightmap->DrawCopypasteRGBA(toolImage, posFrom, posTo, scaleSize, scaleSize, koef);
UpdateHeightmap(Rect(posTo.x, posTo.y, (float32)scaleSize, (float32)scaleSize));
}
}
}