示例#1
0
        void GetQuadParams(float i, float imax, float x, float y, ref MVector trans,
                           ref MVector scale, ref float rot,
                           ref FXPivot pivot, ref FXBlend blend,
                           ref float luminosity, ref float luminosityRandomness)
        {
            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Blending"))
            {
                if (ParentGraph.IsParameterValueFunction(Id, "Blending"))
                {
                    FunctionGraph g = ParentGraph.GetParameterRaw(Id, "Blending").Value as FunctionGraph;
                    g.SetVar("pos", new MVector(x, y), NodeType.Float2);
                    g.SetVar("iteration", i, NodeType.Float);
                    g.SetVar("maxIterations", imax, NodeType.Float);
                    g.TryAndProcess();
                    blend = (FXBlend)Convert.ToInt32(g.Result);
                }
                else
                {
                    blend = (FXBlend)Convert.ToInt32(ParentGraph.GetParameterValue(Id, "Blending"));
                }
            }

            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Luminosity"))
            {
                if (ParentGraph.IsParameterValueFunction(Id, "Luminosity"))
                {
                    FunctionGraph g = ParentGraph.GetParameterRaw(Id, "Luminosity").Value as FunctionGraph;
                    g.SetVar("pos", new MVector(x, y), NodeType.Float2);
                    g.SetVar("iteration", i, NodeType.Float);
                    g.SetVar("maxIterations", imax, NodeType.Float);
                    g.TryAndProcess();
                    luminosity = Convert.ToSingle(g.Result);
                }
                else
                {
                    luminosity = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "Luminosity"));
                }
            }

            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "LuminosityRandomness"))
            {
                if (ParentGraph.IsParameterValueFunction(Id, "LuminosityRandomness"))
                {
                    FunctionGraph g = ParentGraph.GetParameterRaw(Id, "LuminosityRandomness").Value as FunctionGraph;
                    g.SetVar("pos", new MVector(x, y), NodeType.Float2);
                    g.SetVar("iteration", i, NodeType.Float);
                    g.SetVar("maxIterations", imax, NodeType.Float);
                    g.TryAndProcess();
                    luminosityRandomness = Convert.ToSingle(g.Result);
                }
                else
                {
                    luminosityRandomness = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "LuminosityRandomness"));
                }
            }

            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "PatternPivot"))
            {
                if (ParentGraph.IsParameterValueFunction(Id, "PatternPivot"))
                {
                    FunctionGraph g = ParentGraph.GetParameterRaw(Id, "PatternPivot").Value as FunctionGraph;
                    g.SetVar("pos", new MVector(x, y), NodeType.Float2);
                    g.SetVar("iteration", i, NodeType.Float);
                    g.SetVar("maxIterations", imax, NodeType.Float);
                    g.TryAndProcess();
                    pivot = (FXPivot)Convert.ToInt32(g.Result);
                }
                else
                {
                    pivot = (FXPivot)Convert.ToInt32(ParentGraph.GetParameterValue(Id, "PatternPivot"));
                }
            }

            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Translation"))
            {
                if (ParentGraph.IsParameterValueFunction(Id, "Translation"))
                {
                    FunctionGraph g = ParentGraph.GetParameterRaw(Id, "Translation").Value as FunctionGraph;
                    g.SetVar("pos", new MVector(x, y), NodeType.Float2);
                    g.SetVar("iteration", i, NodeType.Float);
                    g.SetVar("maxIterations", imax, NodeType.Float);
                    g.TryAndProcess();

                    object o = g.Result;
                    if (o != null && o is MVector)
                    {
                        trans = (MVector)o;
                    }
                }
                else
                {
                    object o = ParentGraph.GetParameterValue(Id, "Translation");
                    if (o != null && o is MVector)
                    {
                        trans = (MVector)o;
                    }
                }
            }

            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Scale"))
            {
                if (ParentGraph.IsParameterValueFunction(Id, "Scale"))
                {
                    FunctionGraph g = ParentGraph.GetParameterRaw(Id, "Scale").Value as FunctionGraph;
                    g.SetVar("pos", new MVector(x, y), NodeType.Float2);
                    g.SetVar("iteration", i, NodeType.Float);
                    g.SetVar("maxIterations", imax, NodeType.Float);
                    g.TryAndProcess();

                    object o = g.Result;
                    if (o != null && o is MVector)
                    {
                        scale = (MVector)o;
                    }
                }
                else
                {
                    object o = ParentGraph.GetParameterValue(Id, "Scale");
                    if (o != null && o is MVector)
                    {
                        scale = (MVector)o;
                    }
                }
            }

            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Rotation"))
            {
                if (ParentGraph.IsParameterValueFunction(Id, "Rotation"))
                {
                    FunctionGraph g = ParentGraph.GetParameterRaw(Id, "Rotation").Value as FunctionGraph;
                    g.SetVar("pos", new MVector(x, y), NodeType.Float2);
                    g.SetVar("iteration", i, NodeType.Float);
                    g.SetVar("maxIterations", imax, NodeType.Float);
                    g.TryAndProcess();
                    rot = Convert.ToSingle(g.Result);
                }
                else
                {
                    rot = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "Rotation"));
                }
            }
        }