Java 类com.badlogic.gdx.utils.NumberUtils 实例源码

项目:exterminate    文件:BitmapFontCache.java   
/** Sets the alpha component of all text currently in the cache. Does not affect subsequently added text. */
public void setAlphas (float alpha) {
    int alphaBits = ((int)(254 * alpha)) << 24;
    float prev = 0, newColor = 0;
    for (int j = 0, length = pageVertices.length; j < length; j++) {
        float[] vertices = pageVertices[j];
        for (int i = 2, n = idx[j]; i < n; i += 5) {
            float c = vertices[i];
            if (c == prev && i != 2) {
                vertices[i] = newColor;
            } else {
                prev = c;
                int rgba = NumberUtils.floatToIntColor(c);
                rgba = (rgba & 0x00FFFFFF) | alphaBits;
                newColor = NumberUtils.intToFloatColor(rgba);
                vertices[i] = newColor;
            }
        }
    }
}
项目:libgdxcn    文件:Quaternion.java   
@Override
public boolean equals (Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof Quaternion)) {
        return false;
    }
    Quaternion other = (Quaternion)obj;
    return (NumberUtils.floatToRawIntBits(w) == NumberUtils.floatToRawIntBits(other.w))
        && (NumberUtils.floatToRawIntBits(x) == NumberUtils.floatToRawIntBits(other.x))
        && (NumberUtils.floatToRawIntBits(y) == NumberUtils.floatToRawIntBits(other.y))
        && (NumberUtils.floatToRawIntBits(z) == NumberUtils.floatToRawIntBits(other.z));
}
项目:ingress-indonesia-dev    文件:Vector3.java   
public boolean equals(Object paramObject)
{
  if (this == paramObject);
  Vector3 localVector3;
  do
  {
    return true;
    if (paramObject == null)
      return false;
    if (getClass() != paramObject.getClass())
      return false;
    localVector3 = (Vector3)paramObject;
    if (NumberUtils.floatToIntBits(this.x) != NumberUtils.floatToIntBits(localVector3.x))
      return false;
    if (NumberUtils.floatToIntBits(this.y) != NumberUtils.floatToIntBits(localVector3.y))
      return false;
  }
  while (NumberUtils.floatToIntBits(this.z) == NumberUtils.floatToIntBits(localVector3.z));
  return false;
}
项目:ingress-indonesia-dev    文件:Vector2.java   
public boolean equals(Object paramObject)
{
  if (this == paramObject);
  Vector2 localVector2;
  do
  {
    return true;
    if (paramObject == null)
      return false;
    if (getClass() != paramObject.getClass())
      return false;
    localVector2 = (Vector2)paramObject;
    if (NumberUtils.floatToIntBits(this.x) != NumberUtils.floatToIntBits(localVector2.x))
      return false;
  }
  while (NumberUtils.floatToIntBits(this.y) == NumberUtils.floatToIntBits(localVector2.y));
  return false;
}
项目:cocos2d-java    文件:Size.java   
public boolean equals(Size obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    Size other = (Size)obj;
    if (NumberUtils.floatToIntBits(width) != NumberUtils.floatToIntBits(other.width)) return false;
    if (NumberUtils.floatToIntBits(height) != NumberUtils.floatToIntBits(other.height)) return false;
    return true;
}
项目:nhglib    文件:Vector4.java   
@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + NumberUtils.floatToIntBits(x);
    result = prime * result + NumberUtils.floatToIntBits(y);
    result = prime * result + NumberUtils.floatToIntBits(z);
    result = prime * result + NumberUtils.floatToIntBits(k);
    return result;
}
项目:nhglib    文件:Vector4.java   
@Override
public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    Vector4 other = (Vector4) obj;
    if (NumberUtils.floatToIntBits(x) != NumberUtils.floatToIntBits(other.x)) return false;
    if (NumberUtils.floatToIntBits(y) != NumberUtils.floatToIntBits(other.y)) return false;
    if (NumberUtils.floatToIntBits(z) != NumberUtils.floatToIntBits(other.z)) return false;
    if (NumberUtils.floatToIntBits(k) != NumberUtils.floatToIntBits(other.k)) return false;
    return true;
}
项目:nhglib    文件:PbrTextureAttribute.java   
@Override
public int hashCode() {
    int result = super.hashCode();
    result = 991 * result + textureDescription.hashCode();
    result = 991 * result + NumberUtils.floatToRawIntBits(offsetU);
    result = 991 * result + NumberUtils.floatToRawIntBits(offsetV);
    result = 991 * result + NumberUtils.floatToRawIntBits(scaleU);
    result = 991 * result + NumberUtils.floatToRawIntBits(scaleV);
    result = 991 * result + uvIndex;
    return result;
}
项目:LibGDX-PBR    文件:PBRTextureAttribute.java   
@Override
public int hashCode () {
    int result = super.hashCode();
    result = 991 * result + textureDescription.hashCode();
    result = 991 * result + NumberUtils.floatToRawIntBits(offsetU);
    result = 991 * result + NumberUtils.floatToRawIntBits(offsetV);
    result = 991 * result + NumberUtils.floatToRawIntBits(scaleU);
    result = 991 * result + NumberUtils.floatToRawIntBits(scaleV);
    result = 991 * result + uvIndex;
    return result;
}
项目:exterminate    文件:ChunkBuilder.java   
public static float packNormal(Vector3 n) {
    n.nor();

    byte b1 = 0;
    byte b2 = (byte) ((n.z) * 127f);
    byte b3 = (byte) ((n.y) * 127f);
    byte b4 = (byte) ((n.x) * 127f);

    return NumberUtils.intToFloatColor(((0xFF & b1) << 24)
            | ((0xFF & b2) << 16) | ((0xFF & b3) << 8) | (0xFF & b4));
}
项目:gdx-texture-packer-gui    文件:Version.java   
@Override
public int hashCode() {
    int result = (major != +0.0f ? NumberUtils.floatToIntBits(major) : 0);
    result = 31 * result + (minor != +0.0f ? NumberUtils.floatToIntBits(minor) : 0);
    result = 31 * result + (revision != +0.0f ? NumberUtils.floatToIntBits(revision) : 0);
    return result;
}
项目:libgdxcn    文件:Sphere.java   
@Override
public int hashCode () {
    final int prime = 71;
    int result = 1;
    result = prime * result + this.center.hashCode();
    result = prime * result + NumberUtils.floatToRawIntBits(this.radius);
    return result;
}
项目:libgdxcn    文件:Circle.java   
@Override
public int hashCode () {
    final int prime = 41;
    int result = 1;
    result = prime * result + NumberUtils.floatToRawIntBits(radius);
    result = prime * result + NumberUtils.floatToRawIntBits(x);
    result = prime * result + NumberUtils.floatToRawIntBits(y);
    return result;
}
项目:libgdxcn    文件:Ellipse.java   
@Override
public int hashCode () {
    final int prime = 53;
    int result = 1;
    result = prime * result + NumberUtils.floatToRawIntBits(this.height);
    result = prime * result + NumberUtils.floatToRawIntBits(this.width);
    result = prime * result + NumberUtils.floatToRawIntBits(this.x);
    result = prime * result + NumberUtils.floatToRawIntBits(this.y);
    return result;
}
项目:libgdxcn    文件:Rectangle.java   
public int hashCode () {
    final int prime = 31;
    int result = 1;
    result = prime * result + NumberUtils.floatToRawIntBits(height);
    result = prime * result + NumberUtils.floatToRawIntBits(width);
    result = prime * result + NumberUtils.floatToRawIntBits(x);
    result = prime * result + NumberUtils.floatToRawIntBits(y);
    return result;
}
项目:libgdxcn    文件:Rectangle.java   
public boolean equals (Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    Rectangle other = (Rectangle)obj;
    if (NumberUtils.floatToRawIntBits(height) != NumberUtils.floatToRawIntBits(other.height)) return false;
    if (NumberUtils.floatToRawIntBits(width) != NumberUtils.floatToRawIntBits(other.width)) return false;
    if (NumberUtils.floatToRawIntBits(x) != NumberUtils.floatToRawIntBits(other.x)) return false;
    if (NumberUtils.floatToRawIntBits(y) != NumberUtils.floatToRawIntBits(other.y)) return false;
    return true;
}
项目:libgdxcn    文件:Vector3.java   
@Override
public int hashCode () {
    final int prime = 31;
    int result = 1;
    result = prime * result + NumberUtils.floatToIntBits(x);
    result = prime * result + NumberUtils.floatToIntBits(y);
    result = prime * result + NumberUtils.floatToIntBits(z);
    return result;
}
项目:libgdxcn    文件:Vector3.java   
@Override
public boolean equals (Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    Vector3 other = (Vector3)obj;
    if (NumberUtils.floatToIntBits(x) != NumberUtils.floatToIntBits(other.x)) return false;
    if (NumberUtils.floatToIntBits(y) != NumberUtils.floatToIntBits(other.y)) return false;
    if (NumberUtils.floatToIntBits(z) != NumberUtils.floatToIntBits(other.z)) return false;
    return true;
}
项目:libgdxcn    文件:Vector2.java   
@Override
public int hashCode () {
    final int prime = 31;
    int result = 1;
    result = prime * result + NumberUtils.floatToIntBits(x);
    result = prime * result + NumberUtils.floatToIntBits(y);
    return result;
}
项目:libgdxcn    文件:Vector2.java   
@Override
public boolean equals (Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    Vector2 other = (Vector2)obj;
    if (NumberUtils.floatToIntBits(x) != NumberUtils.floatToIntBits(other.x)) return false;
    if (NumberUtils.floatToIntBits(y) != NumberUtils.floatToIntBits(other.y)) return false;
    return true;
}
项目:libgdxcn    文件:Quaternion.java   
@Override
public int hashCode () {
    final int prime = 31;
    int result = 1;
    result = prime * result + NumberUtils.floatToRawIntBits(w);
    result = prime * result + NumberUtils.floatToRawIntBits(x);
    result = prime * result + NumberUtils.floatToRawIntBits(y);
    result = prime * result + NumberUtils.floatToRawIntBits(z);
    return result;
}
项目:libgdxcn    文件:Decal.java   
/** @see #setColor(Color) */
public void setColor (float color) {
    this.color.set(NumberUtils.floatToIntColor(color));
    vertices[C1] = color;
    vertices[C2] = color;
    vertices[C3] = color;
    vertices[C4] = color;
}
项目:libgdxcn    文件:DepthTestAttribute.java   
@Override
public int hashCode () {
    int result = super.hashCode();
    result = 971 * result + depthFunc;
    result = 971 * result + NumberUtils.floatToRawIntBits(depthRangeNear);
    result = 971 * result + NumberUtils.floatToRawIntBits(depthRangeFar);
    result = 971 * result + (depthMask ? 1 : 0);
    return result; 
}
项目:libgdxcn    文件:TextureAttribute.java   
@Override
public int hashCode () {
    int result = super.hashCode();
    result = 991 * result + textureDescription.hashCode();
    result = 991 * result + NumberUtils.floatToRawIntBits(offsetU);
    result = 991 * result + NumberUtils.floatToRawIntBits(offsetV);
    result = 991 * result + NumberUtils.floatToRawIntBits(scaleU);
    result = 991 * result + NumberUtils.floatToRawIntBits(scaleV);
    result = 991 * result + NumberUtils.floatToRawIntBits(uvIndex);
    return result;
}
项目:libgdxcn    文件:BlendingAttribute.java   
@Override
public int hashCode () {
    int result = super.hashCode();
    result = 947 * result + (blended ? 1 : 0);
    result = 947 * result + sourceFunction;
    result = 947 * result + destFunction;
    result = 947 * result + NumberUtils.floatToRawIntBits(opacity);
    return result; 
}
项目:libgdxcn    文件:Color.java   
@Override
public int hashCode () {
    int result = (r != +0.0f ? NumberUtils.floatToIntBits(r) : 0);
    result = 31 * result + (g != +0.0f ? NumberUtils.floatToIntBits(g) : 0);
    result = 31 * result + (b != +0.0f ? NumberUtils.floatToIntBits(b) : 0);
    result = 31 * result + (a != +0.0f ? NumberUtils.floatToIntBits(a) : 0);
    return result;
}
项目:libgdxcn    文件:Sprite.java   
/** Sets the alpha portion of the color used to tint this sprite. */
public void setAlpha (float a) {
    int intBits = NumberUtils.floatToIntColor(vertices[C1]);
    int alphaBits = (int)(255 * a) << 24;

    // clear alpha on original color
    intBits = intBits & 0x00FFFFFF;
    // write new alpha
    intBits = intBits | alphaBits;
    float color = NumberUtils.intToFloatColor(intBits);
    vertices[C1] = color;
    vertices[C2] = color;
    vertices[C3] = color;
    vertices[C4] = color;
}
项目:libgdxcn    文件:Sprite.java   
/** @see #setColor(Color) */
public void setColor (float r, float g, float b, float a) {
    int intBits = ((int)(255 * a) << 24) | ((int)(255 * b) << 16) | ((int)(255 * g) << 8) | ((int)(255 * r));
    float color = NumberUtils.intToFloatColor(intBits);
    float[] vertices = this.vertices;
    vertices[C1] = color;
    vertices[C2] = color;
    vertices[C3] = color;
    vertices[C4] = color;
}
项目:libgdxcn    文件:Sprite.java   
/** Returns the color of this sprite. Changing the returned color will have no affect, {@link #setColor(Color)} or
 * {@link #setColor(float, float, float, float)} must be used. */
public Color getColor () {
    int intBits = NumberUtils.floatToIntColor(vertices[C1]);
    Color color = this.color;
    color.r = (intBits & 0xff) / 255f;
    color.g = ((intBits >>> 8) & 0xff) / 255f;
    color.b = ((intBits >>> 16) & 0xff) / 255f;
    color.a = ((intBits >>> 24) & 0xff) / 255f;
    return color;
}
项目:libgdxcn    文件:PolygonSprite.java   
/** Returns the actual color used in the vertices of this sprite. Changing the returned color will have no affect,
 * {@link #setColor(Color)} or {@link #setColor(float, float, float, float)} must be used. */
public Color getVertexColor () {
    int intBits = NumberUtils.floatToIntColor(vertices[2]);
    Color color = this.color;
    color.r = (intBits & 0xff) / 255f;
    color.g = ((intBits >>> 8) & 0xff) / 255f;
    color.b = ((intBits >>> 16) & 0xff) / 255f;
    color.a = ((intBits >>> 24) & 0xff) / 255f;
    return color;
}
项目:libgdxcn    文件:BitmapFontCache.java   
private Color setColor (Color color, float floatColor) {
    int intBits = NumberUtils.floatToIntColor(floatColor);
    color.r = (intBits & 0xff) / 255f;
    color.g = ((intBits >>> 8) & 0xff) / 255f;
    color.b = ((intBits >>> 16) & 0xff) / 255f;
    color.a = ((intBits >>> 24) & 0xff) / 255f;
    return color;
}
项目:libgdxcn    文件:BitmapFontCache.java   
/** Sets the color of all text currently in the cache. Does not affect subsequently added text. */
public void setColors (float r, float g, float b, float a) {
    int intBits = ((int)(255 * a) << 24) | ((int)(255 * b) << 16) | ((int)(255 * g) << 8) | ((int)(255 * r));
    float color = NumberUtils.intToFloatColor(intBits);
    for (int j = 0, length = vertexData.length; j < length; j++) {
        float[] vertices = vertexData[j];
        for (int i = 2, n = idx[j]; i < n; i += 5)
            vertices[i] = color;
    }
}
项目:gaiasky    文件:Quaterniond.java   
@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + NumberUtils.floatToRawIntBits((float) w);
    result = prime * result + NumberUtils.floatToRawIntBits((float) x);
    result = prime * result + NumberUtils.floatToRawIntBits((float) y);
    result = prime * result + NumberUtils.floatToRawIntBits((float) z);
    return result;
}
项目:gaiasky    文件:Quaterniond.java   
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof Quaterniond)) {
        return false;
    }
    Quaterniond other = (Quaterniond) obj;
    return (NumberUtils.floatToRawIntBits((float) w) == NumberUtils.floatToRawIntBits((float) other.w)) && (NumberUtils.floatToRawIntBits((float) x) == NumberUtils.floatToRawIntBits((float) other.x)) && (NumberUtils.floatToRawIntBits((float) y) == NumberUtils.floatToRawIntBits((float) other.y)) && (NumberUtils.floatToRawIntBits((float) z) == NumberUtils.floatToRawIntBits((float) other.z));
}
项目:gdx-proto    文件:Tools.java   
public static float readFloatFromBytes(byte[] bytes, int offset) {
    int i = 0;
    int value = bytes[0 + offset] & 0xFF;
    value |= bytes[1 + offset]<<(8) & 0xFFFF;
    value |= bytes[2 + offset]<<(16) & 0xFFFFFF;
    value |= bytes[3 + offset]<<(24) & 0xFFFFFFFF;
    return NumberUtils.intBitsToFloat(value);
}
项目:gdx-proto    文件:Tools.java   
public static int writeFloatToBytes(float f, byte[] bytes, int offset) {
    int value = NumberUtils.floatToIntBits(f);
    bytes[0 + offset] = (byte) (value & 0xFF);
    bytes[1 + offset] = (byte) (value>>8 & 0xFF);
    bytes[2 + offset] = (byte) (value>>16 & 0xFF);
    bytes[3 + offset] = (byte) (value>>24 & 0xFF);
    // return next idx
    return offset + 4;
}
项目:ingress-indonesia-dev    文件:SpriteBatch.java   
public Color getColor()
{
  int i = NumberUtils.floatToIntColor(this.color);
  Color localColor = this.tempColor;
  localColor.r = ((i & 0xFF) / 255.0F);
  localColor.g = ((0xFF & i >>> 8) / 255.0F);
  localColor.b = ((0xFF & i >>> 16) / 255.0F);
  localColor.a = ((0xFF & i >>> 24) / 255.0F);
  return localColor;
}
项目:ingress-indonesia-dev    文件:Sprite.java   
public Color getColor()
{
  int i = NumberUtils.floatToIntColor(this.vertices[2]);
  Color localColor = this.color;
  localColor.r = ((i & 0xFF) / 255.0F);
  localColor.g = ((0xFF & i >>> 8) / 255.0F);
  localColor.b = ((0xFF & i >>> 16) / 255.0F);
  localColor.a = ((0xFF & i >>> 24) / 255.0F);
  return localColor;
}
项目:ingress-indonesia-dev    文件:Sprite.java   
public void setColor(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4)
{
  float f = NumberUtils.intToFloatColor((int)(255.0F * paramFloat4) << 24 | (int)(255.0F * paramFloat3) << 16 | (int)(255.0F * paramFloat2) << 8 | (int)(255.0F * paramFloat1));
  float[] arrayOfFloat = this.vertices;
  arrayOfFloat[2] = f;
  arrayOfFloat[7] = f;
  arrayOfFloat[12] = f;
  arrayOfFloat[17] = f;
}
项目:ingress-indonesia-dev    文件:BitmapFont.java   
public Color getColor()
{
  int i = NumberUtils.floatToIntColor(this.color);
  Color localColor = this.tempColor;
  localColor.r = ((i & 0xFF) / 255.0F);
  localColor.g = ((0xFF & i >>> 8) / 255.0F);
  localColor.b = ((0xFF & i >>> 16) / 255.0F);
  localColor.a = ((0xFF & i >>> 24) / 255.0F);
  return localColor;
}