void LandscapePropertyControl::OnFloatPropertyChanged(PropertyList *forList, const String &forKey, float newValue) { if("property.landscape.size" == forKey || "property.landscape.height" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); 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)); String heightMap = propertyList->GetFilepathPropertyValue("property.landscape.heightmap"); if(EditorSettings::IsValidPath(heightMap) && heightMap.length()) { landscape->BuildLandscapeFromHeightmapImage(heightMap, bbox); } } if ("property.landscape.texture0.tilex" == forKey || "property.landscape.texture0.tiley" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture0.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture0.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE0, tiling); } if ("property.landscape.texture1.tilex" == forKey || "property.landscape.texture1.tiley" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture1.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture1.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE1, tiling); } if ("property.landscape.texture2.tilex" == forKey || "property.landscape.texture2.tiley" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture2.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture2.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE2, tiling); } if ("property.landscape.texture3.tilex" == forKey || "property.landscape.texture3.tiley" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture3.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture3.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE3, tiling); } if ("property.material.dencity" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); landscape->SetFogDensity(newValue); } NodesPropertyControl::OnFloatPropertyChanged(forList, forKey, newValue); }
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); } } } }
void LandscapePropertyControl::OnFloatPropertyChanged(PropertyList *forList, const String &forKey, float newValue) { if("property.landscape.size" == forKey || "property.landscape.height" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) { 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)); Set<String> errorsLog; String heightMap = propertyList->GetFilepathPropertyValue("property.landscape.heightmap"); if(SceneValidator::Instance()->ValidateHeightmapPathname(heightMap, errorsLog) && heightMap.length()) { landscape->BuildLandscapeFromHeightmapImage(heightMap, bbox); } } } if ("property.landscape.texture0.tilex" == forKey || "property.landscape.texture0.tiley" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) { Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture0.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture0.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE0, tiling); } } if ("property.landscape.texture1.tilex" == forKey || "property.landscape.texture1.tiley" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) { Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture1.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture1.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE1, tiling); } } if ("property.landscape.texture2.tilex" == forKey || "property.landscape.texture2.tiley" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) { Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture2.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture2.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE2, tiling); } } if ("property.landscape.texture3.tilex" == forKey || "property.landscape.texture3.tiley" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) { Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture3.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture3.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE3, tiling); } } if ("property.material.dencity" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) landscape->SetFogDensity(newValue); } NodesPropertyControl::OnFloatPropertyChanged(forList, forKey, newValue); }