Пример #1
0
        private bool updateCameraMatrix(int index, ParameterList pl)
        {
            string offset = index < 0 ? "" : string.Format("[{0}]", index);

            if (index < 0)
            {
                index = 0;
            }
            Matrix4 transform = pl.getMatrix(string.Format("transform{0}", offset), null);

            if (transform == null)
            {
                // no transform was specified, check eye/target/up
                Point3  eye    = pl.getPoint(string.Format("eye{0}", offset), null);
                Point3  target = pl.getPoint(string.Format("target{0}", offset), null);
                Vector3 up     = pl.getVector(string.Format("up{0}", offset), null);
                if (eye != null && target != null && up != null)
                {
                    c2w[index] = Matrix4.fromBasis(OrthoNormalBasis.makeFromWV(Point3.sub(eye, target, new Vector3()), up));
                    c2w[index] = Matrix4.translation(eye.x, eye.y, eye.z).multiply(c2w[index]);
                }
                else
                {
                    // the matrix for this index was not specified
                    // return an error, unless this is a regular update
                    return(offset.Length == 0);
                }
            }
            else
            {
                c2w[index] = transform;
            }
            return(true);
        }
Пример #2
0
 private bool updateCameraMatrix(int index, ParameterList pl)
 {
     string offset = index < 0 ? "" : string.Format("[{0}]", index);
     if (index < 0)
         index = 0;
     Matrix4 transform = pl.getMatrix(string.Format("transform{0}", offset), null);
     if (transform == null)
     {
         // no transform was specified, check eye/target/up
         Point3 eye = pl.getPoint(string.Format("eye{0}", offset), null);
         Point3 target = pl.getPoint(string.Format("target{0}", offset), null);
         Vector3 up = pl.getVector(string.Format("up{0}", offset), null);
         if (eye != null && target != null && up != null)
         {
             c2w[index] = Matrix4.fromBasis(OrthoNormalBasis.makeFromWV(Point3.sub(eye, target, new Vector3()), up));
             c2w[index] = Matrix4.translation(eye.x, eye.y, eye.z).multiply(c2w[index]);
         }
         else
         {
             // the matrix for this index was not specified
             // return an error, unless this is a regular update
             return offset.Length == 0;
         }
     }
     else
         c2w[index] = transform;
     return true;
 }
Пример #3
0
 public bool update(ParameterList pl, SunflowAPI api)
 {
     src = pl.getPoint("source", src);
     dir = pl.getVector("dir", dir);
     dir.normalize();
     r = pl.getFloat("radius", r);
     basis = OrthoNormalBasis.makeFromW(dir);
     r2 = r * r;
     radiance = pl.getColor("radiance", radiance);
     return true;
 }
Пример #4
0
 public bool update(ParameterList pl, SunflowAPI api)
 {
     radiance = pl.getColor("radiance", radiance);
     numSamples = pl.getInt("samples", numSamples);
     radius = pl.getFloat("radius", radius);
     r2 = radius * radius;
     center = pl.getPoint("center", center);
     return true;
 }
Пример #5
0
 public bool update(ParameterList pl, SunflowAPI api)
 {
     lightPoint = pl.getPoint("center", lightPoint);
     power = pl.getColor("power", power);
     return true;
 }
Пример #6
0
        public bool Update(ParameterList pl, SunflowAPI api)
        {
            Point3 corner0 = pl.getPoint("corner0", null);
            Point3 corner1 = pl.getPoint("corner1", null);
            if (corner0 != null && corner1 != null)
            {
                updateGeometry(corner0, corner1);
            }

            // shader colors
            left = pl.getColor("leftColor", left);
            right = pl.getColor("rightColor", right);
            top = pl.getColor("topColor", top);
            bottom = pl.getColor("bottomColor", bottom);
            back = pl.getColor("backColor", back);

            // light
            radiance = pl.getColor("radiance", radiance);
            samples = pl.getInt("samples", samples);
            return true;
        }