Exemplo n.º 1
0
 public NodeFactory()
 {
     builtin["Anchor"]                  = new AnchorNode();
     builtin["Appearance"]              = new AppearanceNode();
     builtin["Background"]              = new BackgroundNode();
     builtin["Box"]                     = new BoxNode();
     builtin["Color"]                   = new ColorNode();
     builtin["Cone"]                    = new ConeNode();
     builtin["Coordinate"]              = new CoordinateNode();
     builtin["CoordinateInterpolator"]  = new CoordinateInterpolatorNode();
     builtin["Cylinder"]                = new CylinderNode();
     builtin["DirectionalLight"]        = new DirectionalLightNode();
     builtin["Extrusion"]               = new ExtrusionNode();
     builtin["Group"]                   = new GroupNode();
     builtin["Collision"]               = new CollisionNode();
     builtin["Switch"]                  = new SwitchNode();
     builtin["IndexedFaceSet"]          = new IndexedFaceSetNode();
     builtin["IndexedLineSet"]          = new IndexedLineSetNode();
     builtin["Material"]                = new MaterialNode();
     builtin["NavigationInfo"]          = new NavigationInfoNode();
     builtin["OrientationInterpolator"] = new OrientationInterpolatorNode();
     builtin["Normal"]                  = new NormalNode();
     builtin["PixelTexture"]            = new PixelTextureNode();
     builtin["PointLight"]              = new PointLightNode();
     builtin["PositionInterpolator"]    = new PositionInterpolatorNode();
     builtin["ScalarInterpolator"]      = new ScalarInterpolationNode();
     builtin["Shape"]                   = new ShapeNode();
     builtin["Sphere"]                  = new SphereNode();
     builtin["TextureCoordinate"]       = new TextureCoordinateNode();
     builtin["TimeSensor"]              = new TimeSensorNode();
     builtin["Transform"]               = new TransformNode();
     builtin["Viewpoint"]               = new ViewpointNode();
     builtin["WorldInfo"]               = new WorldInfoNode();
 }
Exemplo n.º 2
0
        public void Load(int saveIndex)
        {
            GameData gameData = JsonUtility.FromJson <GameData>(File.ReadAllText($@"{Application.persistentDataPath}\cnovell.c4ke"));
            SaveData saveData = gameData.GetSaves()[saveIndex];

            for (int page = 0; page <= saveData.GetPageIndex(); page++)
            {
                m_sceneManager.NewPage(page);
                foreach (var character in m_sceneManager.GetCurrentScene().GetPages()[page].GetNodesCharacter())
                {
                    if (saveData.GetCharacters().Find(charFind => charFind.m_nameCharacter == character.GetCharacter().GetName()) != null)
                    {
                        m_sceneManager.LoadNode(character);
                    }
                }

                BackgroundNode node = m_sceneManager.GetCurrentScene().GetPages()[page].GetNodesBackground().Find(bg => bg.GetBackground().GetName() == saveData.GetNameOfBackground());
                if (node != null)
                {
                    m_sceneManager.LoadNode(node);
                }
            }

            m_sceneManager.JumpToNode(m_sceneManager.GetCurrentScene().GetPages()[saveData.GetPageIndex()].GetNodes()[saveData.GetNodeIndex()]);
            m_sceneManager.GetCharacterManager().SetCharactersInfos(saveData.GetCharacters());
        }
Exemplo n.º 3
0
    public BackgroundNodeTests()
    {
        initialState             = A.Dummy <IBackgroundState>();
        newState                 = A.Dummy <IBackgroundState>();
        when                     = A.Dummy <ICondition>();
        context                  = A.Dummy <INavigationContext>();
        context.State.Background = initialState;

        sut = new BackgroundNode(newState, when);
    }
            /// <summary>
            /// overridden copy constructor, copies background and other associated properties
            /// </summary>
            /// <param name="node">node to copy</param>
            /// <param name="position">position to copy to</param>
            public override void Copy(BaseNode node, Vector2 position)
            {
                base.Copy(node, position);

                BackgroundNode backgroundNode = node as BackgroundNode;

                // copy enter/exit toggle
                m_toggleSelection = backgroundNode.m_toggleSelection;

                // copy background selection
                m_background = backgroundNode.m_background;

                // copy fade attributes
                m_fadeColour    = backgroundNode.m_fadeColour;
                m_fadeTime      = backgroundNode.m_fadeTime;
                m_waitForFinish = backgroundNode.m_waitForFinish;
            }
Exemplo n.º 5
0
        private void RefreshColor()
        {
            BackgroundNode.Cleanup();

            CCColor4B CurrColor = new CCColor4B();

            if (Status == ButtonStatus.Pressed)
            {
                CurrColor = ClickedColor;
            }
            else
            {
                CurrColor = NormalColor;
            }

            BackgroundNode.DrawRect(new CCRect(0, 0, ContentSize.Width, ContentSize.Height), CurrColor);
        }
Exemplo n.º 6
0
        public void ProcessBackground(bool nextNode)
        {
            BackgroundNode backgroundNode = m_currentNode as BackgroundNode;
            Color          fadeColour     = backgroundNode.GetFadeColour();
            float          fadeTime       = backgroundNode.GetFadeTime();

            if (backgroundNode.GetToggleSelection() == 0)
            {
                m_currentBackground = backgroundNode.GetBackground();
                m_sceneManager.SetCurrentBackground(m_currentBackground);
                Sprite background    = m_currentBackground.GetBackground();
                bool   waitForFinish = backgroundNode.GetWaitForFinish();
                m_backgroundManager.EnterBackground(background, fadeColour, fadeTime, nextNode, waitForFinish);
            }
            else
            {
                m_backgroundManager.ExitBackground(fadeColour, fadeTime, nextNode);
            }
        }
Exemplo n.º 7
0
            /// <summary>
            ///
            /// </summary>
            public void ProcessBackground()
            {
                // get background node
                BackgroundNode backgroundNode = m_currentNode as BackgroundNode;
                Color          fadeColour     = backgroundNode.GetFadeColour();
                float          fadeTime       = backgroundNode.GetFadeTime();

                // enter or exit?
                if (backgroundNode.GetToggleSelection() == 0) // enter
                {
                    // perform background fade-in
                    Sprite background    = backgroundNode.GetBackground().GetBackground();
                    bool   waitForFinish = backgroundNode.GetWaitForFinish();
                    m_backgroundManager.EnterBackground(background, fadeColour, fadeTime, true, waitForFinish);
                }
                else // exit
                {
                    m_backgroundManager.ExitBackground(fadeColour, fadeTime, true);
                }
            }
Exemplo n.º 8
0
    public async Task ParseAsync(XmlReader reader, IParsingContext parsingContext, IParentParsingContext parentParsingContext)
    {
        var myContext = new TextParentParsingContext();
        await elementParser.ParseAsync(reader, parsingContext, myContext, Settings);

        if (myContext.ParsedText is null)
        {
            return;
        }

        if (myContext.ParsedText.Length == 0)
        {
            parsingContext.LogError(reader, "Era esperado o nome da cor.");
            return;
        }

        var state = new BackgroundState(myContext.ParsedText, BackgroundType.Color, BackgroundPosition.Undefined);
        var node  = new BackgroundNode(state, myContext.When);

        parentParsingContext.AddNode(node);
    }
Exemplo n.º 9
0
        /// <summary>
        /// create a ccl.Scene
        /// </summary>
        /// <param name="client">Client to create scene for</param>
        /// <param name="render_device">Render device to use</param>
        /// <param name="cycles_engine">Engine instance to create for</param>
        /// <returns></returns>
        protected static Scene CreateScene(Client client, Device render_device,
                                           RenderEngine cycles_engine)
        {
            #region set up scene parameters
            var scene_params = new SceneParameters(client, ShadingSystem.SVM, BvhType.Static, false, render_device.IsCpu, false);
            #endregion

            #region create scene
            var scene = new Scene(client, scene_params, render_device)
            {
                #region integrator settings
                Integrator =
                {
                    MaxBounce               = RcCore.It.EngineSettings.MaxBounce,
                    TransparentMaxBounce    = RcCore.It.EngineSettings.TransparentMaxBounce,
                    MaxDiffuseBounce        = RcCore.It.EngineSettings.MaxDiffuseBounce,
                    MaxGlossyBounce         = RcCore.It.EngineSettings.MaxGlossyBounce,
                    MaxTransmissionBounce   = RcCore.It.EngineSettings.MaxTransmissionBounce,
                    MaxVolumeBounce         = RcCore.It.EngineSettings.MaxVolumeBounce,
                    NoCaustics              = RcCore.It.EngineSettings.NoCaustics,
                    DiffuseSamples          = RcCore.It.EngineSettings.DiffuseSamples,
                    GlossySamples           = RcCore.It.EngineSettings.GlossySamples,
                    TransmissionSamples     = RcCore.It.EngineSettings.TransmissionSamples,
                    AoSamples               = RcCore.It.EngineSettings.AoSamples,
                    MeshLightSamples        = RcCore.It.EngineSettings.MeshLightSamples,
                    SubsurfaceSamples       = RcCore.It.EngineSettings.SubsurfaceSamples,
                    VolumeSamples           = RcCore.It.EngineSettings.VolumeSamples,
                    AaSamples               = RcCore.It.EngineSettings.AaSamples,
                    FilterGlossy            = RcCore.It.EngineSettings.FilterGlossy,
                    IntegratorMethod        = RcCore.It.EngineSettings.IntegratorMethod,
                    SampleAllLightsDirect   = RcCore.It.EngineSettings.SampleAllLights,
                    SampleAllLightsIndirect = RcCore.It.EngineSettings.SampleAllLightsIndirect,
                    SampleClampDirect       = RcCore.It.EngineSettings.SampleClampDirect,
                    SampleClampIndirect     = RcCore.It.EngineSettings.SampleClampIndirect,
                    LightSamplingThreshold  = RcCore.It.EngineSettings.LightSamplingThreshold,
                    SamplingPattern         = SamplingPattern.CMJ,
                    Seed      = RcCore.It.EngineSettings.Seed,
                    NoShadows = RcCore.It.EngineSettings.NoShadows,
                }

                #endregion
            };

            scene.Film.SetFilter(FilterType.Gaussian, 1.5f);
            scene.Film.Exposure = 1.0f;
            scene.Film.Update();

            #endregion

            #region background shader

            // we add here a simple background shader. This will be repopulated with
            // other nodes whenever background changes are detected.
            var background_shader = new Shader(client, Shader.ShaderType.World)
            {
                Name = "Rhino Background"
            };

            var bgnode = new BackgroundNode("orig bg");
            bgnode.ins.Color.Value    = new float4(1.0f);
            bgnode.ins.Strength.Value = 1.0f;

            background_shader.AddNode(bgnode);
            bgnode.outs.Background.Connect(background_shader.Output.ins.Surface);
            background_shader.FinalizeGraph();

            scene.AddShader(background_shader);

            scene.Background.Shader      = background_shader;
            scene.Background.AoDistance  = 0.0f;
            scene.Background.AoFactor    = 0.0f;
            scene.Background.Visibility  = PathRay.AllVisibility;
            scene.Background.Transparent = false;

            #endregion

            return(scene);
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            var file = "";

            if (args.Length < 1 || args.Length > 2)
            {
                Console.WriteLine("Wrong count parameter: csycles_tester [--quiet] file.xml");
                return;
            }

            var s = args[args.Length - 1];

            if (!File.Exists(s))
            {
                Console.WriteLine("File {0} doesn't exist.", s);
                return;
            }

            var silent = args.Length == 2 && "--quiet".Equals(args[0]);

            file = Path.GetFullPath(s);
            Console.WriteLine("We get file path: {0}", file);

            var path     = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) ?? "";
            var userpath = Path.Combine(path, "userpath");

            CSycles.path_init(path, userpath);
            CSycles.initialise();

            const uint samples = 50;

            g_update_callback             = StatusUpdateCallback;
            g_update_render_tile_callback = UpdateRenderTileCallback;
            g_write_render_tile_callback  = WriteRenderTileCallback;
            g_logger_callback             = LoggerCallback;

            var client = new Client();

            Client = client;

            /*if (!silent)
             * {
             *      CSycles.set_logger(client.Id, g_logger_callback);
             * }*/

            foreach (var adev in Device.Devices)
            {
                Console.WriteLine("{0}", adev);
            }

            Console.WriteLine("All device capabilities: {0}", Device.Capabilities);

            var dev = Device.FirstCuda;

            Console.WriteLine("Using device {0} {1}", dev.Name, dev.Description);

            var scene_params = new SceneParameters(client, ShadingSystem.SVM, BvhType.Static, false, false, false);
            var scene        = new Scene(client, scene_params, dev);

            Console.WriteLine("Default surface shader {0}", scene.DefaultSurface.Name);

            #region background shader
            var background_shader = new Shader(client, Shader.ShaderType.World)
            {
                Name = "Background shader"
            };

            var bgnode = new BackgroundNode();
            bgnode.ins.Color.Value    = new float4(0.7f);
            bgnode.ins.Strength.Value = 1.0f;

            background_shader.AddNode(bgnode);
            bgnode.outs.Background.Connect(background_shader.Output.ins.Surface);
            background_shader.FinalizeGraph();

            scene.AddShader(background_shader);

            scene.Background.Shader     = background_shader;
            scene.Background.AoDistance = 0.0f;
            scene.Background.AoFactor   = 0.0f;
            scene.Background.Visibility = PathRay.AllVisibility;
            #endregion
            #region diffuse shader

            var diffuse_shader = create_some_setup_shader();
            scene.AddShader(diffuse_shader);
            scene.DefaultSurface = diffuse_shader;
            #endregion

            #region point light shader

            var light_shader = new Shader(client, Shader.ShaderType.Material)
            {
                Name = "Tester light shader"
            };

            var emission_node = new EmissionNode();
            emission_node.ins.Color.Value    = new float4(0.8f);
            emission_node.ins.Strength.Value = 10.0f;

            light_shader.AddNode(emission_node);
            emission_node.outs.Emission.Connect(light_shader.Output.ins.Surface);
            light_shader.FinalizeGraph();
            scene.AddShader(light_shader);
            #endregion

            var xml = new XmlReader(client, file);
            xml.Parse(silent);
            var width  = (uint)scene.Camera.Size.Width;
            var height = (uint)scene.Camera.Size.Height;

            var session_params = new SessionParameters(client, dev)
            {
                Experimental      = false,
                Samples           = (int)samples,
                TileSize          = new Size(64, 64),
                StartResolution   = 64,
                Threads           = (uint)(dev.IsCpu ? 0 : 0),
                ShadingSystem     = ShadingSystem.SVM,
                Background        = true,
                ProgressiveRefine = false
            };
            Session = new Session(client, session_params, scene);
            Session.Reset(width, height, samples);

            if (!silent)
            {
                Session.UpdateCallback     = g_update_callback;
                Session.UpdateTileCallback = g_update_render_tile_callback;
                Session.WriteTileCallback  = g_write_render_tile_callback;
            }
            CSycles.set_logger(client.Id, g_logger_callback);

            Session.Start();
            Session.Wait();

            uint bufsize;
            uint bufstride;
            CSycles.session_get_buffer_info(client.Id, Session.Id, out bufsize, out bufstride);
            var pixels = CSycles.session_copy_buffer(client.Id, Session.Id, bufsize);

            var bmp = new Bitmap((int)width, (int)height);
            for (var x = 0; x < width; x++)
            {
                for (var y = 0; y < height; y++)
                {
                    var i = y * (int)width * 4 + x * 4;
                    var r = ColorClamp((int)(pixels[i] * 255.0f));
                    var g = ColorClamp((int)(pixels[i + 1] * 255.0f));
                    var b = ColorClamp((int)(pixels[i + 2] * 255.0f));
                    var a = ColorClamp((int)(pixels[i + 3] * 255.0f));
                    bmp.SetPixel(x, y, Color.FromArgb(a, r, g, b));
                }
            }
            bmp.Save("test.png", ImageFormat.Png);

            Console.WriteLine("Cleaning up :)");

            CSycles.shutdown();

            Console.WriteLine("Done");
        }
Exemplo n.º 11
0
        public override Shader GetShader()
        {
            if (!string.IsNullOrEmpty(m_original_background.Xml))
            {
                var xml = m_original_background.Xml;
                Shader.ShaderFromXml(ref m_shader, xml);
            }
            else
            {
                var texcoord210 = new TextureCoordinateNode("texcoord");

                var bg_env_texture255 = new EnvironmentTextureNode("bg_env_texture");
                bg_env_texture255.Projection    = TextureNode.EnvironmentProjection.Equirectangular;
                bg_env_texture255.ColorSpace    = TextureNode.TextureColorSpace.None;
                bg_env_texture255.Extension     = TextureNode.TextureExtension.Repeat;
                bg_env_texture255.Interpolation = InterpolationType.Linear;
                bg_env_texture255.IsLinear      = false;

                var bg_color_or_texture259 = new MixNode("bg_color_or_texture");
                bg_color_or_texture259.ins.Color1.Value = m_original_background.Color1AsFloat4;
                bg_color_or_texture259.ins.Fac.Value    = m_original_background.HasBgEnvTextureAsFloat;
                bg_color_or_texture259.BlendType        = MixNode.BlendTypes.Mix;
                bg_color_or_texture259.UseClamp         = false;

                var separate_bg_color265 = new SeparateRgbNode("separate_bg_color");

                var skylight_strength_factor302 = new MathMultiply("skylight_strength_factor");
                skylight_strength_factor302.ins.Value1.Value = m_original_background.BgStrength;
                skylight_strength_factor302.ins.Value2.Value = m_original_background.NonSkyEnvStrengthFactor;
                skylight_strength_factor302.Operation        = MathNode.Operations.Multiply;
                skylight_strength_factor302.UseClamp         = false;

                var factor_r262 = new MathMultiply("factor_r");
                factor_r262.Operation = MathNode.Operations.Multiply;
                factor_r262.UseClamp  = false;

                var factor_g263 = new MathMultiply("factor_g");
                factor_g263.Operation = MathNode.Operations.Multiply;
                factor_g263.UseClamp  = false;

                var factor_b264 = new MathMultiply("factor_b");
                factor_b264.Operation = MathNode.Operations.Multiply;
                factor_b264.UseClamp  = false;

                var gradienttexture281 = new GradientTextureNode("gradienttexture");

                var factored_bg_color266 = new CombineRgbNode("factored_bg_color");

                var gradient_colorramp282 = new ColorRampNode("gradient_colorramp");
                gradient_colorramp282.ColorBand.Stops.Add(new ColorStop()
                {
                    Color = new ccl.float4(0.9411765f, 0.5803922f, 0.07843138f, 1f), Position = 0f
                });
                gradient_colorramp282.ColorBand.Stops.Add(new ColorStop()
                {
                    Color = new ccl.float4(0.5019608f, 0f, 0f, 1f), Position = 1f
                });

                var refl_env_texture256 = new EnvironmentTextureNode("refl_env_texture");
                refl_env_texture256.Projection    = TextureNode.EnvironmentProjection.Equirectangular;
                refl_env_texture256.ColorSpace    = TextureNode.TextureColorSpace.None;
                refl_env_texture256.Extension     = TextureNode.TextureExtension.Repeat;
                refl_env_texture256.Interpolation = InterpolationType.Linear;
                refl_env_texture256.IsLinear      = false;

                var refl_color_or_texture260 = new MixNode("refl_color_or_texture");
                refl_color_or_texture260.ins.Color1.Value = m_original_background.ReflectionColorAs4float;
                refl_color_or_texture260.ins.Fac.Value    = m_original_background.HasReflEnvTextureAsFloat;
                refl_color_or_texture260.BlendType        = MixNode.BlendTypes.Mix;
                refl_color_or_texture260.UseClamp         = false;

                var separate_refl_color270 = new SeparateRgbNode("separate_refl_color");

                var skylight_strength_factor303 = new MathMultiply("skylight_strength_factor");
                skylight_strength_factor303.ins.Value1.Value = m_original_background.ReflStrength;
                skylight_strength_factor303.ins.Value2.Value = m_original_background.NonSkyEnvStrengthFactor;
                skylight_strength_factor303.Operation        = MathNode.Operations.Multiply;
                skylight_strength_factor303.UseClamp         = false;

                var factor_refl_r267 = new MathMultiply("factor_refl_r");
                factor_refl_r267.Operation = MathNode.Operations.Multiply;
                factor_refl_r267.UseClamp  = false;

                var factor_refl_g268 = new MathMultiply("factor_refl_g");
                factor_refl_g268.Operation = MathNode.Operations.Multiply;
                factor_refl_g268.UseClamp  = false;

                var factor_refl_b269 = new MathMultiply("factor_refl_b");
                factor_refl_b269.Operation = MathNode.Operations.Multiply;
                factor_refl_b269.UseClamp  = false;

                var light_path235 = new LightPathNode("light_path");

                var use_reflect_refract_when_glossy_and_reflection285 = new MathMultiply("use_reflect_refract_when_glossy_and_reflection");
                use_reflect_refract_when_glossy_and_reflection285.Operation = MathNode.Operations.Multiply;
                use_reflect_refract_when_glossy_and_reflection285.UseClamp  = false;

                var gradient_or_other283 = new MixNode("gradient_or_other");
                gradient_or_other283.ins.Fac.Value = m_original_background.UseGradientAsFloat;
                gradient_or_other283.BlendType     = MixNode.BlendTypes.Mix;
                gradient_or_other283.UseClamp      = false;

                var factored_refl_color271 = new CombineRgbNode("factored_refl_color");

                var refl_env_when_enabled286 = new MathMultiply("refl_env_when_enabled");
                refl_env_when_enabled286.ins.Value1.Value = m_original_background.UseCustomReflectionEnvironmentAsFloat;
                refl_env_when_enabled286.Operation        = MathNode.Operations.Multiply;
                refl_env_when_enabled286.UseClamp         = false;

                var skycolor_or_final_bg284 = new MixNode("skycolor_or_final_bg");
                skycolor_or_final_bg284.ins.Color2.Value = m_original_background.SkyColorAs4float;
                skycolor_or_final_bg284.ins.Fac.Value    = m_original_background.UseSkyColorAsFloat;
                skycolor_or_final_bg284.BlendType        = MixNode.BlendTypes.Mix;
                skycolor_or_final_bg284.UseClamp         = false;

                var sky_env_texture257 = new EnvironmentTextureNode("sky_env_texture");
                sky_env_texture257.Projection    = TextureNode.EnvironmentProjection.Equirectangular;
                sky_env_texture257.ColorSpace    = TextureNode.TextureColorSpace.None;
                sky_env_texture257.Extension     = TextureNode.TextureExtension.Repeat;
                sky_env_texture257.Interpolation = InterpolationType.Linear;
                sky_env_texture257.IsLinear      = false;

                var sky_color_or_texture258 = new MixNode("sky_color_or_texture");
                sky_color_or_texture258.ins.Fac.Value = m_original_background.HasSkyEnvTextureAsFloat;
                sky_color_or_texture258.BlendType     = MixNode.BlendTypes.Mix;
                sky_color_or_texture258.UseClamp      = false;

                var separate_sky_color275 = new SeparateRgbNode("separate_sky_color");

                var sky_or_not261 = new MathMultiply("sky_or_not");
                sky_or_not261.ins.Value1.Value = m_original_background.SkyStrength;
                sky_or_not261.ins.Value2.Value = m_original_background.SkylightEnabledAsFloat;
                sky_or_not261.Operation        = MathNode.Operations.Multiply;
                sky_or_not261.UseClamp         = false;

                var factor_sky_r272 = new MathMultiply("factor_sky_r");
                factor_sky_r272.Operation = MathNode.Operations.Multiply;
                factor_sky_r272.UseClamp  = false;

                var factor_sky_g273 = new MathMultiply("factor_sky_g");
                factor_sky_g273.Operation = MathNode.Operations.Multiply;
                factor_sky_g273.UseClamp  = false;

                var factor_sky_b274 = new MathMultiply("factor_sky_b");
                factor_sky_b274.Operation = MathNode.Operations.Multiply;
                factor_sky_b274.UseClamp  = false;

                var factored_sky_color276 = new CombineRgbNode("factored_sky_color");

                var non_camera_rays290 = new MathSubtract("non_camera_rays");
                non_camera_rays290.ins.Value1.Value = 1f;
                non_camera_rays290.Operation        = MathNode.Operations.Subtract;
                non_camera_rays290.UseClamp         = false;

                var camera_and_transmission294 = new MathAdd("camera_and_transmission");
                camera_and_transmission294.Operation = MathNode.Operations.Add;
                camera_and_transmission294.UseClamp  = false;

                var invert_refl_switch300 = new MathSubtract("invert_refl_switch");
                invert_refl_switch300.ins.Value1.Value = 1f;
                invert_refl_switch300.Operation        = MathNode.Operations.Subtract;
                invert_refl_switch300.UseClamp         = false;

                var invert_cam_and_transm292 = new MathSubtract("invert_cam_and_transm");
                invert_cam_and_transm292.ins.Value1.Value = 1f;
                invert_cam_and_transm292.Operation        = MathNode.Operations.Subtract;
                invert_cam_and_transm292.UseClamp         = false;

                var refl_bg_or_custom_env291 = new MixNode("refl_bg_or_custom_env");
                refl_bg_or_custom_env291.BlendType = MixNode.BlendTypes.Mix;
                refl_bg_or_custom_env291.UseClamp  = false;

                var light_with_bg_or_sky289 = new MixNode("light_with_bg_or_sky");
                light_with_bg_or_sky289.BlendType = MixNode.BlendTypes.Mix;
                light_with_bg_or_sky289.UseClamp  = false;

                var if_not_cam_nor_transm_nor_glossyrefl301 = new MathMultiply("if_not_cam_nor_transm_nor_glossyrefl");
                if_not_cam_nor_transm_nor_glossyrefl301.Operation = MathNode.Operations.Multiply;
                if_not_cam_nor_transm_nor_glossyrefl301.UseClamp  = false;

                var mix295 = new MixNode("mix");
                mix295.BlendType = MixNode.BlendTypes.Mix;
                mix295.UseClamp  = false;

                var final_bg280 = new BackgroundNode("final_bg");
                final_bg280.ins.Strength.Value = 1f;


                m_shader.AddNode(texcoord210);
                m_shader.AddNode(bg_env_texture255);
                m_shader.AddNode(bg_color_or_texture259);
                m_shader.AddNode(separate_bg_color265);
                m_shader.AddNode(skylight_strength_factor302);
                m_shader.AddNode(factor_r262);
                m_shader.AddNode(factor_g263);
                m_shader.AddNode(factor_b264);
                m_shader.AddNode(gradienttexture281);
                m_shader.AddNode(factored_bg_color266);
                m_shader.AddNode(gradient_colorramp282);
                m_shader.AddNode(refl_env_texture256);
                m_shader.AddNode(refl_color_or_texture260);
                m_shader.AddNode(separate_refl_color270);
                m_shader.AddNode(skylight_strength_factor303);
                m_shader.AddNode(factor_refl_r267);
                m_shader.AddNode(factor_refl_g268);
                m_shader.AddNode(factor_refl_b269);
                m_shader.AddNode(light_path235);
                m_shader.AddNode(use_reflect_refract_when_glossy_and_reflection285);
                m_shader.AddNode(gradient_or_other283);
                m_shader.AddNode(factored_refl_color271);
                m_shader.AddNode(refl_env_when_enabled286);
                m_shader.AddNode(skycolor_or_final_bg284);
                m_shader.AddNode(sky_env_texture257);
                m_shader.AddNode(sky_color_or_texture258);
                m_shader.AddNode(separate_sky_color275);
                m_shader.AddNode(sky_or_not261);
                m_shader.AddNode(factor_sky_r272);
                m_shader.AddNode(factor_sky_g273);
                m_shader.AddNode(factor_sky_b274);
                m_shader.AddNode(factored_sky_color276);
                m_shader.AddNode(non_camera_rays290);
                m_shader.AddNode(camera_and_transmission294);
                m_shader.AddNode(invert_refl_switch300);
                m_shader.AddNode(invert_cam_and_transm292);
                m_shader.AddNode(refl_bg_or_custom_env291);
                m_shader.AddNode(light_with_bg_or_sky289);
                m_shader.AddNode(if_not_cam_nor_transm_nor_glossyrefl301);
                m_shader.AddNode(mix295);
                m_shader.AddNode(final_bg280);


                texcoord210.outs.Generated.Connect(bg_env_texture255.ins.Vector);
                bg_env_texture255.outs.Color.Connect(bg_color_or_texture259.ins.Color2);
                bg_color_or_texture259.outs.Color.Connect(separate_bg_color265.ins.Image);
                separate_bg_color265.outs.R.Connect(factor_r262.ins.Value1);
                skylight_strength_factor302.outs.Value.Connect(factor_r262.ins.Value2);
                separate_bg_color265.outs.G.Connect(factor_g263.ins.Value1);
                skylight_strength_factor302.outs.Value.Connect(factor_g263.ins.Value2);
                separate_bg_color265.outs.B.Connect(factor_b264.ins.Value1);
                skylight_strength_factor302.outs.Value.Connect(factor_b264.ins.Value2);
                texcoord210.outs.Window.Connect(gradienttexture281.ins.Vector);
                factor_r262.outs.Value.Connect(factored_bg_color266.ins.R);
                factor_g263.outs.Value.Connect(factored_bg_color266.ins.G);
                factor_b264.outs.Value.Connect(factored_bg_color266.ins.B);
                gradienttexture281.outs.Fac.Connect(gradient_colorramp282.ins.Fac);
                texcoord210.outs.Generated.Connect(refl_env_texture256.ins.Vector);
                refl_env_texture256.outs.Color.Connect(refl_color_or_texture260.ins.Color2);
                refl_color_or_texture260.outs.Color.Connect(separate_refl_color270.ins.Image);
                separate_refl_color270.outs.R.Connect(factor_refl_r267.ins.Value1);
                skylight_strength_factor303.outs.Value.Connect(factor_refl_r267.ins.Value2);
                separate_refl_color270.outs.G.Connect(factor_refl_g268.ins.Value1);
                skylight_strength_factor303.outs.Value.Connect(factor_refl_g268.ins.Value2);
                separate_refl_color270.outs.B.Connect(factor_refl_b269.ins.Value1);
                skylight_strength_factor303.outs.Value.Connect(factor_refl_b269.ins.Value2);
                light_path235.outs.IsGlossyRay.Connect(use_reflect_refract_when_glossy_and_reflection285.ins.Value1);
                light_path235.outs.IsReflectionRay.Connect(use_reflect_refract_when_glossy_and_reflection285.ins.Value2);
                factored_bg_color266.outs.Image.Connect(gradient_or_other283.ins.Color1);
                gradient_colorramp282.outs.Color.Connect(gradient_or_other283.ins.Color2);
                factor_refl_r267.outs.Value.Connect(factored_refl_color271.ins.R);
                factor_refl_g268.outs.Value.Connect(factored_refl_color271.ins.G);
                factor_refl_b269.outs.Value.Connect(factored_refl_color271.ins.B);
                use_reflect_refract_when_glossy_and_reflection285.outs.Value.Connect(refl_env_when_enabled286.ins.Value2);
                gradient_or_other283.outs.Color.Connect(skycolor_or_final_bg284.ins.Color1);
                texcoord210.outs.Generated.Connect(sky_env_texture257.ins.Vector);
                skycolor_or_final_bg284.outs.Color.Connect(sky_color_or_texture258.ins.Color1);
                sky_env_texture257.outs.Color.Connect(sky_color_or_texture258.ins.Color2);
                sky_color_or_texture258.outs.Color.Connect(separate_sky_color275.ins.Image);
                separate_sky_color275.outs.R.Connect(factor_sky_r272.ins.Value1);
                sky_or_not261.outs.Value.Connect(factor_sky_r272.ins.Value2);
                separate_sky_color275.outs.G.Connect(factor_sky_g273.ins.Value1);
                sky_or_not261.outs.Value.Connect(factor_sky_g273.ins.Value2);
                separate_sky_color275.outs.B.Connect(factor_sky_b274.ins.Value1);
                sky_or_not261.outs.Value.Connect(factor_sky_b274.ins.Value2);
                factor_sky_r272.outs.Value.Connect(factored_sky_color276.ins.R);
                factor_sky_g273.outs.Value.Connect(factored_sky_color276.ins.G);
                factor_sky_b274.outs.Value.Connect(factored_sky_color276.ins.B);
                light_path235.outs.IsCameraRay.Connect(non_camera_rays290.ins.Value2);
                light_path235.outs.IsCameraRay.Connect(camera_and_transmission294.ins.Value1);
                light_path235.outs.IsTransmissionRay.Connect(camera_and_transmission294.ins.Value2);
                refl_env_when_enabled286.outs.Value.Connect(invert_refl_switch300.ins.Value2);
                camera_and_transmission294.outs.Value.Connect(invert_cam_and_transm292.ins.Value2);
                gradient_or_other283.outs.Color.Connect(refl_bg_or_custom_env291.ins.Color1);
                factored_refl_color271.outs.Image.Connect(refl_bg_or_custom_env291.ins.Color2);
                refl_env_when_enabled286.outs.Value.Connect(refl_bg_or_custom_env291.ins.Fac);
                gradient_or_other283.outs.Color.Connect(light_with_bg_or_sky289.ins.Color1);
                factored_sky_color276.outs.Image.Connect(light_with_bg_or_sky289.ins.Color2);
                non_camera_rays290.outs.Value.Connect(light_with_bg_or_sky289.ins.Fac);
                invert_refl_switch300.outs.Value.Connect(if_not_cam_nor_transm_nor_glossyrefl301.ins.Value1);
                invert_cam_and_transm292.outs.Value.Connect(if_not_cam_nor_transm_nor_glossyrefl301.ins.Value2);
                refl_bg_or_custom_env291.outs.Color.Connect(mix295.ins.Color1);
                light_with_bg_or_sky289.outs.Color.Connect(mix295.ins.Color2);
                if_not_cam_nor_transm_nor_glossyrefl301.outs.Value.Connect(mix295.ins.Fac);
                mix295.outs.Color.Connect(final_bg280.ins.Color);

                // extra code

                gradient_colorramp282.ColorBand.Stops.Clear();
                // bottom color on 0.0f
                gradient_colorramp282.ColorBand.InsertColorStop(m_original_background.Color2AsFloat4, 0.0f);
                // top color on 1.0f
                gradient_colorramp282.ColorBand.InsertColorStop(m_original_background.Color1AsFloat4, 1.0f);

                // rotate the window vector
                gradienttexture281.Rotation = RenderEngine.CreateFloat4(0.0, 0.0, 1.570796);

                if (m_original_background.BackgroundFill == BackgroundStyle.Environment && m_original_background.HasBgEnvTexture)
                {
                    RenderEngine.SetTextureImage(bg_env_texture255, m_original_background.BgTexture);
                    _SetEnvironmentProjection(m_original_background.BgTexture, bg_env_texture255);
                    bg_env_texture255.Rotation = m_original_background.BgTexture.Transform.z;
                }
                if (m_original_background.BackgroundFill == BackgroundStyle.WallpaperImage && m_original_background.Wallpaper.HasTextureImage)
                {
                    RenderEngine.SetTextureImage(bg_env_texture255, m_original_background.Wallpaper);
                    bg_env_texture255.Projection = TextureNode.EnvironmentProjection.Wallpaper;
                }
                if (m_original_background.HasReflEnvTexture)
                {
                    RenderEngine.SetTextureImage(refl_env_texture256, m_original_background.ReflectionTexture);
                    _SetEnvironmentProjection(m_original_background.ReflectionTexture, refl_env_texture256);
                }
                if (m_original_background.HasSkyEnvTexture)
                {
                    RenderEngine.SetTextureImage(sky_env_texture257, m_original_background.SkyTexture);
                    _SetEnvironmentProjection(m_original_background.SkyTexture, sky_env_texture257);
                }

                final_bg280.outs.Background.Connect(m_shader.Output.ins.Surface);
            }

            // phew, done.
            m_shader.FinalizeGraph();
            m_shader.Tag();

            return(m_shader);
        }