Exemplo n.º 1
0
        void CreateCubeMap()
        {
            // create the camera used to render to our cubemap
            _cubeCamera             = _sceneManager.CreateCamera("CubeMapCamera", true, true);
            _cubeCamera.FOVy        = new Degree(90);
            _cubeCamera.AspectRatio = 1.0f;
            _cubeCamera.SetFixedYawAxis(false);
            _cubeCamera.NearClipDistance = 5.0f;
            _cubeCamera.FarClipDistance  = /*100*/ 10000;

            var tex = TextureManager.Singleton.CreateManual("dyncubemap", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, TextureType.TEX_TYPE_CUBE_MAP, 512, 512, 0, PixelFormat.PF_R8G8B8, (int)TextureUsage.TU_RENDERTARGET);
            CompositorManager2 compositorManager = _root.CompositorManager2;
            const string       workspaceName     = "CompositorSampleCubemap_cubemap";

            if (!compositorManager.HasWorkspaceDefinition(workspaceName))
            {
                CompositorWorkspaceDef workspaceDef = compositorManager.AddWorkspaceDefinition(workspaceName);
                //"CubemapRendererNode" has been defined in scripts.
                //Very handy (as it 99% the same for everything)
                workspaceDef.ConnectOutput("CubemapRendererNode", 0);
            }

            CompositorChannel channel = new CompositorChannel
            {
                target = tex.GetBuffer(0).GetRenderTarget()
            };

            channel.textures.Add(tex);
            _cubemapWorkspace = compositorManager.AddWorkspace(_sceneManager, channel, _cubeCamera, workspaceName, false);
        }
Exemplo n.º 2
0
        protected override CompositorWorkspace SetupCompositor()
        {
            var compositorManager = _root.CompositorManager2;

            CompositorNodeDef   nodeDef   = compositorManager.GetNodeDefinition("ExampleShadows_Node");
            CompositorTargetDef targetDef = nodeDef.GetTargetPass(0);

            Debug.Assert(
                targetDef.RenderTargetName == IdString.FromString("rt_renderwindow"),
                "Media compositor file was modified. Make sure C++ code is in sync with those changes!");

            var passScene = targetDef.GetCompositorPass(1) as CompositorPassSceneDef;

            Debug.Assert(passScene != null,
                         "Media compositor file was modified. Make sure C++ code is in sync with those changes!");

            passScene.ShadowNodeName = _pssm ? "ExampleShadows_PssmShadowNode" : "ExampleShadows_FocusedShadowNode";

            const string workspaceName = "ShadowsV2Workspace";

            if (!compositorManager.HasWorkspaceDefinition(workspaceName))
            {
                CompositorWorkspaceDef workspaceDef = compositorManager.AddWorkspaceDefinition(workspaceName);
                workspaceDef.ConnectOutput("ExampleShadows_Node", 0);
            }

            return(compositorManager.AddWorkspace(_sceneManager, _window, _camera, workspaceName, true));
        }