Example #1
0
        public CircleEffect(GameContext context) : base(context)
        {
            _context = context;
            effect   = CGHelper.CreateEffectFx5("Resources\\Shader\\circleShader.fx",
                                                context.RenderContext.DeviceManager.Device);
            beffect = CGHelper.CreateEffectFx5("Resources\\Shader\\convergenceBeam.fx",
                                               context.RenderContext.DeviceManager.Device);
            noiseView = context.LoadTexture("Resources\\Effect\\noise.png");
            beamView  = context.LoadTexture("Resources\\Effect\\lazer.png");
            ShaderResourceView view = context.LoadTexture("Resources\\Effect\\circle.png");

            frontCircle = new DividedPlaneBoard(context.RenderContext, view, 100,
                                                new Vector2(100, 100),
                                                new PlaneBoard.PlaneBoardDescription(BlendStateManager.BlendStates.Add, effect, false, RenderFront));
            frontCircle.Initialize();
            for (int i = 0; i < 3; i++)
            {
                subCircle[i] = new PlaneBoard(context.RenderContext, view, new Vector2(30, 30),
                                              new PlaneBoard.PlaneBoardDescription(BlendStateManager.BlendStates.Add, effect, false, RenderFront));
                subCircle[i].Initialize();
            }
            for (int i = 0; i < 5; i++)
            {
                beamEffects[i] = new DividedPlaneBoard(context.RenderContext, view, 100,
                                                       new Vector2(100, 100),
                                                       new PlaneBoard.PlaneBoardDescription(BlendStateManager.BlendStates.Add, beffect, false, Renderbeam));
                beamEffects[i].Initialize();
            }
        }
Example #2
0
 public CircleEffect(GameContext context)
     : base(context)
 {
     _context = context;
     effect = CGHelper.CreateEffectFx5("Resources\\Shader\\circleShader.fx",
         context.RenderContext.DeviceManager.Device);
     beffect = CGHelper.CreateEffectFx5("Resources\\Shader\\convergenceBeam.fx",
         context.RenderContext.DeviceManager.Device);
     noiseView = context.LoadTexture("Resources\\Effect\\noise.png");
     beamView = context.LoadTexture("Resources\\Effect\\lazer.png");
     ShaderResourceView view = context.LoadTexture("Resources\\Effect\\circle.png");
     frontCircle = new DividedPlaneBoard(context.RenderContext, view,100,
         new Vector2(100, 100),
         new PlaneBoard.PlaneBoardDescription(BlendStateManager.BlendStates.Add, effect, false, RenderFront));
     frontCircle.Initialize();
     for (int i = 0; i < 3; i++)
     {
         subCircle[i] = new PlaneBoard(context.RenderContext, view, new Vector2(30, 30),
             new PlaneBoard.PlaneBoardDescription(BlendStateManager.BlendStates.Add, effect, false, RenderFront));
         subCircle[i].Initialize();
     }
     for (int i = 0; i < 5; i++)
     {
         beamEffects[i]=new DividedPlaneBoard(context.RenderContext, view, 100,
         new Vector2(100, 100),
         new PlaneBoard.PlaneBoardDescription(BlendStateManager.BlendStates.Add, beffect, false, Renderbeam));
         beamEffects[i].Initialize();
     }
 }
Example #3
0
 public BulletEffect(GameContext context) : base(context)
 {
     game          = context;
     effect        = CGHelper.CreateEffectFx5("Resources\\Shader\\bulletShader.fx", context.RenderContext.DeviceManager.Device);
     bulletTexture = context.LoadTexture("Resources\\Effect\\thunder.png");
     board         = new DividedPlaneBoard(context.RenderContext, bulletTexture, 100, new Vector2(10, 10), new PlaneBoard.PlaneBoardDescription(BlendStateManager.BlendStates.Add, effect, false, SubscribeLazerEffectVariable));
     board.Initialize();
 }
Example #4
0
 public BulletEffect(GameContext context)
     : base(context)
 {
     game = context;
     effect=CGHelper.CreateEffectFx5("Resources\\Shader\\bulletShader.fx",context.RenderContext.DeviceManager.Device);
     bulletTexture = context.LoadTexture("Resources\\Effect\\thunder.png");
     board=new DividedPlaneBoard(context.RenderContext,bulletTexture,100,new Vector2(10,10),new PlaneBoard.PlaneBoardDescription(BlendStateManager.BlendStates.Add, effect,false,SubscribeLazerEffectVariable));
     board.Initialize();
 }
Example #5
0
 private void SubscribeLazerEffectVariable(PlaneBoard planeBoard, Effect effect, ShaderResourceView arg3)
 {
     planeBoard.DefaultEffectSubscribe();
     int uvOffset = (int) (lastTime/100f)%8;
     effect.GetVariableBySemantic("TIME").AsScalar().Set(lastTime/100f);
     effect.GetVariableBySemantic("DIRECTION").AsVector().Set(Vector3.UnitZ);
     effect.GetVariableBySemantic("LENGTH").AsScalar().Set(200);//長さ
     effect.GetVariableBySemantic("UP").AsVector().Set(Vector3.UnitY);
     effect.GetVariableBySemantic("EYE")
         .AsVector()
         .Set(game.RenderContext.CurrentTargetContext.MatrixManager.ViewMatrixManager.CameraPosition);
     effect.GetVariableBySemantic("UVOFFSET").AsScalar().Set(uvOffset);
     effect.GetVariableBySemantic("LAZERHEIGHT").AsScalar().Set(40*(1-(float)Math.Exp(-lastTime/500d)));//レーザーの幅
 }
Example #6
0
        private void SubscribeLazerEffectVariable(PlaneBoard planeBoard, Effect effect, ShaderResourceView arg3)
        {
            planeBoard.DefaultEffectSubscribe();
            int uvOffset = (int)(lastTime / 100f) % 8;

            effect.GetVariableBySemantic("TIME").AsScalar().Set(lastTime / 100f);
            effect.GetVariableBySemantic("DIRECTION").AsVector().Set(Vector3.UnitZ);
            effect.GetVariableBySemantic("LENGTH").AsScalar().Set(200);//長さ
            effect.GetVariableBySemantic("UP").AsVector().Set(Vector3.UnitY);
            effect.GetVariableBySemantic("EYE")
            .AsVector()
            .Set(game.RenderContext.CurrentTargetContext.MatrixManager.ViewMatrixManager.CameraPosition);
            effect.GetVariableBySemantic("UVOFFSET").AsScalar().Set(uvOffset);
            effect.GetVariableBySemantic("LAZERHEIGHT").AsScalar().Set(40 * (1 - (float)Math.Exp(-lastTime / 500d)));//レーザーの幅
        }
Example #7
0
 /// <summary>
 /// Renderbeams the specified arg1.
 /// </summary>
 /// <param name="arg1">The arg1.</param>
 /// <param name="arg2">The arg2.</param>
 /// <param name="arg3">The arg3.</param>
 private void Renderbeam(PlaneBoard arg1, SlimDX.Direct3D11.Effect arg2, ShaderResourceView arg3)
 {
     arg1.DefaultEffectSubscribe();
     beffect.GetVariableBySemantic("NOISETEX").AsResource().SetResource(beamView);
     beffect.GetVariableBySemantic("TIME").AsScalar().Set(lastTime - 1f);
     beffect.GetVariableBySemantic("STARTPOS").AsVector().Set(_startPosition);
     beffect.GetVariableBySemantic("TARGETPOS").AsVector().Set(-new Vector3(0, 0, 300));
     beffect.GetVariableBySemantic("UP").AsVector().Set(Vector3.TransformNormal(Vector3.UnitY * 100, Matrix.RotationZ((float)(2 * Math.PI / beamEffects.Length * currentBeamIndex))));
     beffect.GetVariableBySemantic("EYE").AsVector().Set(_context.RenderContext.CurrentTargetContext.MatrixManager.ViewMatrixManager.CameraPosition);
     beffect.GetVariableBySemantic("UVOFFSET").AsScalar().Set((float)(0.2 * currentBeamIndex));
     beffect.GetVariableBySemantic("BH").AsScalar().Set(5);
     currentBeamIndex++;
     if (currentBeamIndex == 5)
     {
         currentBeamIndex = 0;
     }
 }
Example #8
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            textureTargetContext = new WPFTargetTextureContext(RenderContext, new Size(800, 800), new SampleDescription(1, 0));
            RenderContext.UpdateRequireWorlds.Add(textureTargetContext.WorldSpace);

            var resourceView = new ShaderResourceView(RenderContext.DeviceManager.Device, textureTargetContext.RenderTarget);

            board = new PlaneBoard(RenderContext, resourceView);
            WorldSpace.AddResource(board);

            BasicGrid grid = new BasicGrid();

            grid.Load(RenderContext);
            textureTargetContext.WorldSpace.AddResource(grid);

            mainWindow = new MainWindow();
            mainWindow.Show();
        }
Example #9
0
 private void RenderFront(PlaneBoard arg1, SlimDX.Direct3D11.Effect arg2, ShaderResourceView arg3)
 {
     arg1.DefaultEffectSubscribe();
     effect.GetVariableBySemantic("NOISETEX").AsResource().SetResource(noiseView);
     effect.GetVariableBySemantic("TIME").AsScalar().Set(lastTime);
 }
Example #10
0
 /// <summary>
 /// Renderbeams the specified arg1.
 /// </summary>
 /// <param name="arg1">The arg1.</param>
 /// <param name="arg2">The arg2.</param>
 /// <param name="arg3">The arg3.</param>
 private void Renderbeam(PlaneBoard arg1, SlimDX.Direct3D11.Effect arg2, ShaderResourceView arg3)
 {
     arg1.DefaultEffectSubscribe();
     beffect.GetVariableBySemantic("NOISETEX").AsResource().SetResource(beamView);
     beffect.GetVariableBySemantic("TIME").AsScalar().Set(lastTime-1f);
     beffect.GetVariableBySemantic("STARTPOS").AsVector().Set(_startPosition);
     beffect.GetVariableBySemantic("TARGETPOS").AsVector().Set(-new Vector3(0,0,300));
     beffect.GetVariableBySemantic("UP").AsVector().Set(Vector3.TransformNormal(Vector3.UnitY*100,Matrix.RotationZ((float) (2*Math.PI/beamEffects.Length*currentBeamIndex))));
     beffect.GetVariableBySemantic("EYE").AsVector().Set(_context.RenderContext.CurrentTargetContext.MatrixManager.ViewMatrixManager.CameraPosition);
     beffect.GetVariableBySemantic("UVOFFSET").AsScalar().Set((float) (0.2*currentBeamIndex));
     beffect.GetVariableBySemantic("BH").AsScalar().Set(5);
     currentBeamIndex++;
     if (currentBeamIndex == 5) currentBeamIndex = 0;
 }
 public DividedPlaneBoard(RenderContext context, ShaderResourceView resView,int divCount, Vector2 size, PlaneBoard.PlaneBoardDescription desc = null)
     : base(context, resView, size, desc)
 {
     _divCount = divCount;
 }
Example #12
0
 private void RenderFront(PlaneBoard arg1, SlimDX.Direct3D11.Effect arg2, ShaderResourceView arg3)
 {
     arg1.DefaultEffectSubscribe();
     effect.GetVariableBySemantic("NOISETEX").AsResource().SetResource(noiseView);
     effect.GetVariableBySemantic("TIME").AsScalar().Set(lastTime);
 }
Example #13
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            WorldSpace.AddDrawableGroup(new ControllerDrawableGroup(1, "Controller", RenderContext));
            KeyPreview = true;
            KinectDeviceManager dev = null;

            //BasicGrid grid=new BasicGrid();
            //grid.Load(RenderContext);
            Controller = new TransformController(RenderContext, ScreenContext.HitChekcer);
            WorldSpace.AddResource(Controller, "Controller");
            //if (!String.IsNullOrEmpty(Settings.Default.InitLoadModel))
            //{
            //    MMDModel model = MMDModelWithPhysics.OpenLoad(Settings.Default.InitLoadModel, RenderContext);
            //    WorldSpace.AddResource(model);
            //    if (!String.IsNullOrEmpty(Settings.Default.InitLoadMotion))
            //    {
            //        model.MotionManager.ApplyMotion(model.MotionManager.AddMotionFromFile(Settings.Default.InitLoadMotion, false));
            //    }
            //}
            //更新する必要のあるワールドスペースは、UpdateRequireWorldsに追加しなけれbなりません。
            //PlaneBoard bill = new PlaneBoard(RenderContext, resourceView, new Vector2(800, 800));
            //WorldSpace.AddResource(bill);
            //bill.Transformer.Position = new Vector3(0, 0, 20);
            #region Kinectテストコード

#if KINECT
            OpenNIManager.Initialize();
            dev = OpenNIManager.getDevice();

            ColTexture = new ColorTexture(RenderContext, dev);
            tex2       = new DepthTexture(RenderContext, 1000, dev);
#endif

            #endregion

            //format = SpriteBatch.CreateTextformat("Meiriyo", 30, FontWeight.ExtraBold);


            //brush = SpriteBatch.CreateRadialGradientBrush(g,
            //    new RadialGradientBrushProperties() {CenterPoint = new PointF(100,100),GradientOriginOffset = new PointF(0,0),HorizontalRadius = 100f,VerticalRadius = 200f}).Brush;
            //brush = SpriteBatch.CreateSolidColorBrush(Color.Aquamarine);
            ScreenContext.CameraMotionProvider = new BasicCameraControllerMotionProvider(this, this);
            BasicGrid gird = new BasicGrid();
            gird.Visibility = true;
            gird.Load(RenderContext);

            ScreenContext.WorldSpace.AddResource(gird);
            //textureの世界には、childウィンドウに追加からできるようにしてあります。
            ControlForm controlForm = new ControlForm(RenderContext, ScreenContext, null, dev);
            controlForm.Show(this);

            //OpenFileDialog ofd = new OpenFileDialog();
            //if (ofd.ShowDialog() == DialogResult.OK)
            //{
            //    VMDCameraMotionProvider camMotion=VMDCameraMotionProvider.OpenFile(ofd.FileName);
            //    ScreenContext.CameraMotionProvider = camMotion;
            //    camMotion.Start();
            //}


            #region Kinectテストコード
#if KINECT
            PlaneBoard bill = new PlaneBoard(RenderContext, ColTexture.TextureResourceView);
            bill.Transformer.Position = new Vector3(0, 0, 50);
            //bill.Transformer.Rotation *= Quaternion.RotationAxis(new Vector3(0,1,0),(float) (Math.PI));
            form.WorldSpace.AddResource(bill);
            form.WorldSpace.AddDynamicTexture(ColTexture);
#endif

            #endregion
        }