本文整理汇总了C++中LandscapeNode::SetTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ LandscapeNode::SetTexture方法的具体用法?C++ LandscapeNode::SetTexture怎么用?C++ LandscapeNode::SetTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LandscapeNode
的用法示例。
在下文中一共展示了LandscapeNode::SetTexture方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateFullTiledTexture
void LandscapePropertyControl::GenerateFullTiledTexture(DAVA::BaseObject *object, void *userData, void *callerData)
{
LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode);
String texPathname = landscape->SaveFullTiledTexture();
propertyList->SetFilepathPropertyValue(String("property.landscape.texture.tiledtexture"), texPathname);
landscape->SetTexture(LandscapeNode::TEXTURE_TILE_FULL, texPathname);
}
示例2: SetLandscapeTexture
void LandscapePropertyControl::SetLandscapeTexture(LandscapeNode::eTextureLevel level, const String &texturePathname)
{
Texture::EnableMipmapGeneration();
LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode);
landscape->SetTexture(level, texturePathname);
SceneValidator::Instance()->ValidateTexture(landscape->GetTexture(level));
Texture::DisableMipmapGeneration();
if(LandscapeNode::TEXTURE_TILE_FULL != level)
{
landscape->UpdateFullTiledTexture();
}
}
示例3: SetLandscapeTexture
void LandscapePropertyControl::SetLandscapeTexture(LandscapeNode::eTextureLevel level, const String &texturePathname)
{
LandscapeNode *landscape = GetLandscape();
if (!landscape)
return;
landscape->SetTexture(level, texturePathname);
SceneValidator::Instance()->ValidateTextureAndShowErrors(landscape->GetTexture(level), landscape->GetTextureName(level), Format("Landscape. TextureLevel %d", level));
if(LandscapeNode::TEXTURE_TILE_FULL != level)
{
landscape->UpdateFullTiledTexture();
}
}
示例4: CreateMaskTexture
void LandscapePropertyControl::CreateMaskTexture(const String &lightmapPath, const String &alphamaskPath)
{
Image *lightMap = Image::CreateFromFile(lightmapPath);
Image *alphaMask = Image::CreateFromFile(alphamaskPath);
if(lightMap && alphaMask)
{
if( (lightMap->GetPixelFormat() == FORMAT_RGBA8888)
&& (alphaMask->GetPixelFormat() == FORMAT_RGBA8888))
{
if( (lightMap->GetHeight() == alphaMask->GetHeight())
&& (lightMap->GetWidth() == alphaMask->GetWidth()) )
{
uint8 *lightMapData = lightMap->GetData();
uint8 *alphaMaskData = alphaMask->GetData();
int32 dataSize = lightMap->GetHeight() * lightMap->GetWidth() * 4;
for(int32 i = 0; i < dataSize; i += 4)
{
lightMapData[i + 3] = alphaMaskData[i];
}
String extension = FileSystem::Instance()->GetExtension(lightmapPath);
String path, fileName;
FileSystem::Instance()->SplitPath(lightmapPath, path, fileName);
String resultPath = path + "EditorMaskTexture" + extension;
FileSystem::Instance()->DeleteFile(resultPath);
lightMap->Save(resultPath);
propertyList->SetFilepathPropertyValue("property.landscape.lightmap", "");
propertyList->SetFilepathPropertyValue("property.landscape.alphamask", "");
propertyList->SetFilepathPropertyValue("property.landscape.texture.color", resultPath);
LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode);
if(landscape)
{
Texture::EnableMipmapGeneration();
landscape->SetTexture(LandscapeNode::TEXTURE_COLOR, resultPath);
SceneValidator::Instance()->ValidateTexture(landscape->GetTexture(LandscapeNode::TEXTURE_COLOR));
Texture::DisableMipmapGeneration();
}
}
}
}
SafeRelease(lightMap);
SafeRelease(alphaMask);
}
示例5: GenerateFullTiledTexture
void LandscapePropertyControl::GenerateFullTiledTexture(DAVA::BaseObject *object, void *userData, void *callerData)
{
LandscapeNode *landscape = GetLandscape();
if (!landscape)
return;
String texPathname = landscape->SaveFullTiledTexture();
String descriptorPathname = TextureDescriptor::GetDescriptorPathname(texPathname);
TextureDescriptor *descriptor = TextureDescriptor::CreateFromFile(descriptorPathname);
if(!descriptor)
{
descriptor = new TextureDescriptor();
descriptor->pathname = descriptorPathname;
descriptor->Save();
}
propertyList->SetFilepathPropertyValue(String("property.landscape.texture.tiledtexture"), descriptor->pathname);
landscape->SetTexture(LandscapeNode::TEXTURE_TILE_FULL, descriptor->pathname);
SafeRelease(descriptor);
}
示例6: RestoreTexturesFromNodes
void TextureConverterDialog::RestoreTexturesFromNodes(Texture *t, const String &newTexturePath, SceneNode * node)
{
int32 count = node->GetChildrenCount();
for(int32 iChild = 0; iChild < count; ++iChild)
{
SceneNode *child = node->GetChild(iChild);
LandscapeNode *landscape = dynamic_cast<LandscapeNode*>(child);
if (landscape)
{
for(int32 iTex = 0; iTex < LandscapeNode::TEXTURE_COUNT; ++iTex)
{
Texture *tex = landscape->GetTexture((LandscapeNode::eTextureLevel)iTex);
if(t == tex)
{
landscape->SetTexture((LandscapeNode::eTextureLevel)iTex, newTexturePath);
}
}
}
RestoreTexturesFromNodes(t, newTexturePath, child);
}
}
示例7: LoadResources
void LandscapeTestScreen::LoadResources()
{
#if 0
// RenderManager::Instance()->EnableOutputDebugStatsEveryNFrame(30);
RenderManager::Instance()->SetFPS(30.0);
scene = new Scene();
scene3dView = 0;
scene3dView = new UI3DView(Rect(0, 0, 480, 320));
//scene3dView->SetDebugDraw(true);
scene3dView->SetScene(scene);
scene3dView->SetInputEnabled(false);
AddControl(scene3dView);
camera = new Camera();
scene->AddCamera(camera);
camera->Setup(70.0f, 480.0f / 320.0f, 1.0f, 5000.0f);
scene->SetCurrentCamera(camera);
camera->SetDebugFlags(SceneNode::DEBUG_DRAW_ALL);
camera->SetUp(Vector3(0.0f, 0.0f, 1.0f));
camera->SetPosition(Vector3(0.0f, 0.0f, 10.0f));
scene->SetCurrentCamera(camera);
scene->SetDebugFlags(SceneNode::DEBUG_DRAW_ALL);
LandscapeNode * node = new LandscapeNode();
AABBox3 box(Vector3(445.0f / 2.0f, 445.0f / 2.0f, 0), Vector3(-445.0f / 2.0f, -445.0f / 2.0f, 50.0f));
//node->SetDebugFlags(LandscapeNode::DEBUG_DRAW_ALL);
#if 0
node->BuildLandscapeFromHeightmapImage(LandscapeNode::RENDERING_MODE_DETAIL_SHADER, "~res:/Landscape/hmp2_1.png", box);
Texture::EnableMipmapGeneration();
node->SetTexture(LandscapeNode::TEXTURE_COLOR, "~res:/Landscape/diffuse_l2.png");
node->SetTexture(LandscapeNode::TEXTURE_DETAIL, "~res:/Landscape/detail_gravel.png");
Texture::DisableMipmapGeneration();
// node->BuildLandscapeFromHeightmapImage(LandscapeNode::RENDERING_MODE_DETAIL_SHADER, "~res:/Landscape/hmp2_1.png", box);
//
// Texture::EnableMipmapGeneration();
// node->SetTexture(LandscapeNode::TEXTURE_TEXTURE0, "~res:/Landscape/tex3.png");
// node->SetTexture(LandscapeNode::TEXTURE_DETAIL, "~res:/Landscape/detail_gravel.png");
// Texture::DisableMipmapGeneration();
#else
node->BuildLandscapeFromHeightmapImage("~res:/Landscape/hmp2_1.png", box);
Texture::EnableMipmapGeneration();
node->SetTexture(LandscapeNode::TEXTURE_COLOR, "~res:/Landscape/diffuse.png");
node->SetTexture(LandscapeNode::TEXTURE_TILE0, "~res:/Landscape/blend/d.png");
node->SetTexture(LandscapeNode::TEXTURE_TILE1, "~res:/Landscape/blend/s.png");
node->SetTexture(LandscapeNode::TEXTURE_TILE2, "~res:/Landscape/blend/d.png");
node->SetTexture(LandscapeNode::TEXTURE_TILE3, "~res:/Landscape/blend/s.png");
node->SetTexture(LandscapeNode::TEXTURE_TILE_MASK, "~res:/Landscape/blend/mask.png");
Texture::DisableMipmapGeneration();
#endif
node->SetName("landscapeNode");
scene->AddNode(node);
SafeRelease(node);
// Sprite * sprite = Sprite::Create("~res:/Gfx/Billboards/billboards");
// //sprite->SetPivotPoint(sprite->GetWidth() / 2.0f, sprite->GetHeight() / 2.0f);
// SpriteNode * spriteNode = new SpriteNode(scene, sprite, 0, Vector2(0.1f, 0.1f), Vector2(sprite->GetWidth() / 2.0f, sprite->GetHeight() / 2.0f));
// spriteNode->SetName("testSpriteNode");
// spriteNode->SetLocalTransform(Matrix4::MakeTranslation(Vector3(0.f, 10.0f, 0.0f)));
// spriteNode->SetDebugFlags(SceneNode::DEBUG_DRAW_ALL);
// spriteNode->SetType(SpriteNode::TYPE_BILLBOARD);
// scene->AddNode(spriteNode);
SceneFile * file = new SceneFile();
file->SetDebugLog(true);
file->LoadScene("~res:/Scenes/level2/level2_445.sce", scene);
scene->AddNode(scene->GetRootNode("~res:/Scenes/level2/level2_445.sce"));
SafeRelease(file);
inTouch = false;
scene3dView = 0;
scene3dView = new UI3DView(Rect(0, 0, 480, 320));
scene3dView->SetInputEnabled(false);
scene3dView->SetScene(scene);
AddControl(scene3dView);
viewXAngle = 0;
viewYAngle = 0;
positionJoypad = new UIJoypad(Rect(0, 320 - 80, 80, 80));
positionJoypad->GetBackground()->SetSprite("~res:/Gfx/Joypad/joypad", 0);
positionJoypad->SetStickSprite("~res:/Gfx/Joypad/joypad", 1);
AddControl(positionJoypad);
angleJoypad = new UIJoypad(Rect(480 - 80, 320 - 80, 80, 80));
angleJoypad->GetBackground()->SetSprite("~res:/Gfx/Joypad/joypad", 0);
angleJoypad->SetStickSprite("~res:/Gfx/Joypad/joypad", 1);
AddControl(angleJoypad);
#endif
}