Package ca.eandb.jmist.framework

Examples of ca.eandb.jmist.framework.Light


   * @see ca.eandb.jmist.framework.path.ScatteringNode#getSourcePDF()
   */
  public double getSourcePDF() {
    PathInfo path = getPathInfo();
    Scene scene = path.getScene();
    Light light = scene.getLight();
    return light.getSamplePDF(surf, path);
  }
View Full Code Here


            "newParent == null && grandChild != null");
      }

      PathInfo pi = getPathInfo();
      Scene scene = pi.getScene();
      Light light = scene.getLight();
      double pdf = light.getSamplePDF(surf, pi);

      return ScaledLightNode.create(pdf, new SurfaceLightNode(pi, surf, getRU(), getRV(), getRJ()), getRJ());
    }
  }
View Full Code Here

    int l1 = RandomUtil.discrete(0, ka - 1, rnd);
    int m1 = ka - 1 - l1;

    if (newLightTail == null && l1 > 0) {
      PathInfo pi = x.getPathInfo();
      Light light = pi.getScene().getLight();
      newLightTail = light.sample(pi, rnd.next(), rnd.next(), rnd.next());
      l1--;
    }
    while (l1-- > 0) {
      newLightTail = newLightTail.expand(rnd.next(), rnd.next(), rnd.next());
      if (newLightTail == null || newLightTail.isAtInfinity()) {
View Full Code Here

      Lens lens      = scene.getLens();
      PathNode eyeTail  = strategy.traceEyePath(lens, p,
                    pi, seq);
      seq.mark();

      Light light      = scene.getLight();
      PathNode lightTail  = strategy.traceLightPath(
                    light, pi, seq);
      seq.mark();

      return new Path(lightTail, eyeTail);
View Full Code Here

      PathNode eyeTail  = strategy.traceEyePath(lens, p,
                    pi, seq);
      seq.mark();

      seq.mutate(width);
      Light light      = scene.getLight();
      PathNode lightTail  = strategy.traceLightPath(
                    light, pi, seq);
      seq.mark();

      return new Path(lightTail, eyeTail);
View Full Code Here

      double    w          = width;
      double    h          = height;
      int      numPixels      = width * height;
      int      samplesPerPixel    = passes * lightPathsPerEyePath;
      double    lightImageWeight  = 1.0 / (double) samplesPerPixel;
      Light    light        = scene.getLight();
      Lens    lens        = scene.getLens();
      Animator  animator      = scene.getAnimator();

      initialize();
      raster.get().clear();
View Full Code Here

    this.minSeedsPerSeedTask = numberOfSeeds / seedTasks;
    this.extraSeeds = numberOfSeeds % seedTasks;
  }

  private final PathNode generateLightPath(Random rnd, WavelengthPacket lambda) {
    Light light = scene.getLight();
    PathInfo pathInfo = new PathInfo(scene, lambda);
    return strategy.traceLightPath(light, pathInfo, rnd);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.SceneElement#createLight()
   */
  public Light createLight() {
    final List<Light> lights = new ArrayList<Light>();
    Light light = null;
    int numLights = 0;
    for (SceneElement child : children) {
      light = child.createLight();
      lights.add(light);
      if (light != null) {
        numLights++;
      }
    }
    final int lightCount = numLights;
    switch (numLights) {
    case 0:
      return null;
    case 1:
      return light;
    default:
      return new AbstractLight() {

        /** Serialization version ID. */
        private static final long serialVersionUID = 6299798465595032610L;

        @Override
        public double getSamplePDF(final SurfacePoint x, final PathInfo pathInfo) {
          return lights.get(x.getPrimitiveIndex()).getSamplePDF(x, pathInfo) / (double) lightCount;
        }

        @Override
        public void illuminate(SurfacePoint x, WavelengthPacket lambda,
            Random rnd, Illuminable target) {
          throw new UnimplementedException();
        }

        @Override
        public LightNode sample(PathInfo pathInfo, double ru,
            double rv, double rj) {
          SeedReference ref = new SeedReference(rj);
          int index = RandomUtil.discrete(0, lightCount - 1, ref);
          for (int i = 0, n = lights.size(); i < n; i++) {
            Light light = lights.get(i);
            if (light != null) {
              if (index-- == 0) {
                return ScaledLightNode.create(1.0 / (double) lightCount,
                    light.sample(pathInfo, ru, rv, ref.seed), rj);

              }
            }
          }
          return null;
View Full Code Here

TOP

Related Classes of ca.eandb.jmist.framework.Light

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.