Exemplo n.º 1
0
        public static void PerlinNoiseWithAttributesToDebugNodeExecution()
        {
            string perlinNodeName   = "perlin";
            var    perlinAttributes = new BaseGraphCLIAttributes {
                { "persistence", 2.4f }, { "octaves", 6 }
            };

            var graph = GraphBuilder.NewGraph <WorldGraph>()
                        .NewNode <NodePerlinNoise2D>(perlinNodeName, perlinAttributes)
                        .Execute()
                        .GetGraph();

            NodePerlinNoise2D perlinNode = graph.FindNodeByName(perlinNodeName) as NodePerlinNoise2D;

            Assert.That(perlinNode.octaves == 6, "Perlin node octaves expected to be 6 but was " + perlinNode.octaves);
            Assert.That(perlinNode.persistence == 2.4f, "Perlin node persistence expected to be 2.4 but was " + perlinNode.persistence);
        }
        static WorldGraph CreateTestGraph(out NodePerlinNoise2D perlinNode, out NodeDebugInfo debugNode)
        {
            var graph = GraphBuilder.NewGraph <WorldGraph>()
                        .NewNode(typeof(NodePerlinNoise2D), "perlin")
                        .NewNode(typeof(NodeDebugInfo), "debug")
                        .Link("perlin", "debug")
                        .Execute()
                        .GetGraph() as WorldGraph;

            perlinNode = graph.FindNodeByName <NodePerlinNoise2D>("perlin");
            debugNode  = graph.FindNodeByName <NodeDebugInfo>("debug");

            graph.chunkSize     = 64;
            graph.step          = .5f;
            graph.chunkPosition = new Vector3(10, 42, -7);
            graph.seed          = 123456789;

            return(graph as WorldGraph);
        }
Exemplo n.º 3
0
        public static void PerlinNoiseToDebugNodeExecution()
        {
            string perlinNodeName = "perlin";
            string debugNodeName  = "debug";
            var    graph          = GraphBuilder.NewGraph <WorldGraph>()
                                    .NewNode <NodePerlinNoise2D>(perlinNodeName)
                                    .NewNode <NodeDebugInfo>(debugNodeName)
                                    .Link(perlinNodeName, debugNodeName)
                                    .Execute()
                                    .GetGraph();

            NodePerlinNoise2D perlinNode = graph.FindNodeByName(perlinNodeName) as NodePerlinNoise2D;
            NodeDebugInfo     debugNode  = graph.FindNodeByName(debugNodeName) as NodeDebugInfo;

            Assert.That(perlinNode != null, "Perlin node not found in the graph (using FindNodeByName)");
            Assert.That(debugNode != null, "Debug node not found in the graph (using FindNodeByName)");

            NodeLink link = perlinNode.GetOutputLinks().First();

            Assert.That(link != null, "Link can't be found in the graph");
            Assert.That(link.toNode == debugNode);
        }
Exemplo n.º 4
0
 public override void OnNodeEnable()
 {
     node = target as NodePerlinNoise2D;
     delayedChanges.BindCallback(noiseSettingsChangedKey, (unused) => NotifyReload());
 }