private Appearance getAppearance(String f) throws Exception { Appearance app = new Appearance(); URL texImage = new java.net.URL("file:" + f); Texture tex = new TextureLoader(texImage, this).getTexture(); app.setTexture(tex); TextureAttributes texAttr = new TextureAttributes(); texAttr.setTextureMode(TextureAttributes.MODULATE); app.setTextureAttributes(texAttr); return app; }
ap.setTexture(texture); caja.setAppearance(Box.BACK,ap); ap2.setTexture(texture); caja.setAppearance(Box.TOP,ap2); ap3.setTexture(texture); caja.setAppearance(Box.BOTTOM,ap3); ap4.setTexture(texture); caja.setAppearance(Box.LEFT,ap4); ap5.setTexture(texture); caja.setAppearance(Box.RIGHT,ap5); ap6.setTexture(texture); caja.setAppearance(Box.FRONT,ap6);
@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 }
texture.setBoundaryModeS(Texture.WRAP); texture.setBoundaryModeT(Texture.WRAP); texture.setBoundaryColor(new Color4f(0.0f, 1.0f, 0.0f, 0.0f)); TextureAttributes texAttr = new TextureAttributes(); texAttr.setTextureMode(TextureAttributes.MODULATE); Appearance ap = new Appearance(); ap.setTexture(texture); ap.setTextureAttributes(texAttr); int primflags = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS; ObjectFile loader = new ObjectFile(ObjectFile.RESIZE);
/** * Creates Appearance for this Shape3D. This sets transparency * for the object (we want the text to be "floating" in space, * so only the text itself should be non-transparent. Also, the * appearance disables lighting for the object; the text will * simply be colored, not lit. */ private Appearance setupAppearance(Texture2D t2d) { Appearance appearance = getAppearance(); if (appearance == null) { TransparencyAttributes transp = new TransparencyAttributes(); transp.setTransparencyMode(TransparencyAttributes.BLENDED); transp.setTransparency(0f); appearance = new Appearance(); appearance.setTransparencyAttributes(transp); appearance.setTexture(t2d); Material m = new Material(); m.setLightingEnable(false); appearance.setMaterial(m); appearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE); appearance.setCapability(Appearance.ALLOW_TEXTURE_READ); appearance.setCapabilityIsFrequent(Appearance.ALLOW_TEXTURE_READ); }else{ appearance.setTexture(t2d); } return appearance; }
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); } }
appearance.setRenderingAttributes(rendAttr); appearance.setTexture(getTexture()); appearance.setTexCoordGeneration(getTg());
app.setTexture( tex );
appearance.setRenderingAttributes(rendAttr); appearance.setTexture(getTexture()); appearance.setTexCoordGeneration(getTg());
Texture tex = texture.getTexture(); tex.setEnable(true); appearance.setTexture(tex); TextureAttributes ta = new TextureAttributes(); if (texture.getType().equals("DTEX"))
appear.setTexture(texture); PolygonAttributes polygonAttributes = new PolygonAttributes(); polygonAttributes.setCullFace(PolygonAttributes.CULL_NONE);
getAppearance().setTexture(newTex); } else { getAppearance().getTextureUnitState(0).setTexture(newTex);