コード例 #1
0
        public void SetOutputSizeEnumTest()
        {
            Substance.Game.Substance subs  = SubstanceExtensionsTestData.Instance.TestSubstance;
            SubstanceGraph           graph = subs.graphs[0];

            int cachedSize = graph.GetInputVector2Int(SubstanceGraphExtensions.OutputSizeParameter)[0];
            SubstanceOutputSize newSize = cachedSize == 9 ? SubstanceOutputSize._1024 : SubstanceOutputSize._512;

            Debug.Log(graph.GetGeneratedTextures()[0].width);

            graph.SetOutputSize(newSize);

            //NativeFunctions.cppProcessOutputQueue();
            graph.QueueForRender();
            Substance.Game.Substance.RenderSubstancesSync();

            int width = graph.GetGeneratedTextures()[0].width;


            Debug.Log(graph.GetGeneratedTextures()[0].width);

            Assert.AreEqual(width, (newSize == SubstanceOutputSize._1024 ? 1024 : 512));

            graph.SetOutputSize(cachedSize);

            //NativeFunctions.cppProcessOutputQueue();
            graph.QueueForRender();
            Substance.Game.Substance.RenderSubstancesSync();
        }
コード例 #2
0
 private void Update()
 {
     if (Input.GetKeyDown(randomizeKey))
     {
         graph.RandomizeSeed();
         graph.QueueForRender();
     }
     if (Input.GetKeyDown(outputSizeKey))
     {
         graph.SetOutputSize(SubstanceOutputSize._1024);
         graph.QueueForRender();
     }
 }
コード例 #3
0
        public void SetOutputSizeTest()
        {
            Substance.Game.Substance subs  = SubstanceExtensionsTestData.Instance.TestSubstance;
            SubstanceGraph           graph = subs.graphs[0];

            int cachedSize = graph.GetInputVector2Int(SubstanceGraphExtensions.OutputSizeParameter)[0];
            int newSize    = cachedSize == 9 ? 10 : 9;

            graph.SetOutputSize(newSize);
            graph.QueueForRender();

            Substance.Game.Substance.RenderSubstancesSync();

            int width = graph.GetGeneratedTextures()[0].width;

            Debug.Log(string.Format("{0} | {1} | {2} - {3}", width, (newSize == 10 ? 1024 : 512), cachedSize, newSize));

            Assert.AreEqual(width, (newSize == 10 ? 1024 : 512));

            graph.SetOutputSize(cachedSize);
            graph.QueueForRender();

            Substance.Game.Substance.RenderSubstancesSync();
        }
 private void Update()
 {
     if (Input.GetKeyDown(randomizeKey))
     {
         graph.RandomizeSeed();
         graph.QueueForRender();
     }
     if (Input.GetKeyDown(outputSizeKey))
     {
         graph.SetOutputSize(size);
         graph.QueueForRender();
     }
     if (Input.GetKeyDown(renderKey))
     {
         Substance.Game.Substance.RenderSubstancesAsync();
     }
 }
コード例 #5
0
 /// <summary>
 /// Sets and returns the output size of a <see cref="SubstanceGraph"/>.
 /// </summary>
 /// <param name="graph">The graph to set the output size for.</param>
 /// <param name="x">Width of the output size. (10 = 1024)</param>
 /// <param name="y">Height of the output size. (10 = 1024)</param>
 public static Vector2Int SetOutputSize(this SubstanceGraph graph, SubstanceOutputSize x, SubstanceOutputSize y)
 {
     return(graph.SetOutputSize((int)x, (int)y));
 }
コード例 #6
0
 /// <summary>
 /// Sets and returns the output size of a <see cref="SubstanceGraph"/>.
 /// </summary>
 /// <param name="graph">The graph to set the output size for.</param>
 /// <param name="size">The size to set the output size value to. (10 = 1024 x 1024)</param>
 public static Vector2Int SetOutputSize(this SubstanceGraph graph, int size)
 {
     return(graph.SetOutputSize(size, size));
 }
コード例 #7
0
 /// <summary>
 /// Sets and returns the output size of a <see cref="SubstanceGraph"/>.
 /// </summary>
 /// <param name="graph">The graph to set the output size for.</param>
 /// <param name="size">The size to set the output size value to. (10 = 1024 x 1024)</param>
 public static Vector2Int SetOutputSize(this SubstanceGraph graph, SubstanceOutputSize size)
 {
     return(graph.SetOutputSize((int)size));
 }