Cooperative luminescence as a defining process for RE-ions clustering in glasses and crystals