Package syn3d.nodes.xith3d

Source Code of syn3d.nodes.xith3d.SphereNodeXith3D

/* ========================
* 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-2004, by :
*     Corporate:
*         EADS Corporate Research Center
*     Individual:
*         Nicolas Brodu
*
* $Id: SphereNodeXith3D.java,v 1.11 2005/06/14 13:12:58 ogor Exp $
*
* Changes
* -------
* 19-Mar-2004 : Creation date (NB);
*
*/
package syn3d.nodes.xith3d;

import syn3d.base.ActiveNode;
import syn3d.nodes.NodeResourcesManager;
import syn3d.util.GeodeMaker;

import com.xith3d.scenegraph.GeometryArray;
import com.xith3d.scenegraph.Shape3D;
import com.xith3d.scenegraph.TriangleArray;


/**
*
*/
public class SphereNodeXith3D extends ShapeNodeXith3D {

    protected static int anonymousNodeNumber = 0;

    public SphereNodeXith3D(ActiveNode parent) {
        super(parent);
    }

    protected Shape3D createShape() {
        float[] coords = GeodeMaker.createGeode(10);
      TriangleArray ta = new TriangleArray(coords.length / 3, GeometryArray.COORDINATES | GeometryArray.NORMALS);
      ta.setCoordinates(0,coords);
      ta.setNormals(0,coords);
     
      Shape3D s = new Shape3D(ta);
        anonymousNodeNumber++;
        name = NodeResourcesManager.getNodeName("Sphere") + ((anonymousNodeNumber == 1) ? "" : String.valueOf(anonymousNodeNumber));
        s.setName(name);
        return s;
    }
}
TOP

Related Classes of syn3d.nodes.xith3d.SphereNodeXith3D

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.