Beispiel #1
0
        /// <summary>
        /// Init all information of the experiment
        /// </summary>
        protected override void Initialize()
        {
            text = new Text(GraphicsDevice, Services, SLConfig["content"], "Arial");

            // Init Experiment Parameters
            ex = new SLExperiment();
            ex.AddExType(ExType.dGrating);
            ex.AddCondition(ExPara.Direction, 4);
            ex.Exdesign.trial   = 3;
            ex.Exdesign.trestT  = 1.0f;
            ex.Exdesign.srestT  = 0.5f;
            ex.Exdesign.preT    = 0.25f;
            ex.Exdesign.durT    = 1.0f;
            ex.Exdesign.posT    = 0.25f;
            ex.Exdesign.bgcolor = Color.Gray;

            // Init Grating Parameters
            GratingPara gpara = GratingPara.Default;

            gpara.gratingtype       = GratingType.Sinusoidal;
            gpara.shape             = Shape.Circle;
            gpara.tf                = 2.0f;
            gpara.sf                = 1.0f;
            gpara.luminance         = 0.5f;
            gpara.contrast          = 1.0f;
            gpara.BasePara.diameter = 5.0f;
            gpara.BasePara.center   = new Vector3(0.0f, 0.0f, 0.0f);
            gpara.lhcolor           = Color.RosyBrown;
            gpara.rlcolor           = Color.Blue;
            grating = new Grating(GraphicsDevice, Services, SLConfig["content"], gpara);
        }
Beispiel #2
0
 /// <summary>
 /// Init Grating with Custom GratingPara
 /// </summary>
 /// <param name="gd"></param>
 /// <param name="service"></param>
 /// <param name="path"></param>
 /// <param name="shader"></param>
 /// <param name="technique"></param>
 /// <param name="gratingpara"></param>
 public Grating(GraphicsDevice gd, IServiceProvider service, string path, string shader, string technique, GratingPara gratingpara)
     : base(gd)
 {
     Para = gratingpara;
     LoadContent(service, path, shader, technique);
     Init(gd);
 }
Beispiel #3
0
        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;
        }
Beispiel #4
0
 /// <summary>
 /// Init Grating according to gratingpara
 /// </summary>
 /// <param name="gd"></param>
 /// <param name="gratingpara"></param>
 public void Init(GraphicsDevice gd, GratingPara gratingpara)
 {
     // New content shader need LoadContent() first, so here just renew grating parameters except content
     gratingpara.BasePara.contentname = Para.BasePara.contentname;
     Para = gratingpara;
     Init(gd);
 }
Beispiel #5
0
 /// <summary>
 /// Init Grating with Custom GratingPara, Configuration and Default: "Technique1"
 /// </summary>
 /// <param name="distance2display"></param>
 /// <param name="displayratio"></param>
 /// <param name="displaysize"></param>
 /// <param name="camera"></param>
 /// <param name="unit"></param>
 /// <param name="gd"></param>
 /// <param name="service"></param>
 /// <param name="path"></param>
 /// <param name="gratingpara"></param>
 public Grating(float distance2display, float displayratio, float displaysize, SLCamera camera, Unit unit, GraphicsDevice gd, IServiceProvider service, string path, GratingPara gratingpara)
     : base(distance2display, displayratio, displaysize, gd, camera, unit)
 {
     Para = gratingpara;
     LoadContent(service, path, gratingpara.BasePara.contentname);
     Init(gd);
 }
Beispiel #6
0
 /// <summary>
 /// Init Grating with Custom GratingPara, StiLib Configuration File and Default: "Technique1"
 /// </summary>
 /// <param name="gd"></param>
 /// <param name="slconfig"></param>
 /// <param name="service"></param>
 /// <param name="path"></param>
 /// <param name="gratingpara"></param>
 public Grating(GraphicsDevice gd, AssemblySettings slconfig, IServiceProvider service, string path, GratingPara gratingpara)
     : base(gd, slconfig)
 {
     Para = gratingpara;
     LoadContent(service, path, gratingpara.BasePara.contentname);
     Init(gd);
 }
Beispiel #7
0
 /// <summary>
 /// Init Grating with Default GratingPara and "Technique1"
 /// </summary>
 /// <param name="gd"></param>
 /// <param name="service"></param>
 /// <param name="path"></param>
 public Grating(GraphicsDevice gd, IServiceProvider service, string path)
     : base(gd)
 {
     Para = GratingPara.Default;
     LoadContent(service, path);
     Init(gd);
 }
Beispiel #8
0
        protected override void Initialize()
        {
            logger    = new SLLogger();
            frameinfo = new FrameInfo();
            audio     = new SLAudio(SLConfig["content"] + "StiLib", SLConfig["content"] + "SLMWB", SLConfig["content"] + "SLSWB", SLConfig["content"] + "SLSB");
            audio.Update();
            audio.StartBgMusic("BgMusic");

            BarPara bpara = BarPara.Default;

            bpara.width              = 4.0f;
            bpara.height             = 1.0f;
            bpara.BasePara.direction = 0.0f;
            bpara.BasePara.speed     = 10.0f;
            bpara.BasePara.space     = 10.0f;
            bpara.BasePara.center    = new Vector3(-2.0f, -2.0f, 0.0f);
            bpara.BasePara.color     = Color.SeaGreen;
            bar = new Bar(GraphicsDevice, SLConfig, bpara);

            GratingPara gpara = GratingPara.Default;

            gpara.shape             = Shape.Circle;
            gpara.gratingtype       = GratingType.Sinusoidal;
            gpara.BasePara.center   = new Vector3(2.0f, 2.0f, 0.0f);
            gpara.lhcolor           = Color.OrangeRed;
            gpara.rlcolor           = new Color(0f, 1f, 0f, 1f);
            gpara.BasePara.diameter = 7.0f;
            gpara.sf        = 0.5f;
            gpara.contrast  = 0.8f;
            gpara.luminance = 0.3f;
            gpara.maskpara.BasePara.diameter = 1.2f;
            grating = new Grating(GraphicsDevice, Services, "Content", gpara);

            text  = new Text(GraphicsDevice, Services, "Content", "Arial");
            model = new SLModel(GraphicsDevice, Services, "Content", "earth");

            cross = new Primitive(GraphicsDevice, PrimitivePara.Cross(3f, Color.Green, 4 * Vector3.UnitX));
            arrow = new Primitive(GraphicsDevice, PrimitivePara.Arrow(4f, Color.Red, -4 * Vector3.UnitX, 60f, 1f));

            model.Para.BasePara.rotationspeed3D = Vector3.UnitY;
            model.ProjectionType         = ProjectionType.Perspective;
            model.globalCamera.NearPlane = 0.1f;

            timer = new SLTimer();
            timer.Start();
        }
Beispiel #9
0
        void InitExServiceUI()
        {
            ExS_Type = proxyExS.GetExType();
            if (!string.IsNullOrEmpty(ExS_Type))
            {
                switch (ExS_Type)
                {
                case "CenterSurround_2":
                    GratingPara cgrating = proxyExS.GetGrating(0);
                    exData.Add(cgrating);

                    exdataGrid.ColumnCount = 2;
                    exdataGrid.RowCount    = 2;
                    exdataGrid[0, 0].Value = "cgrating.contrast";
                    exdataGrid[1, 0].Value = cgrating.contrast;
                    break;
                }
            }
        }
Beispiel #10
0
        protected override void Initialize()
        {
            logger    = new SLLogger();
            frameinfo = new FrameInfo();
            audio     = new SLAudio(SLConfig["content"] + "StiLib", SLConfig["content"] + "SLMWB", SLConfig["content"] + "SLSWB", SLConfig["content"] + "SLSB");
            audio.Update();
            audio.StartBgMusic("BgMusic");

            BarPara bpara = BarPara.Default;

            bpara.width              = 4.0f;
            bpara.height             = 1.0f;
            bpara.BasePara.direction = 0.0f;
            bpara.BasePara.speed     = 10.0f;
            bpara.BasePara.space     = 10.0f;
            bpara.BasePara.center    = new Vector3(-2.0f, -2.0f, 0.0f);
            bpara.BasePara.color     = Color.SeaGreen;
            bar = new Bar(GraphicsDevice, SLConfig, bpara);

            GratingPara gpara = GratingPara.Default;

            gpara.shape             = Shape.Circle;
            gpara.gratingtype       = GratingType.Sinusoidal;
            gpara.BasePara.center   = new Vector3(2.0f, 2.0f, 0.0f);
            gpara.lhcolor           = Color.OrangeRed;
            gpara.rlcolor           = new Color(0f, 1f, 0f, 1f);
            gpara.BasePara.diameter = 7.0f;
            gpara.sf        = 0.5f;
            gpara.contrast  = 0.8f;
            gpara.luminance = 0.3f;
            gpara.maskpara.BasePara.diameter = 1.2f;
            grating = new Grating(GraphicsDevice, Services, "Content", gpara);

            text  = new Text(GraphicsDevice, Services, "Content", "Arial");
            image = new Image(GraphicsDevice, Services, "Content", "Turtle");
            quad  = new SLQuad(GraphicsDevice, Services, "Content", "StiLib_Logo");
            model = new SLModel(GraphicsDevice, Services, "Content", "earth");
            video = new SLVideo(GraphicsDevice, Services, "Content", "Butterfly");

            point        = new Primitive(GraphicsDevice, PrimitivePara.Default);
            circle       = new Primitive(GraphicsDevice, PrimitivePara.Circle(5f, Color.Azure, false));
            disk         = new Primitive(GraphicsDevice, PrimitivePara.Circle(0.3f, Color.DarkBlue, 4 * Vector3.UnitY, Color.DarkBlue, 100, true));
            cross        = new Primitive(GraphicsDevice, PrimitivePara.Cross(3f, Color.Green, 4 * Vector3.UnitX));
            arrow        = new Primitive(GraphicsDevice, PrimitivePara.Arrow(4f, Color.Red, -4 * Vector3.UnitX, 60f, 1f));
            radialcircle = new Primitive(GraphicsDevice, PrimitivePara.Circle(5f, new Color(0f, 0f, 0f, 0.5f), Vector3.Zero, new Color(0f, 0f, 0f, 0.0f), 100, true));
            gaussian     = new Primitive(GraphicsDevice, PrimitivePara.Gaussian(10, 1.5f, Color.Gray, Vector3.Zero));

            disk.Para.BasePara.space            = 10;
            model.Para.BasePara.rotationspeed3D = Vector3.UnitY;
            model.ProjectionType = ProjectionType.Perspective;
            //model.globalCamera.NearPlane = 0.1f;

            CollectionPara cpara = CollectionPara.Default;

            cpara.BasePara.center  = Vector3.UnitX * 5;
            cpara.CollectionCenter = new Vector3(2f, 3f, 0.0f);
            cpara.CollectionSpeed  = new Vector3(0.02f, 0.03f, 0.0f);
            vsc = new VSCollection <Primitive>(50, GraphicsDevice, cross, cpara);
            //vscp = new vscPrimitive(100, GraphicsDevice, disk, Services, "Content",cpara);

            timer = new SLTimer();
            timer.Start();
        }
Beispiel #11
0
 /// <summary>
 /// Sets Default GratingPara, need LoadContent() and Init()
 /// </summary>
 public Grating()
 {
     Para = GratingPara.Default;
 }
Beispiel #12
0
 /// <summary>
 /// Set Grating instance parameters
 /// </summary>
 /// <param name="index"></param>
 /// <param name="gratingpara"></param>
 /// <returns></returns>
 public virtual string SetGrating(int index, GratingPara gratingpara)
 {
     return("To Be Implemented");
 }