Ejemplo n.º 1
0
        public void Dispose()
        {
            if (CurrentEffect != null)
            {
                CurrentEffect.Dispose();
                CurrentEffect = null;
            }

            if (effectFactory != null)
            {
                effectFactory.Dispose();
                effectFactory = null;
            }

            if (effectSetting != null)
            {
                effectSetting.Dispose();
                effectSetting = null;
            }

            if (EffectRenderer != null)
            {
                EffectRenderer.Dispose();
                EffectRenderer = null;
            }
        }
Ejemplo n.º 2
0
        public bool Initialize(swig.DeviceType deviceType)
        {
            if (isViewerShown)
            {
                return(false);
            }

            // because internal buffer is 16bit
            var spriteCount = 65000 / 4;

            effectSetting = swig.EffectSetting.Create(hardwareDevice.GraphicsDevice, hardwareDevice.SoundDevice);

            EffectRenderer = new swig.MainScreenEffectRenderer();
            EffectRenderer.Initialize(hardwareDevice.GraphicsDevice, hardwareDevice.SoundDevice, effectSetting, spriteCount, hardwareDevice.GraphicsDevice.GetIsSRGBMode());

            ViewPointController = new swig.ViewPointController();

            ViewPointController.ProjectionStyle = deviceType == swig.DeviceType.OpenGL ? swig.ProjectionMatrixStyle.OpenGLStyle : swig.ProjectionMatrixStyle.DirectXStyle;

            ViewMode_OnChanged(null, null);
            Core.Option.ViewerMode.OnChanged += ViewMode_OnChanged;

            Core.Option.RenderingMode.OnChanged += RenderingMode_OnChanged;
            RenderingMode_OnChanged(null, null);

            Bloom_OnChanged(null, null);
            Core.Environment.PostEffect.BloomSwitch.OnChanged     += Bloom_OnChanged;
            Core.Environment.PostEffect.Bloom.Intensity.OnChanged += Bloom_OnChanged;
            Core.Environment.PostEffect.Bloom.Threshold.OnChanged += Bloom_OnChanged;
            Core.Environment.PostEffect.Bloom.SoftKnee.OnChanged  += Bloom_OnChanged;

            Tonemap_OnChanged(null, null);
            Core.Environment.PostEffect.TonemapSelector.OnChanged          += Tonemap_OnChanged;
            Core.Environment.PostEffect.TonemapReinhard.Exposure.OnChanged += Tonemap_OnChanged;

            effectFactory = new swig.EffectFactory(effectSetting);

            isViewerShown = true;

            return(true);
        }