protected override void OnInitialize() { Thread.CurrentThread.Priority = ThreadPriority.Highest; SharedEffects.Effects.Add("ImposterFloat", new ImposterFloatEffect()); SharedEffects.Effects.Add("ImposterFloatPalette", new ImposterFloatPaletteEffect()); SharedEffects.Effects.Add("WarpGridEffect", new WarpGridEffect()); SharedEffects.Effects.Add("Particle2", new ParticleEffect2()); base.OnInitialize(); m_Resources.Add(ArtworkStaticObjects.KinectDevices); this.BackgroundColor = new Color4(0, 0, 0, 0); GameConfiguration.ActiveRegion = new Rectangle(0, 0, WindowWidth, WindowHeight); m_View = new View3D(GameConfiguration.ActiveRegion, WindowWidth, WindowHeight, (float)Math.PI / 4, 1f); ArtworkStaticObjects.View = m_View; ArtworkStaticObjects.View.Projection = Matrix.OrthoLH(2, 2, 0, 10); ArtworkStaticObjects.View.View = Matrix.Translation(-1, 0, 0); m_SimulationScene = new SimulationScene(); m_Resources.Add(m_SimulationScene); m_SetupScene = new SetupScene(); m_Resources.Add(m_SetupScene); m_SplashScreen = new SplashScreen(m_SetupScene); m_SplashScreen.Initialize(); m_Resources.Add(m_SplashScreen); }
protected override void OnInitialize() { base.OnInitialize(); this.BackgroundColor = new Color4(0, 0, 0, 0); m_View = new View3D(WindowWidth, WindowHeight, (float)Math.PI / 4, 1f); m_Splash = new SplashScreen(); m_Splash.Initialize(); m_Scene = new ExperimentScene(); m_Imposter = new Imposter(WindowWidth, WindowHeight, Format.R16G16B16A16_Float, new Color4(0f, 0f, 0f, 0f), ImposterOverlayType.None); m_BrightPassView = new BrightPassView(WindowWidth / 2, WindowHeight / 2, Format.R16G16B16A16_Float, new Color4(0f, 0f, 0f, 0f), ImposterOverlayType.None_BrightPass); m_Bloom = new BloomChain(WindowWidth / 2, WindowHeight / 2, Format.R16G16B16A16_Float); m_Splash.IsVisible = true; m_ScreenCapture = new ScreenCapture(); if (m_Splash.IsVisible == false) { Cursor.Hide(); } }
public override void WriteVisibleElements(View3D view, RectangleF ClientBounds, ref RectangleF RemainingBounds, SlimDX.DataStream LineVerts, ref int LineVertsCount, SlimDX.DataStream LinesIndices, ref int LinesIndicesCount, SlimDX.DataStream TriangleVerts, ref int TriangleVertsCount, SlimDX.DataStream TriangleIndices, ref int TriangleIndicesCount) { base.WriteVisibleElements(view, ClientBounds, ref RemainingBounds, LineVerts, ref LineVertsCount, LinesIndices, ref LinesIndicesCount, TriangleVerts, ref TriangleVertsCount, TriangleIndices, ref TriangleIndicesCount); }
public void RenderVolumeToImposter(IScene scene, View3D view) { m_Effect.RenderVolumeTexture(VolumeViewport, view.Camera.Center, VolumeBounds, VolumeBoundsVertsBindings, VolumeBoundsIndices, VolumeTextureResourceView, RayStartView, RayStartResourceView, RayDirectionView, RayDirectionResourceView, ImposterView, InsideVertices, InsideVerticesBindings); }
public override void Render(View3D view, Viewport viewport) { m_View.Resize(new System.Drawing.Rectangle(0, 0, (int)viewport.Width, (int)viewport.Height), (int)viewport.Width, (int)viewport.Height); float x, y, w, h; float widthPerImage = (float)(viewport.Width / m_KinectColorImages.Count); float heightPerImage = (widthPerImage / 4) * 3; RectangleF imageBounds = new RectangleF(0, (viewport.Height - heightPerImage) * 0.5f, widthPerImage, heightPerImage); switch (KinectImageMode) { case KinectImageMode.Color: foreach (KinectColorImageTexture color in m_KinectColorImages) { UiStyleHelper.CovertToVertCoords(imageBounds, m_View.WindowSize, m_View.PixelSize, out x, out y, out w, out h); color.Rectangle = new RectangleF(x, y, w, h); color.Update(); color.Render(m_View); imageBounds.Offset(widthPerImage, 0); } break; case KinectImageMode.RawDepth: case KinectImageMode.DepthBackgroundImage: case KinectImageMode.DepthBackgroundRemoved: foreach (KinectDepthImageTexture depth in m_KinectDepthImages) { UiStyleHelper.CovertToVertCoords(imageBounds, m_View.WindowSize, m_View.PixelSize, out x, out y, out w, out h); depth.Rectangle = new RectangleF(x, y, w, h); switch (KinectImageMode) { case KinectImageMode.RawDepth: depth.ImageType = KinectDepthImageType.RawDepth; break; case KinectImageMode.DepthBackgroundImage: depth.ImageType = KinectDepthImageType.DepthBackgroundImage; break; case KinectImageMode.DepthBackgroundRemoved: depth.ImageType = KinectDepthImageType.DepthBackgroundRemoved; break; default: break; } depth.Update(); depth.Render(m_View); imageBounds.Offset(widthPerImage, 0); } break; default: break; } }
public ImposterFloat(int width, int height, Format format, Color4 background, ImposterOverlayType overlayType) { if (Effect == null) { Effect = SharedEffects.Effects["ImposterFloat"] as ImposterFloatEffect; } m_Disposed = true; m_BackupState = new RenderTargetBackupState(); m_ImposterView = new View3D(new System.Drawing.Rectangle(0, 0, width, height), width, height, (float)Math.PI / 4, 1f); m_Format = format; m_Background = background; m_OverlayType = overlayType; }
protected override void OnInitialize() { base.OnInitialize(); this.BackgroundColor = new Color4(0, 0, 0, 0); GameConfiguration.ActiveRegion = new Rectangle(0, 0, WindowWidth, WindowHeight); m_View = new View3D(GameConfiguration.ActiveRegion, WindowWidth, WindowHeight, (float)Math.PI / 4, 1f); m_TestImage = new TestImage2(null); m_Imposter = new Imposter2(640, 480, SlimDX.DXGI.Format.R32_Float, new Color4(0, 0, 0, 0), RugTech1.Framework.Effects.ImposterOverlayType.None); m_Scene.m_TestImage = m_TestImage; }
public override void WriteDynamicElements(View3D view, SlimDX.DataStream LineVerts, ref int LineVertsCount, SlimDX.DataStream LinesIndices, ref int LinesIndicesCount, SlimDX.DataStream TriangleVerts, ref int TriangleVertsCount, SlimDX.DataStream TriangleIndices, ref int TriangleIndicesCount) { base.WriteDynamicElements(view, LineVerts, ref LineVertsCount, LinesIndices, ref LinesIndicesCount, TriangleVerts, ref TriangleVertsCount, TriangleIndices, ref TriangleIndicesCount); float x, y, w, h; if (IsNested == true) { UiStyleHelper.CovertToVertCoords(Parent.Bounds, view.WindowSize, view.PixelSize, out x, out y, out w, out h); } else { UiStyleHelper.CovertToVertCoords(Bounds, view.WindowSize, view.PixelSize, out x, out y, out w, out h); } int i = LineVertsCount; float xInc = w / Values.Length; float xOffset; //foreach (int index in m_PeakLocations) for (int j = 0; j < m_PeakCount; j++) { int index = m_PeakLocations[j]; if (index <= 0 || index >= Values.Length) { continue; } xOffset = x + (index * xInc); LineVerts.WriteRange(new UIVertex[] { new UIVertex() { Color = m_PeakLineColor, Position = new Vector3(xOffset, y, ZIndexForLines_Float), TextureCoords = new Vector2(0, 0) }, new UIVertex() { Color = m_PeakLineColor, Position = new Vector3(xOffset, y + h, ZIndexForLines_Float), TextureCoords = new Vector2(0, 0) } }); LinesIndices.WriteRange(new int[] { i + 0, i + 1, }); LineVertsCount += 2; LinesIndicesCount += 2; i += 2; } }
public void Render(View3D view) { /* switch (KinectImageMode) { case KinectImageMode.Color: m_KinectColorImage.Update(); m_KinectColorImage2.Update(); m_KinectColorImage.Render(view); m_KinectColorImage2.Render(view); break; case KinectImageMode.RawDepth: case KinectImageMode.DepthBackgroundImage: case KinectImageMode.DepthBackgroundRemoved: switch (KinectImageMode) { case KinectImageMode.RawDepth: m_KinectDepthImage.ImageType = KinectDepthImageType.RawDepth; m_KinectDepthImage2.ImageType = KinectDepthImageType.RawDepth; break; case KinectImageMode.DepthBackgroundImage: m_KinectDepthImage.ImageType = KinectDepthImageType.DepthBackgroundImage; m_KinectDepthImage2.ImageType = KinectDepthImageType.DepthBackgroundImage; break; case KinectImageMode.DepthBackgroundRemoved: m_KinectDepthImage.ImageType = KinectDepthImageType.DepthBackgroundRemoved; m_KinectDepthImage2.ImageType = KinectDepthImageType.DepthBackgroundRemoved; break; default: break; } m_KinectDepthImage.Update(); m_KinectDepthImage2.Update(); m_KinectDepthImage.Render(view); m_KinectDepthImage2.Render(view); break; default: break; } * */ }
public CompositeFieldImageEditor() { ControlStyle = DisplayMode.Normal; InteractionType = ControlInteractionType.None; m_View = new View3D(new System.Drawing.Rectangle(0, 0, 1, 1), 8, 8, (float)Math.PI / 4, 1f); int i = 0; foreach (DS.Simulation.CompositeFieldImage.KinectFieldImage image in ArtworkStaticObjects.CompositeFieldImage.Images) { KinectFieldImageTexture texture = new KinectFieldImageTexture(image, DefaultColors[i++], KinectFieldImageType.BlendMap); texture.FlipVertical = true; m_FieldImages.Add(texture); } m_Scene = new OverlayScene(); m_Scene.Initialize(); }
public void RenderToImposter(IScene scene, View3D view) { try { if (UseDepth == true) { Effect.BeginRender(m_ImposterTargetView, m_DepthView, m_DepthState, m_Background, m_ImposterView.Viewport, m_BackupState); } else { Effect.BeginRender(m_ImposterTargetView, m_Background, m_ImposterView.Viewport, m_BackupState); } scene.Render(m_ImposterView); } finally { Effect.EndRender(m_BackupState); } }
public KinectImageTunerPanel() { ControlStyle = DisplayMode.Normal; InteractionType = ControlInteractionType.None; m_View = new View3D(new System.Drawing.Rectangle(0, 0, 1, 1), 8, 8, (float)Math.PI / 4, 1f); foreach (KinectDevice device in ArtworkStaticObjects.KinectDevices.Devices) { KinectColorImageTexture color = new KinectColorImageTexture(device); color.FlipVertical = true; m_KinectColorImages.Add(color); KinectDepthImageTexture depth = new KinectDepthImageTexture(device, KinectDepthImageType.DepthBackgroundRemoved); depth.FlipVertical = true; m_KinectDepthImages.Add(depth); } }
public override void Render(View3D view, Viewport viewport) { m_View.Resize(new System.Drawing.Rectangle(0, 0, (int)viewport.Width, (int)viewport.Height), (int)viewport.Width, (int)viewport.Height); float x, y, w, h; foreach (KinectFieldImageTexture image in m_FieldImages) { image.ImageType = m_FieldImageMode; UiStyleHelper.CovertToVertCoords(new RectangleF(image.Source.X, image.Source.Y, image.Source.Stride, image.Source.Height), m_View.WindowSize, m_View.PixelSize, out x, out y, out w, out h); image.Rectangle = new RectangleF(x, y, w, h); image.Update(); image.Render(m_View); } m_Scene.Update(); m_Scene.Render(m_View); }
public override void OnMouseMoved(View3D view, SlimDX.Vector2 mousePosition, out bool shouldSubUpdate) { shouldSubUpdate = false; }
public override void OnMouseUp(View3D view, SlimDX.Vector2 mousePosition, System.Windows.Forms.MouseButtons mouseButtons, out bool shouldSubUpdate) { m_Scene.OnMouseUp(m_View, mousePosition - MouseOffset, mouseButtons, out shouldSubUpdate); if (shouldSubUpdate) { m_Scene.Invalidate(); } }
public override void OnMouseMoved(View3D view, SlimDX.Vector2 mousePosition, out bool shouldSubUpdate) { m_Scene.OnMouseMoved(m_View, mousePosition - MouseOffset, out shouldSubUpdate); if (shouldSubUpdate) { m_Scene.Invalidate(); } }
public void Render(View3D view) { }
//public Imposter Feedback; #region IScene Members public void Render(View3D view) { Grid.Render(CurrentFeedbackTexture); Composite.Render(view, ArtworkStaticObjects.Options.Visual.SelfFeedback, ArtworkStaticObjects.Options.Visual.SelfFeedbackColor); //Feedback.Render(); Particles.Render(view); }
public void Render(FormContext formContext, View3D view) { if (NeedsResize() == true) { UnloadResources(); LoadResources(); } m_Composite.Update(); float width = (float)ArtworkStaticObjects.CompositeFieldImage.Width; float height = (float)ArtworkStaticObjects.CompositeFieldImage.Height; float scaleX = (2f / width); float scaleY = (2f / height); float scale = (2f / width); float offsetY = (height * scale) / 2f; m_Particles.ParticleScaleX = 1f; m_Particles.ParticleScaleY = view.WindowSize.X / view.WindowSize.Y; // (width / height);// *(1 - scale); //; * m_HeightScale; if (ArtworkStaticObjects.CompositeFieldImage.Update()) { } m_WarpGrid.Update(ArtworkStaticObjects.CompositeFieldImage, ArtworkStaticObjects.CompositeFieldImage.Width, ArtworkStaticObjects.CompositeFieldImage.Height); //m_WarpGrid.Propogate(GameConfiguration.WindowWidth, GameConfiguration.WindowHeight); ArtworkStaticObjects.Ensemble.ResetParticleCollisions(); for (int j = 0; j < m_DrawFrequency; j++) { ArtworkStaticObjects.Ensemble.VelocityVerletPropagation(ArtworkStaticObjects.ExternalField); } #region Do FFT if (ArtworkStaticObjects.Options.FFT.FFTEnabled == true) { m_ParticleCorrelationFunctionTime++; m_FFTFrequencyTime++; if (m_ParticleCorrelationFunctionTime >= ArtworkStaticObjects.Options.FFT.CorrelationFunctionUpdateFrequency) { ArtworkStaticObjects.Ensemble.UpdateVelocityAutoCorrelationFunction(); m_ParticleCorrelationFunctionTime = 0; } if (m_FFTFrequencyTime >= ArtworkStaticObjects.Options.FFT.FFTFrequency) { ArtworkStaticObjects.Ensemble.FFTVelocityAutoCorrelationFunction(); m_FFTFrequencyTime = 0; ArtworkStaticObjects.FFTScanner.ShouldScan = true; } } #endregion m_RenderContext.RenderBegin(); //m_Composite.Rectangle = new RectangleF(-1, -offsetY, 2, height * scale); m_Composite.Rectangle = new RectangleF(-1, -1, 2, 2); //m_WarpGrid.Render(m_Composite.TextureView); OscOutput output = ArtworkStaticObjects.OscControler; bool shouldSendParticleEvents = ArtworkStaticObjects.Options.FFT.ParticleEventsEnabled; for (int i = 0, ie = ArtworkStaticObjects.Ensemble.NumberOfParticles; i < ie; i++) { DSParticles3.Particle part = ArtworkStaticObjects.Ensemble.Particles[i]; float partSpeed = 1f; if ((part.Velocity.X < 10f && part.Velocity.X > -10f) && (part.Velocity.Y < 10f && part.Velocity.Y > -10f)) { SlimDX.Vector2 length = new Vector2((float)part.Velocity.X, (float)part.Velocity.Y); float speedSquared = length.LengthSquared(); if (speedSquared == float.NegativeInfinity || speedSquared <= 0) { partSpeed = 0; } else if (speedSquared < 100f) { partSpeed = speedSquared * 0.01f; } } SlimDX.Vector4 color; if (part.DidParticleCollideWithParticle() == true) { color = part.ParticleType.ParticleCollisionColor; if (shouldSendParticleEvents == true && part.ParticleType.IsSoundOn == true) { output.SendPacket((float)part.Position.X, (float)part.Position.Y, (float)part.ParticleType.ID, (float)part.VInCollisionFrame); } } else if (part.DidParticleCollideWithWall() == true) { color = part.ParticleType.WallCollisionColor; if (shouldSendParticleEvents == true && part.ParticleType.IsSoundOn == true) { output.SendPacket((float)part.Position.X, (float)part.Position.Y, (float)part.ParticleType.ID, (float)part.VInCollisionFrame); } } else { color = part.ParticleType.RenderColor; } m_Points[i].Color = color; //m_Points[i].Position = new SlimDX.Vector3(-1 + ((float)part.Position.X * scale), -offsetY + ((height - (float)part.Position.Y) * scale), 1f); m_Points[i].Position = new SlimDX.Vector3(-1 + ((float)part.Position.X * scaleX), -1 + ((height - (float)part.Position.Y) * scaleY), partSpeed); } DataBox box = GameEnvironment.Device.ImmediateContext.MapSubresource(m_Particles.Instances, SlimDX.Direct3D11.MapMode.WriteDiscard, SlimDX.Direct3D11.MapFlags.None); DataStream stream = box.Data; stream.WriteRange<StarInstanceVertex>(m_Points, 0, ArtworkStaticObjects.Ensemble.NumberOfParticles); m_Particles.InstanceCount = ArtworkStaticObjects.Ensemble.NumberOfParticles; GameEnvironment.Device.ImmediateContext.UnmapSubresource(m_Particles.Instances, 0); m_Particles.Update(view); m_Particles.ColorScale = ArtworkStaticObjects.Options.Visual.ParticleFeedbackLevel; m_Particles.ScaleDistance = 0f; m_WarpGrid.WarpVariance = ArtworkStaticObjects.Options.Visual.WarpVariance; m_WarpGrid.WarpPropagation = ArtworkStaticObjects.Options.Visual.WarpPropagation; m_WarpGrid.WarpPersistence = ArtworkStaticObjects.Options.Visual.WarpPersistence; m_WarpGrid.FeedbackLevel = ArtworkStaticObjects.Options.Visual.FeedbackLevel; m_FeedbackScene.CurrentFeedbackTexture = m_FeedbackImposters[m_ActiveImposter].TextureView; m_ActiveImposter++; if (m_ActiveImposter > 1) { m_ActiveImposter = 0; } m_FeedbackImposters[m_ActiveImposter].RenderToImposter(m_FeedbackScene, view); m_FeedbackImposters[m_ActiveImposter].Render(); m_Composite.Render(view, ArtworkStaticObjects.Options.Visual.SelfImage, ArtworkStaticObjects.Options.Visual.SelfColor); m_Particles.ScaleDistance = 1f; m_Particles.ColorScale = 1f - ArtworkStaticObjects.Options.Visual.ParticleFeedbackLevel; m_Particles.Render(view); m_RenderContext.RenderEnd(); m_TargetBox.TextureView = m_RenderContext.TextureView; formContext.RenderBegin(); //m_TargetBox.Rectangle = new RectangleF(-1, -offsetY * m_HeightScale, 2, height * scale * m_HeightScale); m_TargetBox.Rectangle = new RectangleF(-1, -1, 2, 2); //m_TargetBox.FlipHorizontal = true; m_TargetBox.Render(); }
public void Render(View3D view) { m_Image.Render(); m_Parts.Render(view); }
public override void Render(View3D view) { if (Disposed == true) { return; } m_Image.Render(); }
public override void OnMouseUp(View3D view, SlimDX.Vector2 mousePosition, System.Windows.Forms.MouseButtons mouseButtons, out bool shouldSubUpdate) { shouldSubUpdate = false; }
public void RenderImposter(IScene scene, View3D view) { m_Effect.RenderImposter(ImposterResourceView); }