public Appearance getAppearance(final CubeData cdata, final int index) { final Appearance a = new Appearance(); a.setMaterial(material); a.setTransparencyAttributes(transAttr); a.setPolygonAttributes(polyAttr); a.setColoringAttributes(colAttr); a.setRenderingAttributes(rendAttr); a.setTexture(getTexture(cdata, index)); a.setTexCoordGeneration(cdata.tg); a.setTextureAttributes(texAttr); return a; }
/** * 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); } }
GeometryArray.TEXTURE_COORDINATE_2) == 0) { TexCoordGeneration tcg = new TexCoordGeneration(); a.setTexCoordGeneration(tcg);
@Override public void buildGraph() { Appearance app = (Appearance)node; app.setPolygonAttributes( (PolygonAttributes)control.getSymbolTable().getJ3dNode(polygonAttributes) ); app.setRenderingAttributes( (RenderingAttributes)control.getSymbolTable().getJ3dNode(renderingAttributes) ); app.setColoringAttributes( (ColoringAttributes)control.getSymbolTable().getJ3dNode(coloringAttributes) ); app.setLineAttributes( (LineAttributes)control.getSymbolTable().getJ3dNode(lineAttributes) ); app.setMaterial( (Material)control.getSymbolTable().getJ3dNode(material) ); app.setPointAttributes( (PointAttributes)control.getSymbolTable().getJ3dNode(pointAttributes) ); app.setTexCoordGeneration( (TexCoordGeneration)control.getSymbolTable().getJ3dNode(texCoordGeneration) ); app.setTextureAttributes( (TextureAttributes)control.getSymbolTable().getJ3dNode(textureAttributes) ); app.setTexture( (Texture)control.getSymbolTable().getJ3dNode(texture) ); TextureUnitState[] texUnitState = new TextureUnitState[ textureUnitState.length ]; for(int i=0; i<textureUnitState.length; i++) texUnitState[i] = (TextureUnitState)control.getSymbolTable().getJ3dNode(textureUnitState[i]); if (texUnitState.length>0) // TODO - remove if, workaround for bug in daily app.setTextureUnitState( texUnitState ); app.setTransparencyAttributes( (TransparencyAttributes)control.getSymbolTable().getJ3dNode(transparencyAttributes) ); super.buildGraph(); // Must be last call in method }
appearance.setTexCoordGeneration(getTg());
appearance.setTexCoordGeneration(getTg());