private void ringToolStripMenuItem_Click(object sender, EventArgs e)
 {
     mParticleSystem = new ParticleSytstemRing();
     UpdateUI();
 }
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     mParticleSystem = new ParticleSytstemFire();
     UpdateUI();
 }
 private void modernArtToolStripMenuItem_Click(object sender, EventArgs e)
 {
     mParticleSystem = new ParticleSytstemModernArt();
     UpdateUI();
 }
 private void radiusMode2ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     mParticleSystem = new ParticleSytstemRadiusMode2();
     UpdateUI();
 }
 private void galaxyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     mParticleSystem = new ParticleSytstemGalaxy();
     UpdateUI();
 }
 private void meteorToolStripMenuItem_Click(object sender, EventArgs e)
 {
     mParticleSystem = new ParticleSytstemMeteor();
     UpdateUI();
 }
 private void bigFlowerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     mParticleSystem = new ParticleSytstemBigFlower();
     UpdateUI();
 }
 private void explosionToolStripMenuItem_Click(object sender, EventArgs e)
 {
     mParticleSystem = new ParticleSytstemExplosion();
     UpdateUI();
 }
 private void fireworksToolStripMenuItem_Click(object sender, EventArgs e)
 {
     mParticleSystem = new ParticleSytstemFireworks();
     UpdateUI();
 }
 private void spiralToolStripMenuItem_Click(object sender, EventArgs e)
 {
     mParticleSystem = new ParticleSytstemSpiral();
     UpdateUI();
 }
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog dialog=new OpenFileDialog();
     dialog.Filter = "plist files (*.plist)|*.plist";
     if(dialog.ShowDialog()==DialogResult.OK)
     {
         mFilePath = dialog.FileName;
         mParticleSystem=new ParticleSystem();
         mParticleSystem.Load(mFilePath);
         UpdateUI();
     }
 }
Beispiel #12
0
		public Form1()
		{
			mPS = new ParticleSystem(this);
			
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
            
			mPS.Reset();
			mPS.mCurrentEmitter.CopyToGui();

			mSaveFileDialog = new SaveFileDialog();
			mSaveFileDialog.InitialDirectory = (string)Directory.GetCurrentDirectory().Clone();
			mSaveFileDialog.RestoreDirectory = true;

			mMaterialFileDialog = new OpenFileDialog();
			mMaterialFileDialog.InitialDirectory = (string)Directory.GetCurrentDirectory().Clone();
			mMaterialFileDialog.RestoreDirectory = true;

			mOpenFileDialog = new OpenFileDialog();
			mOpenFileDialog.InitialDirectory = (string)Directory.GetCurrentDirectory().Clone();
			mOpenFileDialog.RestoreDirectory = true;
		}
Beispiel #13
0
 private void PartSysPropertyChanged(object sender, EventArgs e)
 {
     _activeSystem?.Dispose();
     _activeSystem = null;
 }
Beispiel #14
0
        private void RenderFrame(object sender, EventArgs e)
        {
            if (DisableRendering)
                return;

            var args = (RenderingEventArgs) e;

            var w = _outputWidth;
            var h = _outputHeight;
            if (w <= 0 || h <= 0)
            {
                return;
            }

            if (Device == null)
            {
                var presentParams = new PresentParameters(w, h)
                {
                    Windowed = true,
                    SwapEffect = SwapEffect.Discard,
                    DeviceWindowHandle = GetDesktopWindow(),
                    PresentationInterval = PresentInterval.Default
                };
                Device = new DeviceEx(new Direct3DEx(),
                    0,
                    DeviceType.Hardware,
                    IntPtr.Zero,
                    CreateFlags.HardwareVertexProcessing | CreateFlags.Multithreaded | CreateFlags.FpuPreserve,
                    presentParams);
            }

            if (_activeSystem == null && ActiveSystem != null)
            {
                _activeSystem = ParticleSystem.FromSpec(Device, DataPath, ActiveSystem.ToSpec());
            }

            if (D3Dimg.IsFrontBufferAvailable && _lastRender != args.RenderingTime)
            {
                if (_renderTargetSurface == null || _renderTargetWidth != w || _renderTargetHeight != h)
                {
                    _renderTargetWidth = w;
                    _renderTargetHeight = h;

                    _renderTargetSurface?.Dispose();
                    _renderTargetDepth?.Dispose();

                    _renderTargetSurface = Surface.CreateRenderTarget(Device,
                        _renderTargetWidth,
                        _renderTargetHeight,
                        Format.X8R8G8B8,
                        MultisampleType.None,
                        0,
                        false);
                    _renderTargetDepth = Surface.CreateDepthStencil(Device,
                        _renderTargetWidth,
                        _renderTargetHeight,
                        Format.D16,
                        MultisampleType.None,
                        0,
                        true);
                }

                D3Dimg.Lock();

                Device.SetRenderTarget(0, _renderTargetSurface);
                Device.DepthStencilSurface = _renderTargetDepth;

                RenderParticleSystem(w, h, args.RenderingTime);

                D3Dimg.SetBackBuffer(D3DResourceType.IDirect3DSurface9, _renderTargetSurface.NativePointer);
                D3Dimg.AddDirtyRect(new Int32Rect(0, 0, _renderTargetWidth, _renderTargetHeight));
                D3Dimg.Unlock();

                _lastRender = args.RenderingTime;
            }
        }
Beispiel #15
0
 private void PartSysPropertyChanged(object sender, EventArgs e)
 {
     _activeSystem?.Dispose();
     _activeSystem = null;
 }