protected void setCouleurs(final Color4f[] _c) { ((GeometryArray) shape_.getGeometry()).setColors(0, _c); }
/** * colore l'objet d'une couleur unique. */ public boolean setCouleur(final Color _c) { if (shape_ == null || shape_.getGeometry() == null) { return false; } isColorUsed_ = true; final int nbPts = ((GeometryArray) shape_.getGeometry()).getVertexCount(); shape_.getAppearance().getColoringAttributes().setColor(new Color3f(_c)); final Color4f[] cs = new Color4f[nbPts]; Arrays.fill(cs, new Color4f(_c)); ((GeometryArray) shape_.getGeometry()).setColors(0, cs); return true; }
public boolean setCouleur(final Color _c) { if (nbExtPt_ > 0) { if (shape_ == null || shape_.getGeometry() == null) { return false; } isColorUsed_ = true; final IndexedLineArray indexedLineArray = ((IndexedLineArray) shape_.getGeometry()); final int nbPts = indexedLineArray.getVertexCount(); final int nbIndices = indexedLineArray.getIndexCount(); // MODIF AVA pour j3d1.2 Color3f couleur=new // Color3f((float)c.getRed()/255,(float)c.getGreen()/255,(float)c.getBlue()/255); // MODIF AVA pour j3d1.2 // shape_.getAppearance().getMaterial().setDiffuseColor(new Color3f(_c)); // shape_.getAppearance().getColoringAttributes().setColor(new Color3f(_c)); final Color4f[] cs = new Color4f[nbPts]; Arrays.fill(cs, new Color4f(_c)); final Color4f in = new Color4f(_c.brighter()); in.scale(0.6f); for (int i = nbExtPt_; i < cs.length; i++) { cs[i] = in; } ((GeometryArray) shape_.getGeometry()).setColors(0, cs); for (int i = 0; i < nbIndices; i++) { indexedLineArray.setColorIndex(i, i / 2); } } else { return super.setCouleur(_c); } return true; }