Mtl(final float alpha, final float R, final float G, final float B) { this.col = new Color4f(R, G, B, alpha); name = "mat_" + mat_index; mat_index++; }
Mtl(final float alpha, final Color3f c) { this.col = new Color4f(c.x, c.y, c.z, alpha); name = "mat_" + mat_index; mat_index++; }
/** * Sets the colors array. * The points are copied into the GeometryInfo object. */ public void setColors(Color4b colors[]) { if (colors == null) { colors3 = null; colors4 = null; } else { colors3 = null; colors4 = new Color4f[colors.length]; for (int i = 0 ; i < colors.length ; i++) { colors4[i] = new Color4f((float) (colors[i].x & 0xff) / 255.0f, (float) (colors[i].y & 0xff) / 255.0f, (float) (colors[i].z & 0xff) / 255.0f, (float) (colors[i].w & 0xff) / 255.0f); } } } // End of setColors
public Color4f readColor4f( DataInput in ) throws IOException { return (Color4f)readTuple4f( in, new Color4f() ); }
/** * Sets the texture blend color for this * appearance component object. This color is used when * the mode is BLEND. * @param r the red component of the color * @param g the green component of the color * @param b the blue component of the color * @param a the alpha component of the color */ final void setTextureBlendColor(float r, float g, float b, float a) { this.textureBlendColor.set(r, g, b, a); sendMessage(COLOR_CHANGED, new Color4f(r, g, b, a), null); }
/** * Set the color of the spot <code>key</code>. Its transparency set by the * <code>w</code> field of the {@link Color4f} argument. */ public void setColor( final K key, final Color4f color ) { final CustomTriangleMesh mesh = meshes.get( key ); if ( null == mesh ) return; mesh.setColor( new Color3f( color.x, color.y, color.z ) ); mesh.setTransparency( color.w ); colors.put( key, new Color4f( color ) ); }
/** * Sets the texture blend color for this * texture attributes object. * @param textureBlendColor the texture blend color used when * the mode is BLEND */ final void setTextureBlendColor(Color4f textureBlendColor) { this.textureBlendColor.set(textureBlendColor); sendMessage(COLOR_CHANGED, new Color4f(textureBlendColor), null); }
/** * Set the color of the spot <code>key</code>. Its transparency set by the * <code>w</code> field of the {@link Color4f} argument. */ public void setColor( final K key, final Color4f color ) { final CustomTriangleMesh mesh = meshes.get( key ); if ( null == mesh ) return; mesh.setColor( new Color3f( color.x, color.y, color.z ) ); mesh.setTransparency( color.w ); colors.put( key, new Color4f( color ) ); }
public static void main(final String[] args) { final ij3d.Image3DUniverse u = new ij3d.Image3DUniverse(); u.show(); final List<Point3f> pts = new ArrayList<Point3f>(); pts.add(new Point3f(0, 0, 0)); pts.add(new Point3f(1, 0, 0)); pts.add(new Point3f(1, 1, 0)); final CustomTransparentTriangleMesh m = new CustomTransparentTriangleMesh(pts); final List<Color4f> cols = new ArrayList<Color4f>(); cols.add(new Color4f(0, 1, 1, 0)); cols.add(new Color4f(1, 0, 1, 0.5f)); cols.add(new Color4f(1, 1, 0, 1)); m.setTransparentColor(cols); u.addCustomMesh(m, "lkjl"); } }
public void setTrackDisplayMode( final int mode ) { this.displayMode = mode; if ( displayMode == TrackMateModelView.TRACK_DISPLAY_MODE_WHOLE ) { final Color4f color = new Color4f(); for ( final Integer trackID : lines.keySet() ) { final LineArray line = lines.get( trackID ); for ( int i = 0; i < line.getVertexCount(); i++ ) { line.getColor( i, color ); color.w = 1f; line.setColor( i, color ); } } } }
/** * Returns the color of the specified edge mesh. */ public Color getColor( final DefaultWeightedEdge edge ) { // First, find to what track it belongs to final int trackID = model.getTrackModel().trackIDOf( edge ); // Retrieve color from index final Color4f color = new Color4f(); final int index = edgeIndices.get( trackID ).get( edge ); final LineArray line = lines.get( trackID ); if ( null == line ) { return null; } line.getColor( index, color ); return color.get(); }
/** * Returns the color of the specified edge mesh. */ public Color getColor( final DefaultWeightedEdge edge ) { // First, find to what track it belongs to final int trackID = model.getTrackModel().trackIDOf( edge ); // Retrieve color from index final Color4f color = new Color4f(); final int index = edgeIndices.get( trackID ).get( edge ); final LineArray line = lines.get( trackID ); if ( null == line ) { return null; } line.getColor( index, color ); return color.get(); }
public void setTrackDisplayMode( final int mode ) { this.displayMode = mode; if ( displayMode == TrackMateModelView.TRACK_DISPLAY_MODE_WHOLE ) { final Color4f color = new Color4f(); for ( final Integer trackID : lines.keySet() ) { final LineArray line = lines.get( trackID ); for ( int i = 0; i < line.getVertexCount(); i++ ) { line.getColor( i, color ); color.w = 1f; line.setColor( i, color ); } } } }
Vertex(Point3f p, Vector3f n, Color4f c, int flag) { this.flag = flag ; coord = new Point3f(p) ; if (hasNormals) normal = new Vector3f(n) ; if (hasColor3) color3 = new Color3f(c.x, c.y, c.z) ; else if (hasColor4) color4 = new Color4f(c) ; } }
Vertex(Point3f p, Vector3f n, Color4f c, int flag) { this.flag = flag ; coord = new Point3f(p) ; if (hasNormals) normal = new Vector3f(n) ; if (hasColor3) color3 = new Color3f(c.x, c.y, c.z) ; else if (hasColor4) color4 = new Color4f(c) ; } }
@Override public void setColor(final Color3f color) { this.color = color != null ? color : DEFAULT_COLOR; final GeometryArray ga = (GeometryArray) getGeometry(); if (ga == null) return; final int N = ga.getVertexCount(); final Color4f colors[] = new Color4f[N]; for (int i = 0; i < N; i++) { colors[i] = new Color4f(this.color.x, this.color.y, this.color.z, 1); } ga.setColors(0, colors); changed = true; }
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);
/** * Create a Shape3D using the current color for both the ambient and * diffuse material colors, then start a new vertex list for the new * color. The outputColor() method is never called if colors are bundled * with each vertex in the compressed buffer. */ @Override void outputColor(Color4f color) { if (debug) System.err.println(" outputColor: " + color.toString()) ; if (vlist.size() > 0) { // Construct Shape3D using the current color. addShape3D() ; // Start a new vertex list for the new color. vlist = new GeneralizedVertexList(vlist.vertexFormat, FRONTFACE_CCW) ; } if (curColor == null) curColor = new Color4f() ; curColor.set(color) ; }
GeometryDecompressor() { curPos = new Point3f() ; curNorm = new Vector3f() ; curColor = new Color4f() ; gctables = new HuffmanTableEntry[3][64] ; for (int i = 0 ; i < 64 ; i++) { gctables[0][i] = new HuffmanTableEntry() ; gctables[1][i] = new HuffmanTableEntry() ; gctables[2][i] = new HuffmanTableEntry() ; } meshBuffer = new MeshBufferEntry[16] ; for (int i = 0 ; i < 16 ; i++) meshBuffer[i] = new MeshBufferEntry() ; }
GeometryDecompressor() { curPos = new Point3f() ; curNorm = new Vector3f() ; curColor = new Color4f() ; gctables = new HuffmanTableEntry[3][64] ; for (int i = 0 ; i < 64 ; i++) { gctables[0][i] = new HuffmanTableEntry() ; gctables[1][i] = new HuffmanTableEntry() ; gctables[2][i] = new HuffmanTableEntry() ; } meshBuffer = new MeshBufferEntry[16] ; for (int i = 0 ; i < 16 ; i++) meshBuffer[i] = new MeshBufferEntry() ; }