public MeshSpatialObject(GraphicsState graphics, SpatialState spatial, AssetFactoryState assets, Mesh mesh, bool culling) { Graphics = graphics; Spatial = spatial; Mesh = mesh; // TextureLayer = textureLayer; VertexBuffer = new ArrayBuffer <Vertex>(graphics, BufferUsage.StructuredBufferReadOnly, mesh.Vertices, ShaderStages.Compute); WorldVertexBuffer = new ArrayBuffer <Vertex>(graphics, BufferUsage.StructuredBufferReadWrite, mesh.Vertices.Length, ShaderStages.Compute | ShaderStages.Vertex); ScreenCoordsBuffer = new ArrayBuffer <Vector3D>(graphics, BufferUsage.StructuredBufferReadWrite, mesh.Vertices.Length, ShaderStages.Compute | ShaderStages.Vertex); ParameterBuffer = new StructBuffer <Parameters>(graphics, BufferUsage.UniformBuffer, ShaderStages.Compute); // Texture = texture; FaceBuffer = new ResourcelessArrayBuffer <Face>(graphics, BufferUsage.VertexBuffer, mesh.Faces); TransformPipeline = new ComputePipeline(graphics, assets.Get <ShaderSet>("Shaders.MeshSpatialObject.Transform"), VertexBuffer, WorldVertexBuffer, ScreenCoordsBuffer, ParameterBuffer); ColorPipeline = new GraphicsPipeline(graphics, Blend.Override, DepthTest.On, culling, assets.Get <ShaderSet>("Shaders.MeshSpatialObject.Color"), graphics.IntermediateOutputDescription, WorldVertexBuffer, ScreenCoordsBuffer); Commands = new Commands(graphics); }
public ViewThread(WindowState window, GraphicsState graphics, SpatialState spatial, AssetFactoryState assets) { Window = window; Graphics = graphics; Spatial = spatial; Assets = assets; }
public SpatialViewLayer(GraphicsState graphics, SpatialState spatial, AssetFactoryState assets) { Graphics = graphics; Spatial = spatial; Assets = assets; spatial.Objects.Add(new MeshSpatialObject(graphics, spatial, assets, assets.Get <SpatialModel>("Characters.Raccoon").Meshes["Body"], true)); }
protected override void Update(TimeSpan gameTime) { var gesture = this.spatialInputManager.SpatialState; if (gesture.IsSelected && !lastState.IsSelected) { this.PlaceEntity(); } this.hololensService.SetStabilizationPlane(transform.Position); lastState = gesture; }
protected override void Update(TimeSpan gameTime) { var gesture = _spatialInputManager.SpatialState; if (gesture.IsSelected && !_lastState.IsSelected) { this.ShowInfo(); } _hololensService.SetStabilizationPlane(_transform.Position); _lastState = gesture; }
public DebugViewLayer(GraphicsState graphics, SpatialState spatial, AssetFactoryState assets) { Graphics = graphics; Spatial = spatial; Assets = assets; TextViewLayer = new LightTextViewLayer(graphics, assets, 8, 0, 1024, 1024, assets.Get <LightFont>("Fonts.Light.FiraSansItalic"), new[] { new Feature("kern"), new Feature("liga"), new Feature("clig"), new Feature("onum"), new Feature("tnum") }, 24, 24, new RgbaFloat(0, 0, 0, 0.6f), ""); }
public LogicThread(WindowState window, SpatialState spatial) { Window = window; Spatial = spatial; }
/// <summary> /// Update method /// </summary> /// <param name="gameTime">game time</param> protected override void Update(TimeSpan gameTime) { if (this.spatialInputService != null && this.spatialInputService.IsConnected) { SpatialState currentSpatialState = this.spatialInputService.SpatialState; this.UndetectedEntity.IsVisible = false; this.ReadyEntity.IsVisible = false; this.AirTapEntity.IsVisible = false; if (currentSpatialState.IsDetected) { if (currentSpatialState.IsSelected) { // Airtap state if (this.AirTapEntity != null) { this.AirTapEntity.IsVisible = true; } if (this.CurrentState != States.AirTap) { this.CurrentState = States.AirTap; this.AirTapEvent?.Invoke(this, null); } } else { // Ready state if (this.ReadyEntity != null) { this.ReadyEntity.IsVisible = true; } if (this.CurrentState != States.Ready) { this.CurrentState = States.Ready; this.ReadyEvent?.Invoke(this, null); } } } else { // Undetected state if (this.UndetectedEntity != null) { this.UndetectedEntity.IsVisible = true; } if (this.CurrentState != States.Undetected) { this.CurrentState = States.Undetected; this.UndetectedEvent?.Invoke(this, null); } } } // Create ray var cameraTransform = this.RenderManager.ActiveCamera3D.Transform; this.ray.Position = cameraTransform.Position; this.ray.Direction = cameraTransform.WorldTransform.Forward; // Calculate cursor position this.cursorPosition = this.ray.Position + (this.ray.Direction * this.DefaultDistance); this.cursorTarget = cameraTransform.Position; // Calculate collisions if (this.collisioner != null) { var data = this.collisioner.CheckCursorCollision(ref this.ray, this.MaxGazeDistance); if (data.Hit) { this.cursorPosition = data.Position; if (this.collisioner.NormalAligned) { this.cursorTarget = data.Target; } } } // Stabilizer if (this.stabilizer != null) { this.cursorPosition = this.stabilizer.UpdateSmoothCursorPosition(this.cursorPosition); } // Update cursor this.cursorTransform.Position = this.cursorPosition; this.cursorTransform.LookAt(this.cursorTarget, Vector3.Up); // Keep scale if (this.keepScale) { Vector3 direction = this.cursorPosition - cameraTransform.Position; this.cursorTransform.Scale = Vector3.One * (direction.Length() / this.DefaultDistance); } // Indicator if (this.indicator != null) { this.indicator.UpdateIndicator(this.cursorPosition, this.cursorTransform.Scale); } }