Refine search
Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f,204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca); Point3f[] plaPts = new Point3f[5]; for (int i = 0; i < 2; i++) { a_point_just_bigger.setPointSize(10.0f);//10 pixel-wide point a_point_just_bigger.setPointAntialiasingEnable(true);//now points are sphere-like(not a cube) app.setPointAttributes(a_point_just_bigger); PolygonAttributes la=new PolygonAttributes(); la.setPolygonMode(PolygonAttributes.POLYGON_FILL); la.setCullFace(PolygonAttributes.CULL_NONE); app.setPolygonAttributes(la); Material matt=new Material(); matt.setAmbientColor(new Color3f(1,1,1)); matt.setDiffuseColor(new Color3f(0.5f,0.5f,0.7f)); matt.setEmissiveColor(new Color3f(0.2f,0.2f,0.3f)); matt.setShininess(0.5f); matt.setLightingEnable(true); app.setMaterial(matt); RenderingAttributes ra=new RenderingAttributes(); ra.setIgnoreVertexColors(true); app.setRenderingAttributes(ra); Shape3D plShape = new Shape3D(pla, app);
Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f, 204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca);
Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f, 204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca); app.setPointAttributes(a_point_just_bigger);
final Appearance app = new Appearance(); app.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ); polyAttrib.setCullFace(PolygonAttributes.CULL_NONE); polyAttrib.setBackFaceNormalFlip(true); app.setPolygonAttributes(polyAttrib); app.setColoringAttributes(colorAttrib); tr.setTransparencyMode(mode); tr.setTransparency(transparency); app.setTransparencyAttributes(tr); final Material material = new Material(); material.setAmbientColor(0.1f, 0.1f, 0.1f); material.setSpecularColor(0.5f, 0.5f, 0.5f); material.setDiffuseColor(0.1f, 0.1f, 0.1f); app.setMaterial(material); return app;
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; }
Material m = new Material(); p = (ObjectFileMaterial)materials.get(matName); Appearance a = new Appearance(); if (p.Ka != null) m.setAmbientColor(p.Ka); if (p.Kd != null) m.setDiffuseColor(p.Kd); a.setTexture(p.t); a.setTexCoordGeneration(tcg); a.setTransparencyAttributes( new TransparencyAttributes(TransparencyAttributes.NICEST, p.transparencyLevel)); a.setMaterial(m); if ((DEBUG & 1) != 0) System.out.println(m); shape.setAppearance(a);
@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 appearance = new Appearance(); if (shape.facetSizes[0] == 1) { appearance.setColoringAttributes(colorAtt); appearance.setPointAttributes(pointStyle); new ColoringAttributes(surf.getColor(), ColoringAttributes.FASTEST); appearance.setColoringAttributes(colorAtt); Material material = new Material(surf.getColor(), surf.getEmissiveColor(), surf.getDiffuseColor(), surf.getSpecularColor(), surf.getShininess()); material.setLightingEnable(true); appearance.setMaterial(material); if (surf.getTransparency() != 0f) { TransparencyAttributes ta = new TransparencyAttributes(); ta.setTransparency(surf.getTransparency()); ta.setTransparencyMode(ta.BLENDED); appearance.setTransparencyAttributes(ta); Texture tex = texture.getTexture(); tex.setEnable(true); appearance.setTexture(tex); TextureAttributes ta = new TextureAttributes(); if (texture.getType().equals("DTEX"))
Material m = new Material() ; m.setCapability(Material.ALLOW_COMPONENT_READ) ; m.setCapability(Material.ALLOW_COMPONENT_WRITE) ; tsa.setNormals(0, normals) ; Appearance a = new Appearance() ; a.setMaterial(m) ; a.setCapability(Appearance.ALLOW_MATERIAL_READ) ; a.setCapability(Appearance.ALLOW_MATERIAL_WRITE) ; (TransparencyAttributes.ALLOW_BLEND_FUNCTION_WRITE) ; a.setTransparencyAttributes(ta) ; a.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ) ; a.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE) ;
/** * Returns the Appearance object for the specified direction and index. This * is composed of the shared Appearance attributes plus the individual * textures. * * @param direction * @param index * @return */ public Appearance getAppearance(final int direction, final int index) { final Appearance a = new Appearance(); a.setCapability(Appearance.ALLOW_TEXTURE_UNIT_STATE_WRITE); a.setCapability(Appearance.ALLOW_TEXTURE_WRITE); a.setCapability(Appearance.ALLOW_TEXGEN_WRITE); a.setMaterial(material); a.setTransparencyAttributes(transAttr); a.setPolygonAttributes(polyAttr); a.setColoringAttributes(colAttr); a.setRenderingAttributes(rendAttr); final TextureUnitState[] tus = new TextureUnitState[2]; tus[0] = new TextureUnitState(getTexture(direction, index, volume), texAttr, getTg(direction)); tus[0].setCapability(TextureUnitState.ALLOW_STATE_WRITE); tus[1] = null; a.setTextureUnitState(tus); return a; }
/** * 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; }
Material m = new Material() ; m.setAmbientColor(curColor.x, curColor.y, curColor.z) ; m.setDiffuseColor(curColor.x, curColor.y, curColor.z) ; m.setLightingEnable(true) ; Appearance a = new Appearance() ; a.setMaterial(m) ;
private Appearance createAppearance(final Color3f color) { final Appearance a = new Appearance(); final PolygonAttributes pa = new PolygonAttributes(); pa.setPolygonMode(PolygonAttributes.POLYGON_FILL); pa.setCullFace(PolygonAttributes.CULL_NONE); a.setPolygonAttributes(pa); final ColoringAttributes ca = new ColoringAttributes(); ca.setColor(color); a.setColoringAttributes(ca); return a; }
/** * Create a default Appearance object using the specified color. * * @param color */ private void initAppearance(final Color3f color) { appearance = new Appearance(); appearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ); final ColoringAttributes colorAttrib = new ColoringAttributes(); colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD); colorAttrib.setColor(color); colorAttrib.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE); appearance.setColoringAttributes(colorAttrib); final Material material = new Material(); material.setDiffuseColor(color); appearance.setMaterial(material); }
Appearance appearance = new Appearance(); Material material = new Material(); material.setDiffuseColor(1.0f, 0.0f, 0.0f); // red material.setSpecularColor(0.2f, 0.2f, 0.2f); // reduce default values appearance.setMaterial(material);
final Appearance appearance = new Appearance(); final LineAttributes lineAtts = new LineAttributes( 4f, LineAttributes.PATTERN_SOLID, true ); appearance.setLineAttributes( lineAtts ); final TransparencyAttributes transAtts = new TransparencyAttributes( TransparencyAttributes.BLENDED, 0.2f ); appearance.setTransparencyAttributes( transAtts ); final RenderingAttributes renderingAtts = new RenderingAttributes(); renderingAtts.setAlphaTestFunction( RenderingAttributes.GREATER_OR_EQUAL ); renderingAtts.setAlphaTestValue( 0.3f ); appearance.setRenderingAttributes( renderingAtts );
/** Sets the main appearance of the primitive (all subparts) to * a default white appearance. */ public void setAppearance(){ Color3f aColor = new Color3f(0.1f, 0.1f, 0.1f); Color3f eColor = new Color3f(0.0f, 0.0f, 0.0f); Color3f dColor = new Color3f(0.6f, 0.6f, 0.6f); Color3f sColor = new Color3f(1.0f, 1.0f, 1.0f); Material m = new Material(aColor, eColor, dColor, sColor, 100.0f); Appearance a = new Appearance(); m.setLightingEnable(true); a.setMaterial(m); setAppearance(a); }
PointAttributes treePointAttr = new PointAttributes(); treePointAttr.setPointSize(TREE_POINT_THICKNESS); Appearance appear = new Appearance(); appear.setPointAttributes(attr); la.setCapability(LineArray.ALLOW_COLOR_WRITE); Appearance appearance = new Appearance(); appearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ); appearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE); appearance.setLineAttributes(lineAttributes); colorAttributes.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE); colorAttributes.setColor(EDGE_COLOR_3f); appearance.setColoringAttributes(colorAttributes);
this.transparency = transparency; appearance = new Appearance(); pa = new PolygonAttributes(); pa.setPolygonMode(PolygonAttributes.POLYGON_LINE); pa.setCullFace(PolygonAttributes.CULL_NONE); appearance.setPolygonAttributes(pa); ta = new TransparencyAttributes(); ta.setTransparency(transparency); ta.setTransparencyMode(TransparencyAttributes.FASTEST); appearance.setTransparencyAttributes(ta); ca = new ColoringAttributes(); ca.setColor(color); appearance.setColoringAttributes(ca);
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; }