示例#1
0
        public void InitializeRendering(AnimationEditor editor, DeviceManager deviceManager, WadMoveable skin)
        {
            if (LicenseManager.UsageMode != LicenseUsageMode.Runtime)
            {
                return;
            }

            base.InitializeRendering(deviceManager.Device, Configuration.RenderingItem_Antialias);
            ResetCamera();

            _editor      = editor;
            _wadRenderer = new WadRenderer(deviceManager.___LegacyDevice);
            _model       = _wadRenderer.GetMoveable(editor.Moveable);

            Configuration = _editor.Tool.Configuration;

            if (skin != null)
            {
                _skinModel = _wadRenderer.GetMoveable(skin);
            }

            // Actual "InitializeRendering"
            _fontTexture = Device.CreateTextureAllocator(new RenderingTextureAllocator.Description {
                Size = new VectorInt3(512, 512, 2)
            });
            _fontDefault = Device.CreateFont(new RenderingFont.Description {
                FontName = "Segoe UI", FontSize = 24, FontIsBold = true, TextureAllocator = _fontTexture
            });

            // Legacy rendering
            {
                _device        = deviceManager.___LegacyDevice;
                _deviceManager = deviceManager;
                new BasicEffect(_device); // This effect is used for editor special meshes like sinks, cameras, light meshes, etc
                SharpDX.Direct3D11.RasterizerStateDescription renderStateDesc =
                    new SharpDX.Direct3D11.RasterizerStateDescription
                {
                    CullMode                 = SharpDX.Direct3D11.CullMode.None,
                    DepthBias                = 0,
                    DepthBiasClamp           = 0,
                    FillMode                 = SharpDX.Direct3D11.FillMode.Wireframe,
                    IsAntialiasedLineEnabled = true,
                    IsDepthClipEnabled       = true,
                    IsFrontCounterClockwise  = false,
                    IsMultisampleEnabled     = true,
                    IsScissorEnabled         = false,
                    SlopeScaledDepthBias     = 0
                };

                _rasterizerWireframe = RasterizerState.New(deviceManager.___LegacyDevice, renderStateDesc);

                _gizmo = new GizmoAnimationEditor(editor, _device, _deviceManager.___LegacyEffects["Solid"], this);
                _plane = GeometricPrimitive.GridPlane.New(_device, 8, 4);
            }
        }
示例#2
0
        public void InitializeRendering(WadToolClass tool, DeviceManager deviceManager)
        {
            if (LicenseManager.UsageMode != LicenseUsageMode.Runtime)
            {
                return;
            }

            base.InitializeRendering(deviceManager.Device, tool.Configuration.RenderingItem_Antialias);
            _tool = tool;

            // Actual "InitializeRendering"
            _fontTexture = Device.CreateTextureAllocator(new RenderingTextureAllocator.Description {
                Size = new VectorInt3(512, 512, 2)
            });
            _fontDefault = Device.CreateFont(new RenderingFont.Description {
                FontName = "Segoe UI", FontSize = 24, FontIsBold = true, TextureAllocator = _fontTexture
            });

            // Legacy rendering
            {
                _device        = deviceManager.___LegacyDevice;
                _deviceManager = deviceManager;
                _wadRenderer   = new WadRenderer(_device);
                new BasicEffect(_device); // This effect is used for editor special meshes like sinks, cameras, light meshes, etc
                _rasterizerWireframe = RasterizerState.New(_device, new SharpDX.Direct3D11.RasterizerStateDescription
                {
                    CullMode                 = SharpDX.Direct3D11.CullMode.None,
                    DepthBias                = 0,
                    DepthBiasClamp           = 0,
                    FillMode                 = SharpDX.Direct3D11.FillMode.Wireframe,
                    IsAntialiasedLineEnabled = true,
                    IsDepthClipEnabled       = true,
                    IsFrontCounterClockwise  = false,
                    IsMultisampleEnabled     = true,
                    IsScissorEnabled         = false,
                    SlopeScaledDepthBias     = 0
                });
                _gizmo        = new GizmoStaticEditor(_tool.Configuration, _device, _deviceManager.___LegacyEffects["Solid"], this);
                _gizmoLight   = new GizmoStaticEditorLight(_tool.Configuration, _device, _deviceManager.___LegacyEffects["Solid"], this);
                _plane        = GeometricPrimitive.GridPlane.New(_device, 8, 4);
                _littleSphere = GeometricPrimitive.Sphere.New(_device, 2 * 128.0f, 8);
                _sphere       = GeometricPrimitive.Sphere.New(_device, 1024.0f, 6);
            }
        }