Package engine.base

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


    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

  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

  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

  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

    return this;
  }
 
 
  public ColorGradient addEntryRGB(float r, float g, float b, float pos) {
    return addEntry(new Vector4(r, g, b, 1.0f), pos);
  }
View Full Code Here

  public void setFrom(ColorGradient g) {
    if (g == null) return;
    if (g.getNumEntries() <= 1) return;
    clear();
    for (int i = 0; i < g.getNumEntries(); i++) {
      addEntry(new Vector4(g.getEntryColor(i)), g.getEntryPosition(i));
    }
  }
View Full Code Here

    }
  }
 
 
  public Vector4 getColor(float pos) {
    Vector4 ret = new Vector4();
   
    if (pos <= entries.firstElement().position) ret.set(entries.firstElement().color);
    else if (pos >= entries.lastElement().position) ret.set(entries.lastElement().color);
    else {
      for (int i = 0; i < entries.size()-1; i++) {
        if (entries.get(i+1).position > pos) {
          Entry a = entries.get(i);
          Entry b = entries.get(i+1);
         
          float interp = (pos-a.position)/(b.position-a.position);
          //ret.set(interp);
          ret.set(a.color);
          ret.mult_ip(1.0f - interp);
          ret.mult_add_ip(interp, b.color);
          break;
        }
      }
    }
   
View Full Code Here

 
  private ColorGradientParam(String name) {
    this.name = name;
    m_Gradient = new ColorGradient();
    // default grayscale gradient
    m_Gradient.addEntry(new Vector4(0.0f, 0.0f, 0.0f, 1.0f), 0.0f);
    m_Gradient.addEntry(new Vector4(1.0f, 1.0f, 1.0f, 1.0f), 1.0f);
  }
View Full Code Here

 
  // saves only the value
  public void save(Writer w) throws IOException  {
    w.write(m_Gradient.getNumEntries() + " ");
    for (int i = 0; i < m_Gradient.getNumEntries(); i++) {
      Vector4 v = m_Gradient.getEntryColor(i);
      w.write(v.x+" "+v.y+" "+v.z+" "+v.w+" ");
      w.write(m_Gradient.getEntryPosition(i) + " ");
    }
  }
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.