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));
pa.setPolygonMode(PolygonAttributes.POLYGON_FILL); pa.setCullFace(PolygonAttributes.CULL_NONE); Material mat=new Material(); mat.setEmissiveColor(new Color3f(0.5f,0.5f,0.5f)); mat.setAmbientColor(new Color3f(0.1f,0.1f,0.1f));
pa.setPolygonMode(PolygonAttributes.POLYGON_FILL); pa.setCullFace(PolygonAttributes.CULL_NONE); Material mat=new Material(); mat.setEmissiveColor(new Color3f(0.5f,0.5f,0.5f)); mat.setAmbientColor(new Color3f(0.1f,0.1f,0.1f));
mSphere = new Sphere(1, 24, 24); Material material = new Material(); mSphere.setMaterial(material); mSphere.setDrawingMode(GLES20.GL_LINES); getCurrentScene().addChild(mSphere);
@Override protected org.scijava.java3d.SceneGraphObject createNode() { return new Material(); }
Model cube = mBuilder.createBox(block_size, block_size, block_size, new Material(), Usage.Position | Usage.Normal | Usage.TextureCoordinates);
modelBuilder.part("0", this.getCustomMesh(), GL10.GL_TRIANGLES, new Material());
Map<Material, Integer> stock = new HashMap<>(); Material material = new Material(...); stock.put(material, 100); int quantity = stock.getOrDefault(material, 0); // Java 8 int quantity = 0; // Java 7 { Integer q = stock.get(material); if (q != null) { quantity = q; } }
Model knight = assets.get(...); NodePart part1 = knight.nodes.get(0).parts.get(0); NodePart part2 = new NodePart(part1.meshPart, new Material()); knight.nodes.get(0).parts.add(part2); part1.material.set(TextureAttribute.createDiffuse(texture1)); part2.material.set(TextureAttribute.createDiffuse(texture2));
public load3dModel( String objfile, String texfile ) { ModelLoaderHints hint = new ModelLoaderHints(false); m_mesh = ModelLoaderRegistry.loadStillModel(Gdx.files.internal(objfile), hint); Texture texture = new Texture(Gdx.files.internal(texfile), Format.RGBA4444, false); Material mat = new Material("mat", new TextureAttribute(texture, 0, "u_Texture")); m_mesh.setMaterial(mat); ...
/** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ @Override public NodeComponent cloneNodeComponent() { Material m = new Material(); m.duplicateNodeComponent(this); return m; }
streamingTexture = new StreamingTexture("video", mediaPlayer); Material material = new Material(); material.setColor(0); try { material.addTexture(texture); } catch (ATexture.TextureException e) { throw new RuntimeException(e); } Sphere sphere = new Sphere(50, 64, 32); sphere.setScaleX(-1); sphere.setMaterial(material); getCurrentScene().addChild(sphere);
Material mat = new Material(); //set the diffuse channel on the texture using some texture mat.set(TextureAttribute.createDiffuse(new Texture("crate.jpg")));
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);
ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin(); MeshPartBuilder builder = modelBuilder.part("line", 1, 3, new Material()); builder.setColor(Color.RED); builder.line(0.0f, 0.0f, -5.0f, 0.0f, 0.0f, 5.0f); lineModel = modelBuilder.end(); lineInstance = new ModelInstance(lineModel);
/** 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); }
/** * 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); }
/** * 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; }
polyAttr.setCullFace(PolygonAttributes.CULL_NONE); material = new Material(); material.setLightingEnable(false);
protected Appearance createAppearance() { final Appearance appearance = new Appearance(); appearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ); final PolygonAttributes polyAttrib = new PolygonAttributes(); polyAttrib.setCapability(PolygonAttributes.ALLOW_MODE_WRITE); if (this.shaded) polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_FILL); else polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_LINE); polyAttrib.setCullFace(PolygonAttributes.CULL_NONE); polyAttrib.setBackFaceNormalFlip(true); appearance.setPolygonAttributes(polyAttrib); final ColoringAttributes colorAttrib = new ColoringAttributes(); colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD); if (null != color) // is null when colors are vertex-wise colorAttrib.setColor(color); appearance.setColoringAttributes(colorAttrib); final TransparencyAttributes tr = new TransparencyAttributes(); final int mode = TransparencyAttributes.FASTEST; tr.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE); tr.setCapability(TransparencyAttributes.ALLOW_MODE_WRITE); tr.setTransparencyMode(mode); tr.setTransparency(transparency); appearance.setTransparencyAttributes(tr); final Material material = new Material(); material.setCapability(Material.ALLOW_COMPONENT_WRITE); material.setAmbientColor(0.1f, 0.1f, 0.1f); material.setSpecularColor(0.1f, 0.1f, 0.1f); material.setDiffuseColor(0.1f, 0.1f, 0.1f); appearance.setMaterial(material); return appearance; }