/*
 * Copyright (C) 2013 Darth Affe <http://wyrez.org> and contributors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.wyrez.shootingstars.game;

import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import org.wyrez.shootingstars.data.AudioDataManager;
import org.wyrez.shootingstars.controls.GroundGlowControl;
import org.wyrez.shootingstars.factories.Materials;
import org.wyrez.shootingstars.mesh.HexPrism;

/**
 *
 * @author Darth Affe
 */
public class GlowingHexPrism extends Node {

    private Geometry prism;
    private Geometry glow;

    public GlowingHexPrism(Vector3f position, float size, float height,
            float glowPercentage, AudioDataManager adm) {
        super("HexPrism " + position);

        Material prismMat = Materials.HEX.create();
        prismMat.setColor("Diffuse", ColorRGBA.Black);
        prism = new Geometry("Prism " + position, new HexPrism(position, size, height));
        prism.setMaterial(prismMat);
        this.attachChild(prism);

        Material glowMat = Materials.GLOW.create();
        glowMat.setColor("Diffuse", ColorRGBA.White);
        glow = new Geometry("Prism " + position, new HexPrism(position.add(
                0f, height, 0f), size * glowPercentage, height * 0.001f));
        glow.setMaterial(glowMat);
        this.attachChild(glow);

        glow.addControl(new GroundGlowControl(adm));
    }
}
