Package com.sun.j3d.utils.picking

Examples of com.sun.j3d.utils.picking.PickIntersection


    // => ignore the JTree selection of the whole shape in this example
    if (!(parameter instanceof PickResult)) return;

    PickResult result = (PickResult)parameter;
    result.setFirstIntersectOnly(true);
    PickIntersection pi = result.getIntersection(0);

    // indices of the picked triangle
    // should always be triangle at this point
    // Indices are set to vertex indices, as this is not an Index Geometry object
    int[] idx = pi.getPrimitiveColorIndices();
    FloatBuffer colors = (FloatBuffer)(pi.getGeometryArray()).getColorRefBuffer().getBuffer();
    float[] color = new float[3];
   
    // The index returned by this method is relative the the array returned above,
    // not the shape geometry array!
    int closest = pi.getClosestVertexIndex();

    // This method is called both when highlighting the shape and when de-selecting it
    // => handles both, so as to restore the original colors
    // Tip : try to hold CTRL while picking elements, for multiple selection
    // => this method is called exactly once for each element state change
View Full Code Here

TOP

Related Classes of com.sun.j3d.utils.picking.PickIntersection

Copyright © 2018 www.massapicom. 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.