Package org.spout.math.vector

Examples of org.spout.math.vector.Vector4f


      y = yForce;
      z = zForce;
    }

    float sunWeight;
    Vector4f skyColor;

    float yAbs = Math.abs(y);
    if (yAbs < sunSize) {
      sunWeight = (y + sunSize) / sunSize / 2.0f;
      Vector4f weightedSun;
      if (y < 0) {
        weightedSun = dawnColor;
      } else {
        float dawnWeight = y / sunSize;
        weightedSun = sunColor.mul(dawnWeight).add(dawnColor.mul(1 - dawnWeight));
      }
      skyColor = weightedSun.mul(sunWeight).add(moonColor.mul((1 - sunWeight)));
    } else {
      if (y < 0) {
        sunWeight = 0;
        skyColor = moonColor;
      } else {
        sunWeight = 1;
        skyColor = sunColor;
      }
    }

    snapshotRender.getMaterial().getShader().setUniform("ambient", ambient);
    snapshotRender.getMaterial().getShader().setUniform("skyColor", skyColor);
    snapshotRender.getMaterial().getShader().setUniform("sunColor", sunColor.mul(sunWeight));
    snapshotRender.getMaterial().getShader().setUniform("moonColor", moonColor.mul(1 - sunWeight));

    Vector4f sunDir = new Vector4f(x * size, y * size, z * size, 1.0f);

    //Spout.getLogger().info("f = " + f + " rads = " + rads + " vector " + sunDir);

    snapshotRender.getMaterial().getShader().setUniform("sunDir", sunDir);
  }
View Full Code Here


  public void updateReflectedView() {
    Transform transform = getOwner().getPhysics().getTransform();
    Point point = transform.getPosition().add(0.0f, getHeight(), 0.0f);
    Matrix4f pos = Matrix4f.createTranslation(point.mul(-1));
    Matrix4f rot = getRotation();
    view = Matrix4f.createScaling(new Vector4f(1, -1, 1, 1)).mul(pos).mul(rot);
    frustum.update(projection, view, transform.getPosition());
  }
View Full Code Here

TOP

Related Classes of org.spout.math.vector.Vector4f

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.