Examples of Vector4


Examples of engine.base.Vector4

          for (int si = -border; si <= border; si++) {
            if ((sj == 0) && (si == 0))
              break;
            int scolor = sampleSrc(sx + si, sy + sj);

            Vector4 color = Utils.RGBAToVector4(scolor);
            p.set(num++, color.x);
            p.set(num++, color.y);
            p.set(num++, color.z);
          }
        }
View Full Code Here

Examples of engine.base.Vector4

  }

  protected Vector4 _valueRGBA(float u, float v) {
    if (tgtBuffer == null) {
      return new Vector4(0, 0, 0, 0);
    } else {
      int x = (int) (u * _targetRes);
      int y = (int) (v * _targetRes);
      int idx = (x + y * _targetRes);
      return Utils.RGBAToVector4(tgtBuffer[idx]);
View Full Code Here

Examples of engine.base.Vector4

 
  private final Vector4 _function(Vector4 c0, Vector4 c1) {
    float alpha = c1.w;
    if (invertAlpha.get()) alpha = 1.0f - alpha;
   
    final Vector4 color = new Vector4(c1);
    final int func = blendFunction.getEnumPos();
   
    alpha *= (opacity.get());
   
    // apply the blending function without alpha:
    if (func == 0) { // normal
      // do nothing
    } else if (func == 1) { // Multiply
      color.multComp_ip(c0);
    } else if (func == 2) { // Divide
      color.multComp_ip(1/(c0.x + 1), 1/(c0.y + 1), 1/(c0.z + 1), 1);
    } else if (func == 3) { // Screen
      color.set(1-(1-c0.x)*(1-c1.x), 1-(1-c0.y)*(1-c1.y), 1-(1-c0.z)*(1-c1.z), 1);
    } else if (func == 4) { // Overlay
      color.set(c0.x*(c0.x + 2*(c1.x)*(1-c0.x)), c0.y*(c0.y + 2*(c1.y)*(1-c0.y)), c0.z*(c0.z + 2*(c1.z)*(1-c0.z)), 1);
    } else if (func == 5) { // Dodge
      color.set(c0.x/((1-c1.x)+1), c0.y/((1-c1.y)+1), c0.z/((1-c1.z)+1),1);
    } else if (func == 6) { // Burn
      color.set(1-((1-c0.x)/(c1.x+1)), 1-((1-c0.y)/(c1.y+1)), 1-((1-c0.z)/(c1.z+1)), 1);
    } else if (func == 7) { // Difference
      color.set(c0).sub_ip(c1).abs_ip();
    } else if (func == 8) { // Addition
      color.add_ip(c0);
    } else if (func == 9) { // Subtract
      color.set(c0).sub_ip(c1);
    }
   
    color.clamp(0.0f, 1.0f);
   
    float origW = c0.w; // keep alpha ???
    c0.mult_ip(1.0f - alpha);
    c0.mult_add_ip(alpha, color);
    c0.w = origW;
View Full Code Here

Examples of engine.base.Vector4

  }
 
 
 
  protected float _value1f(float u, float v) {
    Vector4 val = valueRGBA(u, v);
    return (val.x+val.y+val.z)*(1.0f/3.0f);
  }
 
View Full Code Here

Examples of engine.base.Vector4

 
  private final Vector4 _function(float du, float dv) {
    Vector3 n = new Vector3(du*strength.get(), dv*strength.get(), 1.0f);
    n.normalize();
   
    Vector4 c = new Vector4(n.x * 0.5f + 0.5f, n.y * 0.5f + 0.5f, n.z * 0.5f + 0.5f, 1.0f);
    return c;
  }
View Full Code Here

Examples of engine.base.Vector4

    out.set(_function(du, dv));
  }
 
 
  protected float _value1f(float u, float v) {
    Vector4 val = valueRGBA(u, v);
    return (val.x+val.y+val.z)*(1.0f/3.0f);
  }
 
View Full Code Here

Examples of engine.base.Vector4

    return ret;
  }


  public Vector4 valueRGBA(float u, float v) {
    Vector4 val = _valueRGBA(u - FMath.ffloor(u), v - FMath.ffloor(v));
    return val;
  }
View Full Code Here

Examples of engine.base.Vector4

  public static float deltaFac = 4.0f;
  public static float deltaU = 1.0f / (deltaFac*256.0f);
  public static float deltaV = 1.0f / (deltaFac*256.0f);

  public Vector4 du1f(float u, float v) {
    return new Vector4(valueRGBA(u + deltaU, v)).sub_ip(valueRGBA(u, v)).mult_ip(deltaFac);
  }
View Full Code Here

Examples of engine.base.Vector4

  public Vector4 du1f(float u, float v) {
    return new Vector4(valueRGBA(u + deltaU, v)).sub_ip(valueRGBA(u, v)).mult_ip(deltaFac);
  }

  public Vector4 dv1f(float u, float v) {
    return new Vector4(valueRGBA(u, v + deltaV)).sub_ip(valueRGBA(u, v)).mult_ip(deltaFac);
  }
View Full Code Here

Examples of engine.base.Vector4

  public OutputType getOutputType() {
    return OutputType.SCALAR;
  }

  protected Vector4 _valueRGBA(float u, float v) {
    return new Vector4(0.0f, 0.0f, 0.0f, 1.0f);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.