コード例 #1
0
ファイル: Form1.cs プロジェクト: thakgit/StiLib
        protected override void Initialize()
        {
            SLText = new Text(GraphicsDevice, Services, SLConfig["content"], "Arial");
            Timer  = new SLTimer();
            Timer.Start();
            Input = new SLInput();

            BarPara bpara = BarPara.Default;

            bpara.width  = 3.5f;
            bpara.height = 0.7f;
            bpara.BasePara.orientation = 90.0f;
            Bar = new Bar(GraphicsDevice, bpara);

            GratingPara gpara = GratingPara.Default;

            gpara.BasePara.diameter = 2.0f;
            gpara.sf     = 0.8f;
            gpara.tf     = 3.0f;
            Grating      = new Grating(GraphicsDevice, Services, SLConfig["content"], gpara);
            GratingType  = Grating.Para.gratingtype;
            GratingShape = Grating.Para.shape;
            GratingMask  = Grating.Para.maskpara.masktype;

            Cross = new Primitive(GraphicsDevice, PrimitivePara.Cross(1.0f, Color.Black, Vector3.Zero));

            Bgcolor    = Color.DimGray;
            CurrentSti = VSType.Bar;
            HelpText   = 0;
        }
コード例 #2
0
ファイル: Grating.cs プロジェクト: thakgit/StiLib
        /// <summary>
        /// Sets Grating Type
        /// </summary>
        /// <param name="gratingtype"></param>
        public void SetGratingType(GratingType gratingtype)
        {
            Para.gratingtype = gratingtype;
            int temp = 0;

            switch (gratingtype)
            {
            case GratingType.Square:
                temp = 1; break;

            case GratingType.Linear:
                temp = 2; break;

            default:     // Sinusoidal
                temp = 0; break;
            }
            gratingeffect.Parameters["VSIndex"].SetValue(temp);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: thakgit/StiLib
 void Grating_Type()
 {
     if (Input.IsKeyPressed(Keys.Space))
     {
         GratingType += 1;
         if ((int)GratingType > 2)
         {
             GratingType = 0;
         }
         Grating.SetGratingType(GratingType);
     }
     if (Input.IsKeyPressed(Keys.E))
     {
         if (GratingShape == Shape.Quadrate)
         {
             GratingShape = Shape.Circle;
         }
         else
         {
             GratingShape = Shape.Quadrate;
         }
         Grating.SetShape(GratingShape);
     }
     if (Input.IsKeyPressed(Keys.M))
     {
         GratingMask += 1;
         if ((int)GratingMask > 1)
         {
             GratingMask = 0;
         }
         Grating.SetMask(GratingMask);
     }
     if (Input.IsKeyDown(Keys.T))
     {
         Grating.SetGaussianSigma(Grating.Para.maskpara.BasePara.diameter * 1.01f);
     }
     if (Input.IsKeyDown(Keys.Y))
     {
         Grating.SetGaussianSigma(Grating.Para.maskpara.BasePara.diameter * 0.99f);
     }
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: babaq/StiLib
        protected override void Initialize()
        {
            SLText = new Text(GraphicsDevice, Services, SLConfig["content"], "Arial");
            Timer = new SLTimer();
            Timer.Start();
            Input = new SLInput();

            BarPara bpara = BarPara.Default;
            bpara.width = 3.5f;
            bpara.height = 0.7f;
            bpara.BasePara.orientation = 90.0f;
            Bar = new Bar(GraphicsDevice, bpara);

            GratingPara gpara = GratingPara.Default;
            gpara.BasePara.diameter = 2.0f;
            gpara.sf = 0.8f;
            gpara.tf = 3.0f;
            Grating = new Grating(GraphicsDevice, Services, SLConfig["content"], gpara);
            GratingType = Grating.Para.gratingtype;
            GratingShape = Grating.Para.shape;
            GratingMask = Grating.Para.maskpara.masktype;

            Cross = new Primitive(GraphicsDevice, PrimitivePara.Cross(1.0f, Color.Black, Vector3.Zero));

            Bgcolor = Color.DimGray;
            CurrentSti = VSType.Bar;
            HelpText = 0;
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: babaq/StiLib
 void Grating_Type()
 {
     if (Input.IsKeyPressed(Keys.Space))
     {
         GratingType += 1;
         if ((int)GratingType > 2) GratingType = 0;
         Grating.SetGratingType(GratingType);
     }
     if (Input.IsKeyPressed(Keys.E))
     {
         if (GratingShape == Shape.Quadrate )
         {
             GratingShape = Shape.Circle;
         }
         else
         {
             GratingShape = Shape.Quadrate;
         }
         Grating.SetShape(GratingShape);
     }
     if (Input.IsKeyPressed(Keys.M))
     {
         GratingMask += 1;
         if ((int)GratingMask > 1) GratingMask = 0;
         Grating.SetMask(GratingMask);
     }
     if (Input.IsKeyDown(Keys.T))
     {
         Grating.SetGaussianSigma(Grating.Para.maskpara.BasePara.diameter * 1.01f);
     }
     if (Input.IsKeyDown(Keys.Y))
     {
         Grating.SetGaussianSigma(Grating.Para.maskpara.BasePara.diameter * 0.99f);
     }
 }
コード例 #6
0
ファイル: VisionStimulus.cs プロジェクト: babaq/StiLib
 /// <summary>
 /// Initialize Grating Parameters
 /// </summary>
 /// <param name="basepara"></param>
 /// <param name="maskpara"></param>
 /// <param name="shape"></param>
 /// <param name="gratingtype"></param>
 /// <param name="movetype"></param>
 /// <param name="tf"></param>
 /// <param name="sf"></param>
 /// <param name="sphase"></param>
 /// <param name="luminance"></param>
 /// <param name="contrast"></param>
 /// <param name="lhcolor"></param>
 /// <param name="rlcolor"></param>
 /// <param name="resolution"></param>
 public GratingPara(vsBasePara basepara, MaskPara maskpara, Shape shape, GratingType gratingtype, MoveType movetype, float tf, float sf, float sphase, float luminance, float contrast, Color lhcolor, Color rlcolor, int resolution)
 {
     basepara.vstype = VSType.Grating;
     basepara.primitivetype = PrimitiveType.TriangleStrip;
     this.BasePara = basepara;
     this.maskpara = maskpara;
     this.shape = shape;
     this.gratingtype = gratingtype;
     this.movetype = movetype;
     this.tf = tf;
     this.sf = sf;
     this.sphase = sphase;
     this.luminance = luminance;
     this.contrast = contrast;
     this.lhcolor = lhcolor;
     this.rlcolor = rlcolor;
     this.resolution = resolution;
 }
コード例 #7
0
 public virtual void OnGratingType(GratingType t)
 {
     renderer.material.SetInt("gratingtype", (int)t);
     GratingType = t;
 }
コード例 #8
0
 void ongratingtype(GratingType t)
 {
     OnGratingType(t);
 }