Exemplo n.º 1
0
        public override void Initialize(int windowID, int type, int x, int y)
        {
            status_after_click = CNodeManager.STATUS_NONE;
            InitializeWindow(windowID, type, x, y, "RGB Curvature");
            map    = new C2DMap();
            colors = new C2DRGBMap();

            color = LStyle.Colors [3] * 1.0f;

            Outputs.Add(new CConnection(this, 0, CConnection.TYPE1));
            Inputs.Add(new CConnection(this, 1, CConnection.TYPE0));
            types = new string[] { "RGB Curvature" };

            //parameters ["scale"] = new Parameter ("Scale:", 10.0f, 0, 100f);
            parameters ["color1"]   = new Parameter("ColorColor", 0.5f, 0.5f, 0.5f, 0, "color1");
            parameters ["curvtype"] = new Parameter("Type", 1.0f, 1.0f, 6.0f, 1, "curvtype");
            parameters ["scale"]    = new Parameter("Scale", 0.0f, 0.0f, 20.0f, 2, "scale");

            texture     = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);
            helpMessage = "<size=24>" + LStyle.hexColors [1] + "RGB color map curvature. </color></size>" +
                          "\n" +
                          "\n" +
                          "This node is a filter that takes a heigth map as input and assigns a color to regions depending on their curvature properties." +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                          "  " + LStyle.hexColors [1] + "Scale</color>: Amplifies the signal, creating steeper (and narrower) curves. \n" +
                          "  " + LStyle.hexColors [1] + "Type</color>: Type of curvature identification: \n" +
                          "      " + LStyle.hexColors [1] + "1</color>: Hills. \n" +
                          "      " + LStyle.hexColors [1] + "2</color>: Lakes. \n" +
                          "      " + LStyle.hexColors [1] + "3</color>: Hills + Lakes. \n" +
                          "      " + LStyle.hexColors [1] + "4</color>: Upward slopes. \n" +
                          "      " + LStyle.hexColors [1] + "5</color>: Downward slopes. \n" +
                          "      " + LStyle.hexColors [1] + "6</color>: All slopes. \n";
        }
Exemplo n.º 2
0
 public override void resetMaps()
 {
     map     = new C2DMap();
     colors  = new C2DRGBMap();
     texture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);
     changed = true;
 }
Exemplo n.º 3
0
        public override void Initialize(int windowID, int type, int x, int y)
        {
            status_after_click = CNodeManager.STATUS_NONE;
            InitializeWindow(windowID, type, x, y, "NormalMap");
            map    = new C2DMap();
            colors = new C2DRGBMap();
            color  = LStyle.Colors [2] * 1.0f;

            Outputs.Add(new CConnection(this, 0, CConnection.TYPE2));
            Inputs.Add(new CConnection(this, 1, CConnection.TYPE0));
            types = new string[] { "Normal map" };

            //parameters ["threshold"] = new Parameter ("Threshold:", 0f, -1, 1f,0, "threshold");
            parameters ["contrast"] = new Parameter("Contrast:", 5f, -15, 15f, 1, "contrast");

            texture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);

            helpMessage = "<size=24>" + LStyle.hexColors [1] + "Normal map generator. </color></size>" +
                          "\n" +
                          "\n" +
                          "This node takes a height map as input and generates a RGB normal map." +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Contrast</color>: Controls the amplitude of the normal map. \n";
        }
Exemplo n.º 4
0
        public override void Initialize(int windowID, int type, int x, int y)
        {
            status_after_click = CNodeManager.STATUS_NONE;
            InitializeWindow(windowID, type, x, y, "Heightmap Combiner");
            map = new C2DMap();
            setupParameters();
            colors = new C2DRGBMap();

            color    = LStyle.Colors [1] * 2;
            color.b *= 0.5f;

            Outputs.Add(new CConnection(this, 0, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 1, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 2, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 3, CConnection.TYPE0));
            Inputs.Add(new CConnection(this, 4, CConnection.TYPE0));
            Inputs.Add(new CConnection(this, 5, CConnection.TYPE0));
            Inputs.Add(new CConnection(this, 6, CConnection.TYPE0));
            types   = new string[] { "Blend", "Multiply", "Subtract", "Min", "Max" };
            texture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);

            helpMessage = "<size=24>" + LStyle.hexColors [1] + "Height map combiner. </color></size>" +
                          "\n" +
                          "\n" +
                          "This node takes two compulsory height map as input and cobines them through various expressions.\n" +
                          "If the upper input is connected to a heightmap source, the result is blended using this map.\n " +
                          ".\n " +
                          "There are three methods of combining maps: by addition (blend), subraction and multiplication.\n " +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                          "  " + LStyle.hexColors [1] + "Blendval</color>: Weights the two input signals between 0-100% (does not apply for multiply). \n";
        }
Exemplo n.º 5
0
        public override void Initialize(int windowID, int type, int x, int y)
        {
            status_after_click = CNodeManager.STATUS_NONE;
            InitializeWindow(windowID, type, x, y, "Heightmap Curvature");
            map = new C2DMap();
            setupParameters();
            colors = new C2DRGBMap();

            color    = LStyle.Colors [1] * 2;
            color.b *= 0.5f;
            Inputs.Add(new CConnection(this, 0, CConnection.TYPE0));

            Outputs.Add(new CConnection(this, 1, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 2, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 3, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 4, CConnection.TYPE0));
            types   = new string[] { "Curvature" };
            texture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);

            helpMessage = "<size=24>" + LStyle.hexColors [1] + "Height map curvature. </color></size>" +
                          "\n" +
                          "\n" +
                          "This node is a filter that takes one heightmap input and identifies the lakes, hills and curvature regions. " +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                          "  " + LStyle.hexColors [1] + "Scale</color>: Amplifies the signal, creating steepers (and narrower) curves. \n" +
                          "  " + LStyle.hexColors [1] + "Type</color>: Type of identification: \n" +
                          "      " + LStyle.hexColors [1] + "1</color>: Hills. \n" +
                          "      " + LStyle.hexColors [1] + "2</color>: Lakes. \n" +
                          "      " + LStyle.hexColors [1] + "3</color>: Hills + Lakes. \n" +
                          "      " + LStyle.hexColors [1] + "4</color>: Upward slopes. \n" +
                          "      " + LStyle.hexColors [1] + "5</color>: Downward slopes. \n" +
                          "      " + LStyle.hexColors [1] + "6</color>: All slopes. \n";
        }
Exemplo n.º 6
0
        public override void Initialize(int windowID, int type, int x, int y)
        {
            status_after_click = CNodeManager.STATUS_NONE;
            InitializeWindow(windowID, type, x, y, "RGB Height");
            map    = new C2DMap();
            colors = new C2DRGBMap();

            color = LStyle.Colors [3] * 1.0f;

            Outputs.Add(new CConnection(this, 0, CConnection.TYPE1));
            Inputs.Add(new CConnection(this, 1, CConnection.TYPE0));
            types = new string[] { "RGB Height" };

            //parameters ["scale"] = new Parameter ("Scale:", 10.0f, 0, 100f);
            parameters ["color1"] = new Parameter("ColorColor1", 0.5f, 0.5f, 0.5f, 0, "color1");
            parameters ["color2"] = new Parameter("ColorColor2", 0.5f, 0.5f, 0.5f, 1, "color2");
            parameters ["scale"]  = new Parameter("Threshold", 0.5f, 0.0f, 1.0f, 2, "scale");
            parameters ["power"]  = new Parameter("Power", 1.0f, 0.0f, 10.0f, 3, "power");

            texture     = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);
            helpMessage = "<size=24>" + LStyle.hexColors [1] + "RGB color map generator from heightmap. </color></size>" +
                          "\n" +
                          "\n" +
                          "This node takes a heighmap as input and produces a color map that interpolates between two colors given the values from the input map." +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Color 1/2</color>: The base colors for the lowest / highest regions in the map \n" +
                          "  " + LStyle.hexColors [1] + "Threshold</color>: Scales the height threshold for the transition between color 1 and color 2,  \n" +
                          "  " + LStyle.hexColors [1] + "Power</color>: Defines the sharpness of the transition between the colors. \n";
        }
Exemplo n.º 7
0
        public override void Initialize(int windowID, int type, int x, int y)
        {
            status_after_click = CNodeManager.STATUS_NONE;
            InitializeWindow(windowID, type, x, y, "Heightmap Filter");
            map = new C2DMap();
            setupParameters();
            colors = new C2DRGBMap();

            color    = LStyle.Colors [1] * 2;
            color.b *= 0.5f;
            Inputs.Add(new CConnection(this, 0, CConnection.TYPE0));

            Outputs.Add(new CConnection(this, 1, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 2, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 3, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 4, CConnection.TYPE0));
            types = new string[] {
                "Blur",
                "Scale",
                "Power",
                "Contour",
                "Clamp",
                "Pixelate"
            };
            texture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);

            helpMessage = "<size=24>" + LStyle.hexColors [1] + "Height map filter. </color></size>" +
                          "\n" +
                          "\n" +
                          "This node is a filter that takes one heightmap input and transforms the map according to various mathematical procedures, producing an output. " +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Blur:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                          "  " + LStyle.hexColors [1] + "Radius</color>: Scaled pixel distance of blur radius. \n" +
                          "  " + LStyle.hexColors [1] + "Type</color>: Type of Blur - normal (XY) is 0, Y-only is 0.66 and X-only i 1. \n" +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Scale:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                          "  " + LStyle.hexColors [1] + "Scale</color>: Multiplied with the value. Can be negative (for inversion). \n" +
                          "  " + LStyle.hexColors [1] + "Offset</color>: Shifts the input value by offset. \n" +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Power:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                          "  " + LStyle.hexColors [1] + "Power</color>: Calculates new_value = old_value^power. \n" +
                          "  " + LStyle.hexColors [1] + "Offset</color>: Shifts the input value by offset. \n" +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Contour:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                          "  " + LStyle.hexColors [1] + "Contour</color>: Calculates the normal for each pixel and sets the z-component value of the normal. \n" +
                          "  " + LStyle.hexColors [1] + "Offset</color>: Shifts the input value by offset. \n" +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Clamp:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                          "  " + LStyle.hexColors [1] + "Min/Max</color>: Clamps the value between min and max. \n" +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Pixelate:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                          "  " + LStyle.hexColors [1] + "Pixel size</color>: The larger value, the larger the pixel \n";
        }
Exemplo n.º 8
0
        public override void Initialize(int windowID, int type, int x, int y)
        {
            status_after_click = CNodeManager.STATUS_NONE;
            InitializeWindow(windowID, type, x, y, "Pattern Generator");
            map = new C2DMap();
            setupParameters();
            colors       = new C2DRGBMap();
            color        = LStyle.Colors [1] * 2;
            color.b     *= 0.5f;
            displayTypes = false;
            Outputs.Add(new CConnection(this, 0, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 1, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 2, CConnection.TYPE0));
            types   = new string[] { "Grid", "Circles", "Bricks" };
            texture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);

            if (Type == TYPE_GRID)
            {
                helpMessage = "<size=24>" + LStyle.hexColors [1] + "Pattern generator: Regular grid. </color></size>" +
                              "\n" +
                              "\n" +
                              "This node generates a height map with regular grids. " +
                              "\n" +
                              "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                              "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                              "  " + LStyle.hexColors [1] + "Thickness</color>: Defines line thickness. \n" +
                              "  " + LStyle.hexColors [1] + "Spacing X/Y</color>: Spacing width in x and y directions. \n" +
                              "  " + LStyle.hexColors [1] + "Rotation</color>: Rotates the grid by the rotation angle. Be careful, breaks seamlessness except for manually tweaked parameters.  \n";
            }
            if (Type == TYPE_REGULARDOTS)
            {
                helpMessage = "<size=24>" + LStyle.hexColors [1] + "Pattern generator: Regular circles/dots. </color></size>" +
                              "\n" +
                              "\n" +
                              "This node generates a height map with a regular grid of circles/dots " +
                              "\n" +
                              "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                              "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                              "  " + LStyle.hexColors [1] + "Size</color>: Size of the circles. Increase to yield larger circles. \n" +
                              "  " + LStyle.hexColors [1] + "Filling</color>: Filling threshold of circles. Smaller values fill the inner parts of the circles, larger values creates rings. \n" +
                              "  " + LStyle.hexColors [1] + "Spacing X/Y</color>: Spacing width in x and y directions. \n";
            }
            if (Type == TYPE_BRICKS)
            {
                helpMessage = "<size=24>" + LStyle.hexColors [1] + "Pattern generator: Bricks. </color></size>" +
                              "\n" +
                              "\n" +
                              "This node generates a height map of seamless bricks with two types of patterns." +
                              "\n" +
                              "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                              "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                              "  " + LStyle.hexColors [1] + "Thickness</color>: Defines line thickness. \n" +
                              "  " + LStyle.hexColors [1] + "Spacing X/Y</color>: Spacing width in x and y directions. \n" +
                              "  " + LStyle.hexColors [1] + "Type</color>: Brick pattern type. 1 = 'Running bond', 2 = 'Herring bone'. Google them! \n";
            }
        }
Exemplo n.º 9
0
 public override void Initialize(int windowID, int type, int x, int y)
 {
     status_after_click = CNodeManager.STATUS_NONE;
     InitializeWindow(windowID, type, x, y, "FlowerPattern");
     map = new C2DMap();
     setupParameters();
     colors       = new C2DRGBMap();
     displayTypes = false;
     color        = LStyle.Colors [1] * 2;
     color.b     *= 0.5f;
     displayTypes = false;
     Outputs.Add(new CConnection(this, 0, CConnection.TYPE0));
     Outputs.Add(new CConnection(this, 1, CConnection.TYPE0));
     Outputs.Add(new CConnection(this, 2, CConnection.TYPE0));
     types   = new string[] { "FlowerPattern", "Grass" };
     texture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);
     if (Type == TYPE_FLOWER)
     {
         helpMessage = "<size=24>" + LStyle.hexColors [1] + "Flower pattern generator. </color></size>" +
                       "\n" +
                       "\n" +
                       "This node uses random walkers to generate height map with a random plant-like pattern." +
                       "\n" +
                       "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                       "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the overall signal. \n" +
                       "  " + LStyle.hexColors [1] + "Thickness</color>: Thickness of the lines drawn. Thicker branches also grow longer. \n" +
                       "  " + LStyle.hexColors [1] + "Levels</color>: The amount of branches. \n" +
                       "  " + LStyle.hexColors [1] + "Angle</color>: Initial bending angle of the first branch. \n" +
                       "  " + LStyle.hexColors [1] + "Anglescale</color>: Amplitude of the angles of sub-branches. Larger value yields more curls. \n" +
                       "  " + LStyle.hexColors [1] + "Size</color>: Length of branches, controls overall size of pattern. \n" +
                       "  " + LStyle.hexColors [1] + "Seed</color>: Initial random seed. Change to get a new pattern with the same properties. \n";
     }
     if (Type == TYPE_GRASS)
     {
         helpMessage = "<size=24>" + LStyle.hexColors [1] + "Grass pattern generator. </color></size>" +
                       "\n" +
                       "\n" +
                       "This node uses random walkers to generate height map with a pattern of many small random plant-like figures." +
                       "\n" +
                       "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                       "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the overall signal. \n" +
                       "  " + LStyle.hexColors [1] + "Thickness</color>: Thickness of the lines drawn. Thicker branches also grow longer. \n" +
                       "  " + LStyle.hexColors [1] + "Amount</color>: The amount (density) of plant-like figures. \n" +
                       "  " + LStyle.hexColors [1] + "Angle</color>: Initial bending angle of the first branch. \n" +
                       "  " + LStyle.hexColors [1] + "Anglescale</color>: Amplitude of the angles of sub-branches. Larger value yields more curls. \n" +
                       "  " + LStyle.hexColors [1] + "Size</color>: Length of branches, controls overall size of pattern. \n" +
                       "  " + LStyle.hexColors [1] + "Seed</color>: Initial random seed. Change to get a new pattern with the same properties. \n";
     }
 }
Exemplo n.º 10
0
        public override void Initialize(int windowID, int type, int x, int y)
        {
            status_after_click = CNodeManager.STATUS_NONE;
            InitializeWindow(windowID, type, x, y, "RGB Combiner");
            map = new C2DMap();
            setupParameters();
            colors = new C2DRGBMap();

            color = LStyle.Colors [3] * 1.0f;


            Outputs.Add(new CConnection(this, 0, CConnection.TYPE1));
            Outputs.Add(new CConnection(this, 1, CConnection.TYPE1));
            Outputs.Add(new CConnection(this, 2, CConnection.TYPE1));
            Outputs.Add(new CConnection(this, 3, CConnection.TYPE1));
            Inputs.Add(new CConnection(this, 4, CConnection.TYPE0));
            Inputs.Add(new CConnection(this, 5, CConnection.TYPE1));
            Inputs.Add(new CConnection(this, 6, CConnection.TYPE1));
            types   = new string[] { "Blend", "Multiply", "Subtract", "Override", "Min", "Max" };
            texture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);

            helpMessage = "<size=24>" + LStyle.hexColors [1] + "RGB color combiner. </color></size>" +
                          "\n" +
                          "\n" +
                          "This node takes two color maps as input and combines them to a new color map.\n" +
                          "The upper height map input is optional, and only used for the blend and subtract options." +
                          "\n" +
                          "There are four methods of combining maps: by addition (blend), subraction, multiplication and override.\n " +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                          "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the amplitude of the output signal. \n" +
                          "  " + LStyle.hexColors [1] + "Blendval</color>: Weights the two input signals between 0-100% (does not apply for multiply). \n" +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Blend :</color></size>\n" +
                          "  With the blend setting the two colormaps are added together, weighted according to blendval. If a height map is connected, " +
                          "this will also define local weighting of the two color maps, so that some areas are dominated by the one color map, and some by the other.\n" +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Multiply :</color></size>\n" +
                          "  Multiplies the one color map by the other to create the output color map. \n" +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Subtract :</color></size>\n" +
                          "  Subtracts the one color map from the other, with weighting according to blendval. If a height map is connected, " +
                          "this will also define local weighting of the two color maps.\n" +
                          "\n" +
                          "<size=15>" + LStyle.hexColors [2] + "Override :</color></size>\n" +
                          "  Override is used for combining two color maps where one (the lower input) should be prioritized over the other (the middle). \n" +
                          "If the prioritized value is larger than the other signal, the other signal is overridden. \n";
        }
Exemplo n.º 11
0
 public override void Initialize(int windowID, int type, int x, int y)
 {
     status_after_click = CNodeManager.STATUS_NONE;
     InitializeWindow(windowID, type, x, y, "Snowflake");
     map = new C2DMap();
     setupParameters();
     colors       = new C2DRGBMap();
     displayTypes = false;
     color        = LStyle.Colors [1] * 2;
     color.b     *= 0.5f;
     displayTypes = false;
     Outputs.Add(new CConnection(this, 0, CConnection.TYPE0));
     Outputs.Add(new CConnection(this, 1, CConnection.TYPE0));
     Outputs.Add(new CConnection(this, 2, CConnection.TYPE0));
     types   = new string[] { "Snowflake" };
     texture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);
 }
Exemplo n.º 12
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;
        }
Exemplo n.º 13
0
        public static float GetPixelGray(int x, int y, C2DMap map)
        {
            if (x < 0)
            {
                x += (int)size.x;
            }
            if (x >= size.x)
            {
                x -= (int)size.x;
            }
            if (y < 0)
            {
                y += (int)size.y;
            }
            if (y >= size.y)
            {
                y -= (int)size.y;
            }

            return(map.map [x, y] * 255);
        }
Exemplo n.º 14
0
        public override void Initialize(int windowID, int type, int x, int y)
        {
            status_after_click = CNodeManager.STATUS_NONE;
            InitializeWindow(windowID, type, x, y, "Heightmap Generator");
            map = new C2DMap();
            setupParameters();
            colors = new C2DRGBMap();


            color    = LStyle.Colors [1] * 2;
            color.b *= 0.5f;

            displayTypes = false;

            Outputs.Add(new CConnection(this, 0, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 1, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 2, CConnection.TYPE0));
            Outputs.Add(new CConnection(this, 3, CConnection.TYPE0));
            types   = new string[] { "Perlin", "Multiridged", "Swiss", "PerlinClouds" };
            texture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY);

            if (type == TYPE_PERLIN)
            {
                helpMessage = "<size=24>" + LStyle.hexColors [1] + "Perlin texture generator. </color></size>" +
                              "\n" +
                              "\n" +
                              "This node is a generator that produces a standard perlin pattern. " +
                              "\n" +
                              "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                              "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the overall height of the fluctuations. \n" +
                              "  " + LStyle.hexColors [1] + "Octaves</color>: The number of different scales. 1 octave produces fluctuations of roughly the same size. A higher number produces a rich landscape consisting of both small and large structures. Note that more octaves are more computationally demanding. \n" +
                              "  " + LStyle.hexColors [1] + "Scale</color>: The starting width of the fluctuations. Low scale produces wide peaks, high scale produces dense, narrow peaks. \n" +
                              "  " + LStyle.hexColors [1] + "Damping</color>: Damping of small scales. A higher number will more strongly suppress the height of small structures. \n" +
                              "  " + LStyle.hexColors [1] + "Seed</color>: The initial random seed for this generator. Change this to produce a different pattern with similar properties.\n" +
                              "  " + LStyle.hexColors [1] + "Skew</color>: The perlin skewing amplitude. Increase for stronger circular patterns.\n" +
                              "  " + LStyle.hexColors [1] + "Skewscale</color>: The scale of the circular skewing modification.\n";
            }
            if (type == TYPE_PERLINCLOUDS)
            {
                helpMessage = "<size=24>" + LStyle.hexColors [1] + "Perlin cloud texture generator. </color></size>" +
                              "\n" +
                              "\n" +
                              "This node is a generator that produces a modified perlin method, yielding a cloud-like pattern. " +
                              "\n" +
                              "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                              "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the overall height of the fluctuations. \n" +
                              "  " + LStyle.hexColors [1] + "Octaves</color>: The number of different scales. 1 octave produces fluctuations of roughly the same size. A higher number produces a rich landscape consisting of both small and large structures. Note that more octaves are more computationally demanding. \n" +
                              "  " + LStyle.hexColors [1] + "Scale</color>: The starting width of the fluctuations. Low scale produces wide peaks, high scale produces dense, narrow peaks. \n" +
                              "  " + LStyle.hexColors [1] + "Damping</color>: Damping of small scales. A higher number will more strongly suppress the height of small structures. \n" +
                              "  " + LStyle.hexColors [1] + "Seed</color>: The initial random seed for this generator. Change this to produce a different pattern with similar properties.\n" +
                              "  " + LStyle.hexColors [1] + "Skew</color>: The perlin skewing amplitude. Increase for stronger circular patterns.\n" +
                              "  " + LStyle.hexColors [1] + "Skewscale</color>: The scale of the circular skewing modification.\n" +
                              "  " + LStyle.hexColors [1] + "Power</color>: Either smooths or intensifies the pattern by taking the power of the value.\n";
            }
            if (type == TYPE_MULTIRIDGED)
            {
                helpMessage = "<size=24>" + LStyle.hexColors [1] + "Multiridged texture generator. </color></size>" +
                              "\n" +
                              "\n" +
                              "This node is a generator that produces an advanced pattern with ridges, lakes and hills. " +
                              "\n" +
                              "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                              "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the overall height of the fluctuations. \n" +
                              "  " + LStyle.hexColors [1] + "Gain</color>: How 'pointy' the peaks are. Low gain for hilly pattern, high gain for Mordor. Parameter diverges, so play carefully. \n" +
                              "  " + LStyle.hexColors [1] + "Offset</color>: Moves the entire signal up and down. Interfers strongly with gain, so tune this carefully. \n" +
                              "  " + LStyle.hexColors [1] + "Offset2</color>: Internal parameter that changes the offset of the calculated signal. Change from zero to create smoother circle-like patterns. \n" +
                              "  " + LStyle.hexColors [1] + "Lacunarity</color>: Controls the behaviour of small structures. Low lacunarity gives a smooth, hilly signal, high lacunarity gives lots of small structures, and flat lake areas. Parameter diverges, so play carefully. \n" +
                              "  " + LStyle.hexColors [1] + "Scale</color>: The width of the peaks. Low scale produces wide fluctuations, high scale produces many narrow peaks. \n" +
                              "  " + LStyle.hexColors [1] + "Seed</color>: The initial random seed for this generator. Change this to produce a different pattern with similar properties";
            }
            if (type == TYPE_SWISS)
            {
                helpMessage = "<size=24>" + LStyle.hexColors [1] + "Swiss texture generator. </color></size>" +
                              "\n" +
                              "\n" +
                              "This node is a generator that produces an advanced pattern with ridges, lakes and hills. " +
                              "\n" +
                              "<size=15>" + LStyle.hexColors [2] + "Parameters:</color></size>\n" +
                              "  " + LStyle.hexColors [1] + "Amplitude</color>: Controls the overall height of the signal. \n" +
                              "  " + LStyle.hexColors [1] + "Gain</color>:  How 'pointy' the fluctuations are. Low gain for hilly pattern, high gain for Mordor. Parameter diverges, so play carefully. \n" +
                              "  " + LStyle.hexColors [1] + "Power</color>: Smooths the signal internally. Low power gives a contineous 'low mountain' pattern, high power yields smooth valleys between high peaks. \n" +
                              "  " + LStyle.hexColors [1] + "Warp</color>: Defines directon of fake erosion patterns. Warp > 1 produces radial erosion (ravines), warp < 1 produces tangential erosion (circles).  \n" +
                              "  " + LStyle.hexColors [1] + "Offset</color>: Moves the entire signal up and down. Interfers strongly with gain, so tune this carefully. \n" +
                              "  " + LStyle.hexColors [1] + "Lacunarity</color>: Controls the behaviour of small structures. Low lacunarity gives a smooth, hilly signal, high lacunarity gives lots of small structures, and flat lake areas. Parameter diverges, so play carefully. \n" +
                              "  " + LStyle.hexColors [1] + "Scale(x&y)</color>: The width of the peaks in x-y direction. Low scale produces wide fluctuations, high scale produces many narrow peaks. \n" +
                              "  " + LStyle.hexColors [1] + "Seed</color>: The initial random seed for this generator. Change this to produce a different pattern with similar properties";
            }
        }
Exemplo n.º 15
0
        public static Texture2D CreateDOT3(C2DMap pixmap, float contrast, float treshold)
        {
            Texture2D retTexture = new Texture2D(C2DMap.sizeX, C2DMap.sizeY, TextureFormat.ARGB32, false);

            Color[] retColor = new Color[C2DMap.sizeX * C2DMap.sizeY];
            size.x = C2DMap.sizeX;
            size.y = C2DMap.sizeY;
            for (int x = 0; x < size.x; x++)
            {
                for (int y = 0; y < size.y; y++)
                {
                    float tl = -1.0f;
                    float tm = -1.0f;
                    float tr = -1.0f;
                    float ml = -1.0f;
                    float mm = -1.0f;
                    float mr = -1.0f;
                    float bl = -1.0f;
                    float bm = -1.0f;
                    float br = -1.0f;



                    tl = GetPixelGray(x - 1, y - 1, pixmap);

                    tm = GetPixelGray(x, y - 1, pixmap);

                    tr = GetPixelGray(x + 1, y - 1, pixmap);

                    ml = GetPixelGray(x - 1, y, pixmap);
                    mm = GetPixelGray(x, y, pixmap);

                    mr = GetPixelGray(x + 1, y, pixmap);

                    bl = GetPixelGray(x - 1, y + 1, pixmap);

                    bm = GetPixelGray(x, y + 1, pixmap);

                    br = GetPixelGray(x + 1, y + 1, pixmap);


                    if (tl == -1.0f)
                    {
                        tl = mm;
                    }
                    if (tm == -1.0f)
                    {
                        tm = mm;
                    }
                    if (tr == -1.0f)
                    {
                        tr = mm;
                    }
                    if (ml == -1.0f)
                    {
                        ml = mm;
                    }
                    if (mr == -1.0f)
                    {
                        mr = mm;
                    }
                    if (bl == -1.0f)
                    {
                        bl = mm;
                    }
                    if (bm == -1.0f)
                    {
                        bm = mm;
                    }
                    if (br == -1.0f)
                    {
                        br = mm;
                    }

                    float vx = 0.0f;
                    float vy = 0.0f;
                    float vz = 1.0f;

                    float isq2 = 1.0f / Mathf.Sqrt(2.0f);
                    float sum  = 1.0f + isq2 + isq2;

                    float al = (tl * isq2 + ml + bl * isq2) / sum;
                    float ar = (tr * isq2 + mr + br * isq2) / sum;
                    float at = (tl * isq2 + tm + tr * isq2) / sum;
                    float ab = (bl * isq2 + bm + br * isq2) / sum;

                    vx = (al - ar) / 255.0f * contrast;
                    vy = (at - ab) / 255.0f * contrast;


                    float r = vx * 128.5f + 128.5f;
                    float g = vy * 128.5f + 128.5f;
                    float b = vz * 255.0f;

                    if (r < 0)
                    {
                        r = 0f;
                    }
                    if (r > 255)
                    {
                        r = 255f;
                    }
                    if (g < 0)
                    {
                        g = 0f;
                    }
                    if (g > 255)
                    {
                        g = 255f;
                    }
                    if (b < 0)
                    {
                        b = 0f;
                    }
                    if (b > 255)
                    {
                        b = 255f;
                    }

                    Color rgb = new Color(r / 255f, g / 255f, b / 255f, 0.5f);

                    retColor [x + (C2DMap.sizeX * y)] = rgb;
                }
            }
            retTexture.SetPixels(retColor);
            retTexture.wrapMode = TextureWrapMode.Repeat;
            retTexture.Apply();

            return(retTexture);
        }