本文整理汇总了C++中LandscapeNode类的典型用法代码示例。如果您正苦于以下问题:C++ LandscapeNode类的具体用法?C++ LandscapeNode怎么用?C++ LandscapeNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LandscapeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void LandscapePropertyControl::OnBoolPropertyChanged(PropertyList *forList, const String &forKey, bool newValue)
{
if("property.landscape.showgrid" == forKey)
{
// RETURN TO THIS CODE LATER
// LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode);
//
// if(newValue)
// {
// landscape->SetDebugFlags(landscape->GetDebugFlags() | DebugRenderComponent::DEBUG_DRAW_GRID);
// }
// else
// {
// landscape->SetDebugFlags(landscape->GetDebugFlags() & ~DebugRenderComponent::DEBUG_DRAW_GRID);
// }
}
else if (String("property.material.fogenabled") == forKey)
{
LandscapeNode *landscape = GetLandscape();
if (!landscape)
return;
landscape->SetFog(newValue);
}
NodesPropertyControl::OnBoolPropertyChanged(forList, forKey, newValue);
}
示例2: size
void LandscapePropertyControl::OnFilepathPropertyChanged(PropertyList *forList, const String &forKey, const String &newValue)
{
if(EditorSettings::IsValidPath(newValue))
{
LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode);
if("property.landscape.heightmap" == forKey)
{
Vector3 size(
propertyList->GetFloatPropertyValue("property.landscape.size"),
propertyList->GetFloatPropertyValue("property.landscape.size"),
propertyList->GetFloatPropertyValue("property.landscape.height"));
AABBox3 bbox;
bbox.AddPoint(Vector3(-size.x/2.f, -size.y/2.f, 0.f));
bbox.AddPoint(Vector3(size.x/2.f, size.y/2.f, size.z));
if(newValue.length())
{
landscape->BuildLandscapeFromHeightmapImage(newValue, bbox);
}
}
else if("property.landscape.texture.tile0" == forKey)
{
SetLandscapeTexture(LandscapeNode::TEXTURE_TILE0, newValue);
}
else if("property.landscape.texture.tile1" == forKey)
{
SetLandscapeTexture(LandscapeNode::TEXTURE_TILE1, newValue);
}
else if("property.landscape.texture.tile2" == forKey)
{
SetLandscapeTexture(LandscapeNode::TEXTURE_TILE2, newValue);
}
else if("property.landscape.texture.tile3" == forKey)
{
SetLandscapeTexture(LandscapeNode::TEXTURE_TILE3, newValue);
}
else if("property.landscape.texture.tilemask" == forKey)
{
SetLandscapeTexture(LandscapeNode::TEXTURE_TILE_MASK, newValue);
}
else if("property.landscape.texture.color" == forKey)
{
SetLandscapeTexture(LandscapeNode::TEXTURE_COLOR, newValue);
}
else if("property.landscape.texture.tiledtexture" == forKey)
{
SetLandscapeTexture(LandscapeNode::TEXTURE_TILE_FULL, newValue);
}
else if( "property.landscape.lightmap" == forKey
|| "property.landscape.alphamask" == forKey)
{
String lightMap = propertyList->GetFilepathPropertyValue("property.landscape.lightmap");
String alphaMask = propertyList->GetFilepathPropertyValue("property.landscape.alphamask");
CreateMaskTexture(lightMap, alphaMask);
}
}
NodesPropertyControl::OnFilepathPropertyChanged(forList, forKey, newValue);
}
示例3: 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);
}
示例4: OnColorPropertyChanged
void LandscapePropertyControl::OnColorPropertyChanged(PropertyList *forList, const String &forKey, const Color& newColor)
{
if("property.material.fogcolor" == forKey)
{
LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode);
landscape->SetFogColor(newColor);
}
PropertyListDelegate::OnColorPropertyChanged(forList, forKey, newColor);
}
示例5: OnComboIndexChanged
void LandscapePropertyControl::OnComboIndexChanged(
PropertyList *forList, const String &forKey, int32 newItemIndex, const String &newItemKey)
{
if("property.landscape.tilemode" == forKey)
{
LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode);
landscape->SetTiledShaderMode((LandscapeNode::eTiledShaderMode)newItemIndex);
}
NodesPropertyControl::OnComboIndexChanged(forList, forKey, newItemIndex, newItemKey);
}
示例6: GetLandscape
void LandscapePropertyControl::SaveHeightmapToPng(DAVA::BaseObject *object, void *userData, void *callerData)
{
LandscapeNode *landscape = GetLandscape();
if (!landscape)
return;
Heightmap * heightmap = landscape->GetHeightmap();
String heightmapPath = landscape->GetHeightmapPathname();
heightmapPath = FileSystem::ReplaceExtension(heightmapPath, ".png");
heightmap->SaveToImage(heightmapPath);
}
示例7: 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();
}
}
示例8: 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);
}
示例9: AddFilepathProperty
void LandscapePropertyControl::AddFilepathProperty(const String &key, const String &filter, LandscapeNode::eTextureLevel level)
{
LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode);
Texture * t = landscape->GetTexture(level);
propertyList->AddFilepathProperty(key, filter, true, PropertyList::PROPERTY_IS_EDITABLE);
if(t && !t->isRenderTarget)
{
propertyList->SetFilepathPropertyValue(key, landscape->GetTextureName(level));
}
else
{
propertyList->SetFilepathPropertyValue(key, String(""));
}
}
示例10: EnumerateTexturesFromNodes
void TextureConverterDialog::EnumerateTexturesFromNodes(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 *t = landscape->GetTexture((LandscapeNode::eTextureLevel)iTex);
CollectTexture(t);
}
}
EnumerateTexturesFromNodes(child);
}
}
示例11: 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);
}
}
示例12: SetupFog
void MaterialEditor::SetupFog(bool enabled, float32 dencity, const DAVA::Color &newColor)
{
for(int32 i = 0; i < (int32)materials.size(); ++i)
{
materials[i]->SetFog(enabled);
materials[i]->SetFogDensity(dencity);
materials[i]->SetFogColor(newColor);
}
if(workingScene)
{
EditorScene *editorScene = dynamic_cast<EditorScene *>(workingScene);
if(editorScene)
{
LandscapeNode *landscape = editorScene->GetLandscape(editorScene);
if (landscape)
{
landscape->SetFog(enabled);
landscape->SetFogDensity(dencity);
landscape->SetFogColor(newColor);
}
}
}
}
示例13: if
void LandscapePropertyControl::OnBoolPropertyChanged(PropertyList *forList, const String &forKey, bool newValue)
{
if("property.landscape.showgrid" == forKey)
{
LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode);
if(newValue)
{
landscape->SetDebugFlags(landscape->GetDebugFlags() | SceneNode::DEBUG_DRAW_GRID);
}
else
{
landscape->SetDebugFlags(landscape->GetDebugFlags() & ~SceneNode::DEBUG_DRAW_GRID);
}
}
else if (String("property.material.fogenabled") == forKey)
{
LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode);
landscape->SetFog(newValue);
}
NodesPropertyControl::OnBoolPropertyChanged(forList, forKey, newValue);
}
示例14: DVASSERT
void LandscapePropertyControl::ReadFrom(SceneNode * sceneNode)
{
NodesPropertyControl::ReadFrom(sceneNode);
LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (sceneNode);
DVASSERT(landscape);
propertyList->AddSection("property.landscape.landscape", GetHeaderState("property.landscape.landscape", true));
propertyList->AddFloatProperty("property.landscape.size", PropertyList::PROPERTY_IS_EDITABLE);
propertyList->AddFloatProperty("property.landscape.height", PropertyList::PROPERTY_IS_EDITABLE);
Vector3 size(445.0f, 445.0f, 50.f);
AABBox3 bbox = landscape->GetBoundingBox();
AABBox3 emptyBox;
if((emptyBox.min != bbox.min) && (emptyBox.max != bbox.max))
{
AABBox3 transformedBox;
bbox.GetTransformedBox(landscape->GetWorldTransform(), transformedBox);
size = transformedBox.max - transformedBox.min;
}
propertyList->SetFloatPropertyValue("property.landscape.size", size.x);
propertyList->SetFloatPropertyValue("property.landscape.height", size.z);
propertyList->AddComboProperty("property.landscape.tilemode", tiledModes);
propertyList->SetComboPropertyIndex("property.landscape.tilemode", landscape->GetTiledShaderMode());
propertyList->AddFilepathProperty("property.landscape.heightmap", ".png;.heightmap", false, PropertyList::PROPERTY_IS_EDITABLE);
propertyList->SetFilepathPropertyValue("property.landscape.heightmap", landscape->GetHeightmapPathname());
propertyList->AddSubsection("property.landscape.subsection.textures");
AddFilepathProperty(String("property.landscape.texture.color"), String(".png;.pvr"), LandscapeNode::TEXTURE_COLOR);
AddFilepathProperty(String("property.landscape.texture.tile0"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE0);
AddFilepathProperty(String("property.landscape.texture.tile1"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE1);
AddFilepathProperty(String("property.landscape.texture.tile2"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE2);
AddFilepathProperty(String("property.landscape.texture.tile3"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE3);
AddFilepathProperty(String("property.landscape.texture.tilemask"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE_MASK);
AddFilepathProperty(String("property.landscape.texture.tiledtexture"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE_FULL);
propertyList->AddMessageProperty(String("property.landscape.generatefulltiled"),
Message(this, &LandscapePropertyControl::GenerateFullTiledTexture));
propertyList->AddSubsection("property.landscape.subsection.build_mask");
propertyList->AddFilepathProperty("property.landscape.lightmap", String(".png;.pvr"), true, PropertyList::PROPERTY_IS_EDITABLE);
propertyList->AddFilepathProperty("property.landscape.alphamask", String(".png;.pvr"), true, PropertyList::PROPERTY_IS_EDITABLE);
propertyList->SetFilepathPropertyValue("property.landscape.lightmap", String(""));
propertyList->SetFilepathPropertyValue("property.landscape.alphamask", String(""));
propertyList->AddBoolProperty("property.landscape.showgrid", PropertyList::PROPERTY_IS_EDITABLE);
bool showGrid = (0 != (landscape->GetDebugFlags() & SceneNode::DEBUG_DRAW_GRID));
propertyList->SetBoolPropertyValue("property.landscape.showgrid", showGrid);
propertyList->AddIntProperty("lightmap.size");
propertyList->SetIntPropertyValue("lightmap.size", currentSceneNode->GetCustomProperties()->GetInt32("lightmap.size", 1024));
propertyList->AddFloatProperty("property.landscape.texture0.tilex");
propertyList->SetFloatPropertyValue("property.landscape.texture0.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE0).x);
propertyList->AddFloatProperty("property.landscape.texture0.tiley");
propertyList->SetFloatPropertyValue("property.landscape.texture0.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE0).y);
propertyList->AddFloatProperty("property.landscape.texture1.tilex");
propertyList->SetFloatPropertyValue("property.landscape.texture1.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE1).x);
propertyList->AddFloatProperty("property.landscape.texture1.tiley");
propertyList->SetFloatPropertyValue("property.landscape.texture1.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE1).y);
propertyList->AddFloatProperty("property.landscape.texture2.tilex");
propertyList->SetFloatPropertyValue("property.landscape.texture2.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE2).x);
propertyList->AddFloatProperty("property.landscape.texture2.tiley");
propertyList->SetFloatPropertyValue("property.landscape.texture2.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE2).y);
propertyList->AddFloatProperty("property.landscape.texture3.tilex");
propertyList->SetFloatPropertyValue("property.landscape.texture3.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE3).x);
propertyList->AddFloatProperty("property.landscape.texture3.tiley");
propertyList->SetFloatPropertyValue("property.landscape.texture3.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE3).y);
ControlsFactory::AddFogSubsection(propertyList, landscape->IsFogEnabled(), landscape->GetFogDensity(), landscape->GetFogColor());
}
示例15: Scene
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
}