Package jsynoptic.plugins.java3d.edit

Source Code of jsynoptic.plugins.java3d.edit.PointLightEdit$LightAttenuationEdit

/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info:  http://jsynoptic.sourceforge.net/index.html
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 2001-2007, by :
*     Corporate:
*         EADS Astrium
*     Individual:
*         Claude Cazenave
*
* $Id: PointLightEdit.java,v 1.1 2008/03/11 06:51:07 cazenave Exp $
*
* Changes
* -------
* 10 mars 08  : Initial public release
*
*/
package jsynoptic.plugins.java3d.edit;

import javax.media.j3d.Light;
import javax.media.j3d.PointLight;
import javax.vecmath.Point3f;

/**
*
*/
public class PointLightEdit extends LightEdit {
    public static final String LightPosition = "LightPosition";
    public static final String LightAttenuation = "LightAttenuation";
   
    /**
     * @param object
     */
    public PointLightEdit(PointLight object) {
        super(object);
    }
   
    @Override
    protected void buildProperties() {
        super.buildProperties();
        _properties.add(new LightPositionEdit(_object));
        _properties.add(new LightAttenuationEdit(_object));
    }

    public static class LightPositionEdit extends PropertyEdit<Light, Point3f>{

        public LightPositionEdit(Light object) {
            super(object, LightPosition);
        }

        @Override
        public Point3f getPropertyValue() {
            Point3f res=new Point3f();
            ((PointLight)_object).getPosition(res);
            return res;
        }

        @Override
        public void setPropertyValue(Point3f value) {
            boolean forced=forceCapability(PointLight.ALLOW_POSITION_WRITE);
            ((PointLight)_object).setPosition(value);
            if(forced) restoreCapability(PointLight.ALLOW_POSITION_WRITE);
        }

        @Override
        public String getDisplayClassName() {
            return "jsynoptic.plugins.java3d.panels.Tuple3fTable";
        }
       
    }
   
    public static class LightAttenuationEdit extends PropertyEdit<Light, Point3f>{

        public LightAttenuationEdit(Light object) {
            super(object, LightAttenuation);
        }

        @Override
        public Point3f getPropertyValue() {
            Point3f res=new Point3f();
            ((PointLight)_object).getAttenuation(res);
            return res;
        }

        @Override
        public void setPropertyValue(Point3f value) {
            boolean forced=forceCapability(PointLight.ALLOW_ATTENUATION_WRITE);
            ((PointLight)_object).setAttenuation(value);
            if(forced) restoreCapability(PointLight.ALLOW_ATTENUATION_WRITE);
        }

        @Override
        public String getDisplayClassName() {
            return "jsynoptic.plugins.java3d.panels.Tuple3fTable$Attenuation";
        }
       
    }
   

}
TOP

Related Classes of jsynoptic.plugins.java3d.edit.PointLightEdit$LightAttenuationEdit

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.