Пример #1
0
        public override void Calculate()
        {
            base.Calculate();

//			if (!verified)
//				return;
            if (!changed)
            {
                return;
            }
//			CTextureNode ShininessMap = (CTextureNode)getNode (Inputs, 0);
            CTextureNode Heightmap = (CTextureNode)getNode(Inputs, 0);
            CTextureNode ColorMap  = (CTextureNode)getNode(Inputs, 1);
            CTextureNode NormalMap = (CTextureNode)getNode(Inputs, 2);

            if (NormalMap == null || ColorMap == null || Heightmap == null)
            {
                return;
            }



            Heightmap.Calculate();
            ColorMap.Calculate();
            NormalMap.Calculate();


/*			if (ShininessMap!=null)
 *                              ShininessMap.Calculate();
 */
            changed = false;
        }
Пример #2
0
        public override void Calculate()
        {
            base.Calculate();

            if (!verified)
            {
                return;
            }

            if (!changed)
            {
                return;
            }

            CTextureNode m1 = (CTextureNode)getNode(Inputs, 0);

            if (m1 == null)
            {
                return;
            }
            m1.Calculate();

            float curvtype = getValue("curvtype");
            float scale    = getValue("scale");


            if (normals == null)
            {
                normals = new Vector3[C2DMap.sizeX, C2DMap.sizeY];
            }
            if (normals.GetLength(0) != C2DMap.sizeX)
            {
                normals = new Vector3[C2DMap.sizeX, C2DMap.sizeY];
            }

            m1.map.calculateNormals(100, normals);


            for (int i = 0; i < C2DMap.sizeX; i++)
            {
                for (int j = 0; j < C2DMap.sizeY; j++)
                {
                    map [i, j] = m1.map.getCurvature(i, j, scale, (int)curvtype, normals);
                }
            }
            //map.Smooth(1);


            map.ScaleMap(getValue("amplitude"), 0);
            GenerateHeightTexture();
            CNodeManager.Progress();
            updateTexture = true;

            changed = false;
        }
Пример #3
0
        public override void Calculate()
        {
            base.Calculate();
            if (!verified)
            {
                return;
            }

            CTextureNode m1 = (CTextureNode)getNode(Inputs, 0);

            if (m1 == null)
            {
                verified = false;
                return;
            }

            m1.Calculate();

            if (!changed)
            {
                return;
            }

            float curvtype = getValue("curvtype");
            float scale    = getValue("scale");
            Color c1       = getColor("color1");

            if (normals == null)
            {
                normals = new Vector3[C2DMap.sizeX, C2DMap.sizeY];
            }
            if (normals.GetLength(0) != C2DMap.sizeX)
            {
                normals = new Vector3[C2DMap.sizeX, C2DMap.sizeY];
            }

            m1.map.calculateNormals(100, normals);
            for (int i = 0; i < C2DMap.sizeX; i++)
            {
                for (int j = 0; j < C2DMap.sizeY; j++)
                {
                    colors.colors [i, j] = c1 * Mathf.Pow(m1.map.getCurvature(i, j, scale, (int)curvtype, normals), 1);
                }
            }
            colors.Smooth(1);
            updateTexture = true;
            CNodeManager.Progress();

            changed = false;
        }
Пример #4
0
        public override void Calculate()
        {
            base.Calculate();
            if (!verified)
            {
                return;
            }

            CTextureNode m1 = (CTextureNode)getNode(Inputs, 0);

            if (m1 == null)
            {
                verified = false;
                return;
            }

            m1.Calculate();

            if (!changed)
            {
                return;
            }

            float scale = getValue("scale");
            float power = getValue("power");
            Color c1    = getColor("color1");
            Color c2    = getColor("color2");

            Color c = new Color(1, 1, 1);

            for (int i = 0; i < C2DMap.sizeX; i++)
            {
                for (int j = 0; j < C2DMap.sizeY; j++)
                {
                    float val = Mathf.SmoothStep(0, 1.0f, m1.map [i, j] - scale + 0.75f);
                    val = Mathf.Clamp(Mathf.Pow(val, power), 0, 1);
                    c   = c1 * val + c2 * (1 - val);
                    colors.colors [i, j] = c;
                }
            }
            updateTexture = true;
            CNodeManager.Progress();

            changed = false;
        }
Пример #5
0
        public override void Calculate()
        {
            //base.Calculate();

            if (!verified)
            {
                return;
            }

            if (!changed)
            {
                return;
            }


            CTextureNode combiner   = (CTextureNode)getNode(Inputs, 0);
            CTextureNode m1         = (CTextureNode)getNode(Inputs, 1);
            CTextureNode m2         = (CTextureNode)getNode(Inputs, 2);
            C2DMap       combineMap = null;

            if (combiner != null)
            {
                combiner.Calculate();
                combineMap = combiner.map;
            }
            if (m1 == null || m2 == null)
            {
                verified = false;
                return;
            }
            m1.Calculate();
            m2.Calculate();

//			map.Combine(m1.map, m2.map, combineMap, getValue("blendval"), Type);
            colors.Combine(m1.colors, m2.colors, combineMap, getValue("blendval"), Type);
            updateTexture = true;

            colors.Scale(getValue("amplitude"));
            //map.ScaleMap(getValue("amplitude"),0);
            //GenerateHeightTexture();
            CNodeManager.Progress();
            changed = false;
        }
Пример #6
0
        public override void Calculate()
        {
            if (!verified)
            {
                return;
            }

            if (!changed)
            {
                return;
            }
            CTextureNode m1 = (CTextureNode)getNode(Inputs, 0);

            if (m1 == null)
            {
                verified = false;
                return;
            }
            m1.Calculate();
            updateTexture = true;
            //		float scale = getValue("scale");
            map.CopyFrom(m1.map);
        }
Пример #7
0
        public override void Calculate()
        {
            base.Calculate();

            if (!verified)
            {
                return;
            }

            if (!changed)
            {
                return;
            }

            CTextureNode m1 = (CTextureNode)getNode(Inputs, 0);

            if (m1 == null)
            {
                return;
            }
            m1.Calculate();
            map.CopyFrom(m1.map);
            float ascale = 1;

            if (Type == TYPE_SMOOTH)
            {
                map.Smooth((int)(getValue("value1") * 40f), (int)(getValue("value2") * 3f));
            }
            if (Type == TYPE_SCALE)
            {
                map.ScaleMap((getValue("value1") - 0.5f) * 4, 2 * (getValue("value2") - 0.5f));
            }
            if (Type == TYPE_POWER)
            {
                map.Pow((getValue("value1") - 0.5f) * 3, 2 * (getValue("value2") - 0.5f));
            }
            if (Type == TYPE_CONTOURS)
            {
                map.Contour(getValue("value1") * 100f, 4 * (getValue("value2") - 0.5f));
            }
            if (Type == TYPE_CLAMP)
            {
                map.Clamp(getValue("value1"), (getValue("value2")));
                ascale *= 5;
            }
            if (Type == TYPE_PIXEL)
            {
                map.Pixelate(getValue("value1"));
            }


            map.ScaleMap(getValue("amplitude") * ascale, 0);
            GenerateHeightTexture();
            if (Type != TYPE_SMOOTH)
            {
                CNodeManager.Progress();
            }
            updateTexture = true;

            changed = false;
        }