/** Gets the appearance of the primitive (defaults to first subpart). */ public Appearance getAppearance(){ return getShape(0).getAppearance(); }
/** * Gets the appearance of the specified part of the cylinder. * * @param partId identifier for a given subpart of the cylinder * * @return The appearance object associated with the partID. If an * invalid partId is passed in, null is returned. * * @since Java 3D 1.2.1 */ @Override public Appearance getAppearance(int partId) { if (partId > BOTTOM || partId < BODY) return null; return getShape(partId).getAppearance(); }
/** * Gets the appearance of the specified part of the sphere. * * @param partId identifier for a given subpart of the sphere * * @return The appearance object associated with the partID. If an * invalid partId is passed in, null is returned. * * @since Java 3D 1.2.1 */ @Override public Appearance getAppearance(int partId) { if (partId != BODY) return null; return getShape(partId).getAppearance(); }
/** * Gets the appearance of the specified part of the cone. * * @param partId identifier for a given subpart of the cone * * @return The appearance object associated with the partID. If an * invalid partId is passed in, null is returned. * * @since Java 3D 1.2.1 */ @Override public Appearance getAppearance(int partId) { if (partId > CAP || partId < BODY) return null; return getShape(partId).getAppearance(); }
/** * Gets the appearance of the specified part of the box. * * @param partId identifier for a given subpart of the box * * @return The appearance object associated with the partID. If an * invalid partId is passed in, null is returned. * * @since Java 3D 1.2.1 */ @Override public Appearance getAppearance(int partId) { if (partId > BOTTOM || partId < FRONT) return null; return getShape(partId).getAppearance(); }
/** * Get the Appearance object for the Shape3D of the specified axis; Note that * both front and back shapes share the same Appearance. */ public Appearance getAppearance(final int axis, final int index) { final Group frontGroup = (Group) axisSwitch.getChild(axisIndex[axis][FRONT]); return ((Shape3D) ((Group) frontGroup.getChild(index)).getChild(0)) .getAppearance(); }
public SphereState( SymbolTableData symbol, Controller control ) { super( symbol, control ); if (node!=null) { bodyAppearance = control.getSymbolTable().addReference( ((Sphere)node).getShape( Sphere.BODY ).getAppearance() ); } }
public ConeState(SymbolTableData symbol,Controller control) { super( symbol, control ); if (node!=null) { bodyAppearance = control.getSymbolTable().addReference( ((Cone)node).getShape( Cone.BODY ).getAppearance() ); capAppearance = control.getSymbolTable().addReference( ((Cone)node).getShape( Cone.CAP ).getAppearance() ); } }
public CylinderState( SymbolTableData symbol, Controller control ) { super( symbol, control ); if (node!=null) { bodyAppearance = control.getSymbolTable().addReference( ((Cylinder)node).getShape( Cylinder.BODY ).getAppearance() ); topAppearance = control.getSymbolTable().addReference( ((Cylinder)node).getShape( Cylinder.TOP ).getAppearance() ); bottomAppearance = control.getSymbolTable().addReference( ((Cylinder)node).getShape( Cylinder.BOTTOM ).getAppearance() ); } }
public BoxState( SymbolTableData symbol, Controller control ) { super( symbol, control ); if (node!=null) { frontAppearance = control.getSymbolTable().addReference( ((Box)node).getShape( Box.FRONT ).getAppearance() ); backAppearance = control.getSymbolTable().addReference( ((Box)node).getShape( Box.BACK ).getAppearance() ); topAppearance = control.getSymbolTable().addReference( ((Box)node).getShape( Box.TOP ).getAppearance() ); bottomAppearance = control.getSymbolTable().addReference( ((Box)node).getShape( Box.BOTTOM ).getAppearance() ); leftAppearance = control.getSymbolTable().addReference( ((Box)node).getShape( Box.LEFT ).getAppearance() ); rightAppearance = control.getSymbolTable().addReference( ((Box)node).getShape( Box.RIGHT ).getAppearance() ); } }
public ShapeGroup duplicate() { final ShapeGroup ret = new ShapeGroup(); if (shape != null) { ret.shape = new Shape3D(shape.getGeometry(), shape.getAppearance()); ret.group.addChild(ret.shape); } ret.pos = pos; return ret; } }
/** * Sets the color of the 6DOF sensor echo. The default is white. This * can be called to set the color before or after the echo geometry is * created. * * @param color the echo color */ public void setEchoColor(Color3f color) { if (echoColor == null) echoColor = new Color3f(color) ; else echoColor.set(color) ; if (echoGeometry != null) { Appearance a = echoGeometry.getAppearance() ; Material m = a.getMaterial() ; m.setDiffuseColor(echoColor) ; } }
public Shape3DState( SymbolTableData symbol, Controller control ) { super( symbol, control ); if (node!=null) { appearance = control.getSymbolTable().addReference( ((Shape3D)node).getAppearance() ); int length = ((Shape3D)node).numGeometries(); geometry = new int[length]; for(int i=0; i<length; i++) geometry[i] = control.getSymbolTable().addReference( ((Shape3D)node).getGeometry(i) ); } }
/** * Sets the slice index of the specified plane to the given value. * * @param axis * @param v */ public void setSlice(final int axis, final int v) { if (v >= dimensions[axis] || v < 0) return; slices[axis] = v; final Group g = (Group) axisSwitch.getChild(axisIndex[axis][FRONT]); final int num = g.numChildren(); if (num > 1) System.out.println(num + " children, expected only 1"); final Shape3D shape = (Shape3D) ((Group) g.getChild(num - 1)).getChild(0); final double[] quadCoords = geomCreator.getQuadCoords(axis, v); ((QuadArray) shape.getGeometry()).setCoordinates(0, quadCoords); final Texture2D tex = appCreator.getTexture(axis, v); shape.getAppearance().setTexture(tex); final TexCoordGeneration tg = appCreator.getTg(axis); shape.getAppearance().setTexCoordGeneration(tg); } }
/** * Use the currently selected color to paint an edge. * * @param shape a Java3D shape - must be a LineArray * */ void highlightEdge(Shape3D shape) { Color3f highlightColor = volumes.getSelectedColor(); if (shape.getGeometry() instanceof LineArray) { Appearance appearance = shape.getAppearance(); ColoringAttributes ca = appearance.getColoringAttributes(); Color3f before = new Color3f(); appearance.setColoringAttributes(ca); ca.getColor(before); ca.setColor(highlightColor); } }
/** * Sets the 6DOF sensor echo transparency. The default is opaque. A * value of 0.0 is fully opaque and 1.0 is fully transparent. This can be * called to set the transparency before or after the echo geometry is * created. * * @param transparency the transparency value */ public void setEchoTransparency(float transparency) { echoTransparency = transparency ; if (echoGeometry != null) { Appearance a = echoGeometry.getAppearance() ; TransparencyAttributes ta = a.getTransparencyAttributes() ; if (echoTransparency == 0.0f) { ta.setTransparencyMode(TransparencyAttributes.NONE) ; ta.setTransparency(0.0f) ; } else { ta.setTransparencyMode(TransparencyAttributes.BLENDED) ; ta.setTransparency(echoTransparency) ; // Use order independent additive blend for gnomon. if (echoGeometry instanceof SensorGnomonEcho) ta.setDstBlendFunction(TransparencyAttributes.BLEND_ONE) ; } } }
Appearance a = shapes[s].getAppearance() ; if (a != null) { Material m = a.getMaterial() ;
/** * Draw the specified Shape3D leaf node object. This is * a convenience method that is identical to calling the * setAppearance(Appearance) and draw(Geometry) methods * passing the appearance and geometry component objects of * the specified shape node as arguments. * * @param shape the Shape3D node containing the Appearance component * object to set and Geometry component object to draw * * @exception IllegalSharingException if the Shape3D node * is part of or is subsequently made part of a live scene graph. * * @exception IllegalSharingException if the Shape3D node's Appearance * refers to an ImageComponent2D that is being used by a * Canvas3D as an off-screen buffer. */ public void draw(Shape3D shape) { if (shape.isLive()) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D26")); } ((Shape3DRetained)shape.retained).setInImmCtx(true); setAppearance(shape.getAppearance()); draw(shape.getGeometry()); }
Shape3D shape = (Shape3D) node; if (shape.getGeometry() instanceof LineArray) { Appearance appearance = shape.getAppearance(); ColoringAttributes ca = appearance.getColoringAttributes(); ca.getColor(currentColor);
Appearance a = echoGeometry.getAppearance() ; if (echoColor != null) { Material m = a.getMaterial() ;