示例#1
0
        public override Vector3 EvalMaterial(Intersection intersec, Material mat)
        {
            if (mat.Textured)
            {
                double x = Math.Floor(intersec.Point.X);
                double y = Math.Floor(intersec.Point.Z);

                if (x % 2 == 0 ^ y % 2 == 0)
                    return mat.Color.ToVector() * 0.5;
            }
            return mat.Color.ToVector();
        }
示例#2
0
        public override Vector3 EvalMaterial(Intersection intersec, Material mat)
        {
            if (mat.Textured)
            {
                //double scale = 255.0;
                //int u = (int)Math.Floor(intersec.BaryCoords.X * scale);
                //int v = (int)Math.Floor(intersec.BaryCoords.Y * scale);

                //double fac = (u ^ v) * 0.75 / scale + 0.25;
                //col *= fac;

                Vector2 bary = intersec.BaryCoords;
                double v0contrib = 1 - bary.X - bary.Y;
                double v1contrib = 1 - bary.X;
                double v2contrib = 1 - bary.Y;
                Vector2 texCoord = Vertex0.TexCoord + (Vertex1.TexCoord - Vertex0.TexCoord) * v1contrib + (Vertex2.TexCoord - Vertex0.TexCoord) * v2contrib;
                texCoord.X = 1 - texCoord.X;

                return mat.GetTextureColor(texCoord);
            }
            return mat.Color.ToVector();
        }
示例#3
0
        public override Vector3 EvalMaterial(Intersection intersec, Material mat)
        {
            if (mat.Textured)
            {
                double xtex = (1 + Math.Atan2(intersec.Normal.Z, intersec.Normal.X) / Math.PI) * 0.5;
                double ytex = Math.Acos(intersec.Normal.Y) / Math.PI;
                double scale = 4;

                bool pattern = ((xtex * scale) % 1.0 > 0.5) ^ ((ytex * scale) % 1.0 > 0.5);
                if (pattern)
                    return Vector3.Zero;

                //int x = (int)(Math.Abs(point.X) * 255.0);
                //int y = (int)(Math.Abs(point.Y) * 255.0);
                //int z = (int)(Math.Abs(point.Z) * 255.0);
                //int c = x ^ y ^ z;

                //col = Extensions.ColorFromHSV(c / 255.0 * 360.0, 0.8, 0.7).ToVector();
            }

            return mat.Color.ToVector();
        }
示例#4
0
 public override Vector3 EvalMaterial(Intersection intersec, Material mat)
 {
     return mat.Color.ToVector();
 }
示例#5
0
        public override Vector3 EvalMaterial(Intersection intersec, Material mat)
        {
            Vector2 bary = intersec.BaryCoords;

            if (bary.X + bary.Y > 1.0)
            {
                intersec.BaryCoords.X = 1.0 - intersec.BaryCoords.X;
                intersec.BaryCoords.Y = 1.0 - intersec.BaryCoords.Y;
                return T2.EvalMaterial(intersec, mat);
            }
            return T1.EvalMaterial(intersec, mat);
        }
示例#6
0
 public abstract Vector3 EvalMaterial(Intersection intersec, Material mat);