Package engine.base

Examples of engine.base.Vector4


    float dv = caches[1].sample_dv(localX, localY).XYZto1f() * strength.get(); //inputChannels[1].dv1f(u, v).XYZto1f() * strength.get();
    out.set(inputChannels[0].valueRGBA(u+du, v+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


  protected Vector4 _valueRGBA(float u, float v) {
   
    float du = inputChannels[1].du1f(u, v).XYZto1f() * strength.get();
    float dv = inputChannels[1].dv1f(u, v).XYZto1f() * strength.get();
   
    Vector4 c = inputChannels[0].valueRGBA(u+du, v+dv);

    return c;
  }
View Full Code Here

    _function(out, caches[0].sample(localX, localY), caches[1].sample(localX, localY), caches[2].sample(localX, localY));
  }
   
 
  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

    Vector4 val = valueRGBA(u, v);
    return (val.x+val.y+val.z)*(1.0f/3.0f);
  }
 
  protected Vector4 _valueRGBA(float u, float v) {
    Vector4 c0 = inputChannels[0].valueRGBA(u, v);
    Vector4 c1 = inputChannels[1].valueRGBA(u, v);
    Vector4 c2 = inputChannels[2].valueRGBA(u, v);
    Vector4 ret = new Vector4();

    _function(ret, c0, c1, c2);
   
    return ret;
  }
View Full Code Here

    for (int sj = -border; sj <= 0; sj++) {
      for (int si = -border; si <= border; si++) {
        if ((sj == 0) && (si == 0))
          break;
        int tcolor = sampleTarget(x + si, y + sj);
        Vector4 color = Utils.RGBAToVector4(tcolor);
        p.set(num++, color.x);
        p.set(num++, color.y);
        p.set(num++, color.z);
      }
    }
View Full Code Here

          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

  }

  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

 
  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

  }
 
 
 
  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

 
  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

TOP

Related Classes of engine.base.Vector4

Copyright © 2018 www.massapicom. 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.