Codota Logo
TextureColorPalette
Code IndexAdd Codota to your IDE (free)

How to use
TextureColorPalette
in
us.ihmc.javaFXToolkit.shapes

Best Java code snippets using us.ihmc.javaFXToolkit.shapes.TextureColorPalette (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: us.ihmc/ihmc-javafx-toolkit

/**
* Retrieves the texture coordinates of a given {@code (red, green, blue)} in the image of this {@link TextureColorPalette}.
* @param red the red component, in the range {@code 0.0-1.0}.
* @param green the green component, in the range {@code 0.0-1.0}.
* @param blue the blue component, in the range {@code 0.0-1.0}.
* @return the corresponding texture coordinates.
*/
public default float[] getTextureLocation(double red, double green, double blue)
{
 return getTextureLocation((int) (255 * red), (int) (255 * green), (int) (255 * blue));
}
origin: us.ihmc/ihmc-javafx-toolkit

/**
* @return the JavaFX {@link Material} to use with the generated material to enable the multi-color feature.
*/
public Material generateMaterial()
{
 PhongMaterial material = new PhongMaterial();
 material.setDiffuseMap(colorPalette.getColorPalette());
 return material;
}
origin: us.ihmc/IHMCJavaFXToolkit

/**
* @return the JavaFX {@link Material} to use with the generated material to enable the multi-color feature.
*/
public Material generateMaterial()
{
 PhongMaterial material = new PhongMaterial();
 material.setDiffuseMap(colorPalette.getColorPalette());
 return material;
}
origin: us.ihmc/IHMCJavaFXToolkit

/**
* Retrieves the texture coordinates of a given {@code (red, green, blue)} in the image of this {@link TextureColorPalette}.
* @param red the red component, in the range {@code 0.0-1.0}.
* @param green the green component, in the range {@code 0.0-1.0}.
* @param blue the blue component, in the range {@code 0.0-1.0}.
* @return the corresponding texture coordinates.
*/
public default float[] getTextureLocation(double red, double green, double blue)
{
 return getTextureLocation((int) (255 * red), (int) (255 * green), (int) (255 * blue));
}
origin: us.ihmc/ihmc-javafx-toolkit

/**
* Retrieves the texture coordinates of a given {@code (red, green, blue)} in the image of this {@link TextureColorPalette}.
* @param red the red component, in the range {@code 0-255}.
* @param green the green component, in the range {@code 0-255}.
* @param blue the blue component, in the range {@code 0-255}.
* @return the corresponding texture coordinates.
*/
public default float[] getTextureLocation(int red, int green, int blue)
{
 return getTextureLocation(Color.rgb(red, green, blue));
}
origin: us.ihmc/IHMCJavaFXToolkit

/**
* Retrieves the texture coordinates of a given {@code (red, green, blue)} in the image of this {@link TextureColorPalette}.
* @param red the red component, in the range {@code 0-255}.
* @param green the green component, in the range {@code 0-255}.
* @param blue the blue component, in the range {@code 0-255}.
* @return the corresponding texture coordinates.
*/
public default float[] getTextureLocation(int red, int green, int blue)
{
 return getTextureLocation(Color.rgb(red, green, blue));
}
origin: us.ihmc/IHMCJavaFXToolkit

  private MeshDataHolder setColor(MeshDataHolder input, Color color)
  {
   if (input == null)
     return null;
   Point3f[] vertices = input.getVertices();
   int[] triangleIndices = input.getTriangleIndices();
   Vector3f[] vertexNormals = input.getVertexNormals();
   TexCoord2f[] inputTexturePoints = input.getTexturePoints();
   TexCoord2f[] outputTexturePoints = new TexCoord2f[inputTexturePoints.length];
   float[] textureLocation = colorPalette.getTextureLocation(color);
   for (int i = 0; i < inputTexturePoints.length; i++)
     outputTexturePoints[i] = new TexCoord2f(textureLocation);
   return new MeshDataHolder(vertices, outputTexturePoints, triangleIndices, vertexNormals);
  }
}
origin: us.ihmc/IHMCJavaFXToolkit

/**
* Add a 3D line to this builder.
* @param x0 x-coordinate of the line start.
* @param y0 y-coordinate of the line start.
* @param z0 z-coordinate of the line start.
* @param xf x-coordinate of the line end.
* @param yf y-coordinate of the line end.
* @param zf z-coordinate of the line end.
* @param lineWidth width of the line.
* @param startColor color at the line start. Color accuracy depends on the color palette in use.
* @param endColor color at the line end. Color accuracy depends on the color palette in use.
*/
public void addLine(float x0, float y0, float z0, float xf, float yf, float zf, float lineWidth, Color startColor, Color endColor)
{
 MeshDataHolder lineMeshData = MeshDataGenerator.Line(x0, y0, z0, xf, yf, zf, lineWidth);
 float expectedDistance = 2.0f * lineWidth * lineWidth;
 Point3f[] vertices = lineMeshData.getVertices();
 TexCoord2f[] texturePoints = lineMeshData.getTexturePoints();
 Point3f start = new Point3f(x0, y0, z0);
 for (int i = 0; i < vertices.length; i++)
 {
   if (MathTools.epsilonEquals(vertices[i].distanceSquared(start), expectedDistance, 1.0e-5))
    texturePoints[i].set(colorPalette.getTextureLocation(startColor));
   else
    texturePoints[i].set(colorPalette.getTextureLocation(endColor));
 }
 meshBuilder.addMesh(lineMeshData);
}
origin: us.ihmc/ihmc-javafx-toolkit

  private MeshDataHolder setColor(MeshDataHolder input, Color color)
  {
   if (input == null)
     return null;
   Point3D32[] vertices = input.getVertices();
   int[] triangleIndices = input.getTriangleIndices();
   Vector3D32[] vertexNormals = input.getVertexNormals();
   TexCoord2f[] inputTexturePoints = input.getTexturePoints();
   TexCoord2f[] outputTexturePoints = new TexCoord2f[inputTexturePoints.length];
   float[] textureLocation = colorPalette.getTextureLocation(color);
   for (int i = 0; i < inputTexturePoints.length; i++)
     outputTexturePoints[i] = new TexCoord2f(textureLocation);
   return new MeshDataHolder(vertices, outputTexturePoints, triangleIndices, vertexNormals);
  }
}
origin: us.ihmc/ihmc-javafx-toolkit

/**
* Add a 3D line to this builder.
* @param x0 x-coordinate of the line start.
* @param y0 y-coordinate of the line start.
* @param z0 z-coordinate of the line start.
* @param xf x-coordinate of the line end.
* @param yf y-coordinate of the line end.
* @param zf z-coordinate of the line end.
* @param lineWidth width of the line.
* @param startColor color at the line start. Color accuracy depends on the color palette in use.
* @param endColor color at the line end. Color accuracy depends on the color palette in use.
*/
public void addLine(float x0, float y0, float z0, float xf, float yf, float zf, float lineWidth, Color startColor, Color endColor)
{
 MeshDataHolder lineMeshData = MeshDataGenerator.Line(x0, y0, z0, xf, yf, zf, lineWidth);
 Point3D32[] vertices = lineMeshData.getVertices();
 TexCoord2f[] texturePoints = lineMeshData.getTexturePoints();
 Point3D32 start = new Point3D32(x0, y0, z0);
 Point3D32 end = new Point3D32(xf, yf, zf);
 for (int i = 0; i < vertices.length; i++)
 {
   if (vertices[i].distanceSquared(start) < vertices[i].distanceSquared(end))
    texturePoints[i].set(colorPalette.getTextureLocation(startColor));
   else
    texturePoints[i].set(colorPalette.getTextureLocation(endColor));
 }
 meshBuilder.addMesh(lineMeshData);
}
us.ihmc.javaFXToolkit.shapesTextureColorPalette

Javadoc

TextureColorPalette defines a tool that maps texture coordinates to an image. The main usage is for JavaFXMultiColorMeshBuilder that re-maps texture coordinates of the mesh vertices to point to the image of the active TextureColorPalette and to allow the user to render a mesh with more than one color.

Most used methods

  • getColorPalette
  • getTextureLocation

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now