Example #1
0
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);
}
void LandscapePropertyControl::OnColorPropertyChanged(PropertyList *forList, const String &forKey, const Color& newColor)
{
    if("property.material.fogcolor" == forKey)
    {
		LandscapeNode *landscape = GetLandscape();
		if (!landscape)
			return;
        landscape->SetFogColor(newColor);
    }
    
    if("property.landscape.texture.tilecolor0" == forKey)
    {
		LandscapeNode *landscape = GetLandscape();
		if (!landscape)
			return;
        landscape->SetTileColor(LandscapeNode::TEXTURE_TILE0, newColor);
    }
    if("property.landscape.texture.tilecolor1" == forKey)
    {
		LandscapeNode *landscape = GetLandscape();
		if (!landscape)
			return;
        landscape->SetTileColor(LandscapeNode::TEXTURE_TILE1, newColor);
    }
    if("property.landscape.texture.tilecolor2" == forKey)
    {
		LandscapeNode *landscape = GetLandscape();
		if (!landscape)
			return;
        landscape->SetTileColor(LandscapeNode::TEXTURE_TILE2, newColor);
    }
    if("property.landscape.texture.tilecolor3" == forKey)
    {
		LandscapeNode *landscape = GetLandscape();
		if (!landscape)
			return;
        landscape->SetTileColor(LandscapeNode::TEXTURE_TILE3, newColor);
    }
    
    PropertyListDelegate::OnColorPropertyChanged(forList, forKey, newColor);
}
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);
            }
        }
    }
}