Esempio n. 1
0
 public static void DefaultSettings(ProjectorSettings settings)
 {
     settings.DeviceOutput      = DeviceOutput.Stereo;
     settings.EqualizeImages    = true;
     settings.StereoSeparation  = 0.065f;
     settings.StereoConvergence = 10f;
 }
Esempio n. 2
0
        private static IProjector BuildProjector <TProjector>(IServiceProvider sp, IConfiguration config)
            where TProjector : IProjector
        {
            var sharedSettings    = ProjectorsSettings.Get(config);
            var projectorSettings = ProjectorSettings.Get(config, typeof(TProjector).Name);
            var subFactoryOptions = GetSubscriberFactoryOptions(sharedSettings);

            var logger              = sp.GetRequiredService <IStandardLogger <TProjector> >();
            var subscriberFactory   = sp.GetRequiredService <ISubscriberFactory>();
            var streamClientFactory = sp.GetRequiredService <IStreamClientFactory>();
            var streamStateRepo     = new StreamStateRepo(logger, projectorSettings.StreamStateBasePath);
            var resolver            = new AllBusinessEventsResolver(logger);

            var projectorType = typeof(TProjector);

            var baseDependencies = new ProjectorDependencies(logger, subscriberFactory, subFactoryOptions, streamClientFactory, streamStateRepo, resolver, MapSubscriptionStreams(sharedSettings.SubscriptionStreams));

            if (projectorType == typeof(Projections.EmailReport.EmailReportProjector))
            {
                return(new Projections.EmailReport.EmailReportProjector(baseDependencies, sp.GetRequiredService <IDbContextScopeFactory <Projections.EmailReport.EmailReportDb.EmailReportDbContext> >()));
            }

            if (projectorType == typeof(Projections.SalesReport.SalesReportProjector))
            {
                return(new Projections.SalesReport.SalesReportProjector(baseDependencies, sp.GetRequiredService <IDbContextScopeFactory <Projections.SalesReport.SalesReportDb.SalesReportDbContext> >()));
            }

            return(null);
        }
Esempio n. 3
0
        public static ProjectorSettings CreateSettings(string path, string name = "Projector_Settings")
        {
            ProjectorSettings asset = ScriptableObject.CreateInstance <ProjectorSettings>();

            AssetDatabase.CreateAsset(asset, "Assets/" + path + "/" + name + ".asset");
            EditorUtility.SetDirty(asset);

            return(asset);
        }
Esempio n. 4
0
        public override void Build(ModuleMaker maker, GameObject root, GameObject head)
        {
            ProjectorBrain brain = root.AddComponent <ProjectorBrain>();

            brain.transform.position = this.position;

            ProjectorEyes eyes = head.AddComponent <ProjectorEyes>();

            eyes.transform.parent        = brain.transform;
            eyes.transform.localPosition = new Vector3(0f, 1.8f, 0f);

            ProjectorMount mount = (new GameObject("Mount")).AddComponent <ProjectorMount>();

            mount.transform.parent        = brain.transform;
            mount.transform.localPosition = eyes.transform.localPosition;
            mount.Eyes = eyes;

            if (this.selection.HasFlag(ProjectorSelection.Front))
            {
                ProjectorPlane  plane  = CreatePlane(brain, new Vector3(0, this.height * 0.5f, this.length * 0.5f), Vector3.zero);
                ProjectorCamera camera = CreateCamera(mount, plane);
                CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Front), this.width, this.height);
            }

            if (this.selection.HasFlag(ProjectorSelection.Back))
            {
                ProjectorPlane  plane  = CreatePlane(brain, new Vector3(0, this.height * 0.5f, -this.length * 0.5f), Vector3.up * 180f);
                ProjectorCamera camera = CreateCamera(mount, plane);
                CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Back), this.width, this.height);
            }

            if (this.selection.HasFlag(ProjectorSelection.Top))
            {
                ProjectorPlane  plane  = CreatePlane(brain, new Vector3(0, this.height, 0), Vector3.right * -90f);
                ProjectorCamera camera = CreateCamera(mount, plane);
                CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Top), this.width, this.length);
            }

            if (this.selection.HasFlag(ProjectorSelection.Bottom))
            {
                ProjectorPlane  plane  = CreatePlane(brain, Vector3.zero, Vector3.right * 90f);
                ProjectorCamera camera = CreateCamera(mount, plane);
                CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Bottom), this.width, this.length);
            }

            if (this.selection.HasFlag(ProjectorSelection.Left))
            {
                ProjectorPlane  plane  = CreatePlane(brain, new Vector3(-this.width * 0.5f, this.height * 0.5f, 0), Vector3.up * -90f);
                ProjectorCamera camera = CreateCamera(mount, plane);
                CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Left), this.length, this.height);
            }

            if (this.selection.HasFlag(ProjectorSelection.Right))
            {
                ProjectorPlane  plane  = CreatePlane(brain, new Vector3(this.width * 0.5f, this.height * 0.5f, 0), Vector3.up * 90f);
                ProjectorCamera camera = CreateCamera(mount, plane);
                CreateCameraConfiguration(camera, SelectionToDisplayId(ProjectorSelection.Right), this.length, this.height);
            }

            string            assetPath = ModuleMaker.AssetPath + "/Projector Settings.asset";
            ProjectorSettings asset     = AssetDatabase.LoadAssetAtPath <ProjectorSettings>(assetPath);

            if (asset == null)
            {
                asset = ScriptableObject.CreateInstance <ProjectorSettings>();
                asset.CameraTarget      = this.target;
                asset.ForceFullScreen   = false;
                asset.StereoSeparation  = 0.064f;
                asset.StereoConvergence = 10f;
                asset.NearClipPlane     = 0.01f;
                asset.FarClipPlane      = 1000f;
                AssetDatabase.CreateAsset(asset, assetPath);
            }

            brain.Settings = asset;
        }