protected override void SceneInitialization(IContextState context, RenderEngine engine, ElementTag camera) { var smanager = Context.GetSystemManager(); smanager.CreateSystem <DefaultInputSystem>(); smanager.CreateSystem <ZoomToAllObjectsSystem>(); smanager.CreateSystem <MovingSystem>(); smanager.CreateSystem <CollidingSystem>(); smanager.CreateSystem <DefaultOrthographicCameraSystem>(); smanager.CreateSystem <LightsSystem>(); // smanager.CreateSystem<MovementSystem>(); // smanager.CreateSystem<EmptyAnimationSystem>(); // smanager.CreateSystem<MeshAnimationSystem>(); // smanager.CreateSystem<StickOnHeightMapSystem>(); // smanager.CreateSystem<ObjectMovementSystem>(); // smanager.CreateSystem<Systems.TerrainGeneratorSystem>(); // smanager.CreateSystem<Physics.Engine.PhysicalSystem>(); smanager .CreateSystem <RenderSystem>() .Init(engine.Graphics) // .CreateNested<SkyGradientColoringRenderTechnique>() // .CreateNested<SkyPlaneWithParallaxRenderTechnique>() // .CreateNested<TerrainRenderTechnique>()// //.CreateNested<Toolkit.D3D.CameraViews.CameraViewsRenderTechnique<CustomRenderProperties>>() //.CreateNested<OITTriangleColoredVertexRenderTechnique<ToolkitRenderProperties>>() .CreateNested <TriangleColoredVertexRenderTechnique <ToolkitRenderProperties> >() .CreateNested <TriangleTexturedVertexRenderTechnique <ToolkitRenderProperties> >() .CreateNested <LineVertexRenderTechnique <ToolkitRenderProperties> >() //.CreateNested<CudaTestTechniques<ToolkitRenderProperties>>() .CreateNested <SpherePointRenderTechnique <ToolkitRenderProperties> >() //.CreateNested<AminRenderTechniqueSystem>() ; //smanager // .CreateSystem<AminRenderSystem>() // .Init(device);Context var manager = Context.GetEntityManager(); cameraObject = CameraObject.UpdateOrthographic <RenderSystem>(camera, Context, Surface); LightObject.CreateAmbientLight(manager, 0.2f); //0.05f LightObject.CreateFollowCameraDirectLight(manager, System.Numerics.Vector3.UnitZ, 0.8f); //0.95f CoordinateSystem = CoordinateSystemLinesGameObject.Create(context, false); Loaded?.Invoke(); //VisualSphereObject.SphereGeo(Context, ElementTag.New($"Point"), new VisualSphereObject.Data { // Center = new Vector3(10, 20, 10), // Color = V4Colors.Yellow, // Radius = 10 //}); }
protected override void SceneInitialization(IContextState context, RenderEngine engine, ElementTag camera) { var smanager = Context.GetSystemManager(); smanager.CreateSystem <DefaultInputSystem>(); smanager.CreateSystem <DefaultOrthographicCameraSystem>(); smanager.CreateSystem <LightsSystem>(); // smanager.CreateSystem<CollidingSystem>(); // smanager.CreateSystem<MovementSystem>(); // smanager.CreateSystem<EmptyAnimationSystem>(); // smanager.CreateSystem<MeshAnimationSystem>(); // smanager.CreateSystem<StickOnHeightMapSystem>(); // smanager.CreateSystem<ObjectMovementSystem>(); // smanager.CreateSystem<Systems.TerrainGeneratorSystem>(); // smanager.CreateSystem<Physics.Engine.PhysicalSystem>(); smanager .CreateSystem <RenderSystem>() .Init(engine.Graphics) // .CreateNested<SkyGradientColoringRenderTechnique>() // .CreateNested<SkyPlaneWithParallaxRenderTechnique>() // .CreateNested<TerrainRenderTechnique>()// //.CreateNested<Toolkit.D3D.CameraViews.CameraViewsRenderTechnique<CustomRenderProperties>>() //.CreateNested<OITTriangleColoredVertexRenderTechnique<ToolkitRenderProperties>>() .CreateNested <TriangleColoredVertexRenderTechnique <ToolkitRenderProperties> >() //.CreateNested<TriangleTexturedVertexRenderTechnique<CustomRenderProperties>>() .CreateNested <LineVertexRenderTechnique <ToolkitRenderProperties> >() //.CreateNested<LineVertexRenderTechnique>() //.CreateNested<SpherePointRenderStrategy>() //.CreateNested<AminRenderTechniqueSystem>() ; //smanager // .CreateSystem<AminRenderSystem>() // .Init(device);Context var manager = Context.GetEntityManager(); cameraObject = CameraObject.UpdateOrthographic <RenderSystem>(camera, Context, Surface); LightObject.CreateAmbientLight(manager, 0.2f); //0.05f LightObject.CreateFollowCameraDirectLight(manager, System.Numerics.Vector3.UnitZ, 0.8f); //0.95f }
protected override void SceneInitialization(IContextState context, RenderEngine engine, ElementTag camera) { var smanager = Context.GetSystemManager(); smanager.CreateSystem <DefaultInputSystem>(); smanager.CreateSystem <ZoomToAllObjectsSystem>(); smanager.CreateSystem <MovingSystem>(); smanager.CreateSystem <CollidingSystem>(); smanager.CreateSystem <DefaultOrthographicCameraSystem>(); smanager.CreateSystem <LightsSystem>(); smanager .CreateSystem <RenderSystem>() .Init(engine.Graphics) .CreateNested <StensilTest_TriangleColoredVertexRenderTechnique <ToolkitRenderProperties> >() .CreateNested <LineVertexRenderTechnique <ToolkitRenderProperties> >() ; var manager = Context.GetEntityManager(); cameraObject = CameraObject.UpdateOrthographic <RenderSystem>(camera, Context, Surface); LightObject.CreateAmbientLight(manager, 0.2f); //0.05f LightObject.CreateFollowCameraDirectLight(manager, System.Numerics.Vector3.UnitZ, 0.8f); //0.95f InvokeLoaded(); { var pos0 = new[] { new Vector3(0, 40, 0), new Vector3(-30, -20, 0), new Vector3(30, -20, 0), }; var en0 = EntityBuilders.BuildColored(context, pos0, new int[] { 0, 1, 2 }, new[] { Vector3.UnitZ, Vector3.UnitZ, Vector3.UnitZ }, V4Colors.Red, SharpDX.Direct3D11.CullMode.Front); var dd = D3DDepthStencilDefinition.Default(0).Description; //dd.DepthComparison = Comparison.LessEqual; var _default = new D3DDepthStencilDefinition(dd, 0); en0.UpdateComponent(RenderableComponent.AsTriangleColoredList(SharpDX.Direct3D11.CullMode.None, _default)); } { var pos = new[] { new Vector3(0, 20, 0), new Vector3(-20, 0, 0), new Vector3(20, 0, 0), }; var en1 = EntityBuilders.BuildColored(context, pos, new int[] { 0, 1, 2 }, new[] { Vector3.UnitZ, Vector3.UnitZ, Vector3.UnitZ }, V4Colors.Blue, SharpDX.Direct3D11.CullMode.Front); var dd = new DepthStencilStateDescription() { IsDepthEnabled = true, IsStencilEnabled = true, DepthWriteMask = DepthWriteMask.All, DepthComparison = Comparison.LessEqual, StencilWriteMask = 0xFF, StencilReadMask = 0xFF, BackFace = new DepthStencilOperationDescription() { PassOperation = StencilOperation.Keep, Comparison = Comparison.Never, DepthFailOperation = StencilOperation.Keep, FailOperation = StencilOperation.Replace }, FrontFace = new DepthStencilOperationDescription() { PassOperation = StencilOperation.Increment, Comparison = Comparison.Never, DepthFailOperation = StencilOperation.Keep, FailOperation = StencilOperation.Replace } }; var stensilNever = new D3DDepthStencilDefinition(dd, 2); en1.UpdateComponent(RenderableComponent.AsTriangleColoredList(SharpDX.Direct3D11.CullMode.None, stensilNever)); } { var pos2 = new[] { new Vector3(20, 10, 0), new Vector3(-20, 10, 0), new Vector3(0, -10, 0), }; var en2 = EntityBuilders.BuildColored(context, pos2, new int[] { 0, 1, 2 }, new[] { Vector3.UnitZ, Vector3.UnitZ, Vector3.UnitZ }, V4Colors.Green, SharpDX.Direct3D11.CullMode.Front); var ddd = new DepthStencilStateDescription() { IsDepthEnabled = true, IsStencilEnabled = true, DepthWriteMask = DepthWriteMask.All, DepthComparison = Comparison.LessEqual, StencilWriteMask = 0xFF, StencilReadMask = 0xFF, BackFace = new DepthStencilOperationDescription() { PassOperation = StencilOperation.Replace, Comparison = Comparison.Greater, DepthFailOperation = StencilOperation.Keep, FailOperation = StencilOperation.Replace }, FrontFace = new DepthStencilOperationDescription() { PassOperation = StencilOperation.Increment, Comparison = Comparison.Greater, DepthFailOperation = StencilOperation.Keep, FailOperation = StencilOperation.Replace } }; var stensilGrater = new D3DDepthStencilDefinition(ddd, 1); en2.UpdateComponent(RenderableComponent.AsTriangleColoredList(SharpDX.Direct3D11.CullMode.None, stensilGrater)); } }