public void UpdateSettings(MatchSettings matchSettings, SampleSettings sampleSettings) { // get settings from server to compare with new ones - avoid loss var oldsettings = GetSettings(); var oldSamples = GetSampleSettings(); if (matchSettings != null) { oldsettings.TargetLanguage = matchSettings.TargetLanguage; oldsettings.Speaker = matchSettings.Speaker; oldsettings.Characters = matchSettings.Characters; oldsettings.Formal = matchSettings.Formal; oldsettings.Polite = matchSettings.Polite; oldsettings.IllocutionaryForce = matchSettings.IllocutionaryForce; oldsettings.ShowSentences = matchSettings.ShowSentences; oldsettings.SimpleView = matchSettings.SimpleView; } if (sampleSettings != null) { oldSamples.SampleFiles = sampleSettings.SampleFiles; } SetSettings(oldsettings); SetSampleFile(oldSamples.SampleFiles); }
public override async Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator => { // Create floor this.BuildStandardFloor( manipulator, Scene.DEFAULT_LAYER_NAME); // Create text geometry var textOptions = TextGeometryOptions.Default; textOptions.FontSize = 50; textOptions.MakeVolumetricText = true; textOptions.SurfaceVertexColor = Color.Blue; textOptions.VolumetricSideSurfaceVertexColor = Color4.CornflowerBlue; var resGeometry = manipulator.Add3DTextGeometryResource( $"SeeingSharp 2 {Environment.NewLine} Text3D Sample", textOptions); // Create material var resMaterial = manipulator.AddStandardMaterialResource(); // Create text geometry and object var textObject = manipulator.AddMeshObject(resGeometry, resMaterial); textObject.YPos = textOptions.VolumetricTextDepth; }); }
public override async Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator => { // Create floor this.BuildStandardFloor(manipulator, Scene.DEFAULT_LAYER_NAME); // Create resources var resGeometry = manipulator.AddGeometryResource(new CubeGeometryFactory()); var resMaterial = manipulator.AddStandardMaterialResource(enableShaderGeneratedBorder: true); // Create cube object var cubeMesh = new Mesh(resGeometry, resMaterial); cubeMesh.Color = Color4.GreenColor; cubeMesh.Position = new Vector3(0f, 0.5f, 0f); cubeMesh.BuildAnimationSequence() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_180DEG, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_360DEG, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .CallAction(() => cubeMesh.RotationEuler = Vector3.Zero) .ApplyAndRewind(); manipulator.AddObject(cubeMesh); // Create cube object var wireframeMaterial = manipulator.AddResource(device => new WireframeMaterialResource()); var wireframeCube = new Mesh(resGeometry, wireframeMaterial); wireframeCube.Color = Color4.Black; wireframeCube.TransformationType = SpacialTransformationType.TakeFromOtherObject; wireframeCube.TransformSourceObject = cubeMesh; manipulator.AddObject(wireframeCube); }); }
private async Task <SampleSettings> GetSettings() { SampleSettings settings; using (var scope = _scopeFactory.CreateScope()) { var dbContext = scope.ServiceProvider.GetRequiredService <DatabaseContext>(); settings = await dbContext.SampleSettings.AsNoTracking().FirstOrDefaultAsync(); if (settings == null) { settings = new SampleSettings { MaxLoadTime = 3, StartPage = "https://dev.battlesta.sh/", TimeInterval = 10, Email = "*****@*****.**" }; await dbContext.SampleSettings.AddAsync(settings); await dbContext.SaveChangesAsync(); } } return(settings); }
public override async Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator => { // Create floor this.BuildStandardFloor( manipulator, Scene.DEFAULT_LAYER_NAME); // Define texture and material resource var resTexture = manipulator.AddTextureResource( new AssemblyResourceLink(this.GetType(), "SimpleTexture.png")); var resMaterials = new[] { manipulator.AddStandardMaterialResource( materialDiffuseColor: Color4.White, useVertexColors: false, enableShaderGeneratedBorder: true), manipulator.AddStandardMaterialResource(resTexture), manipulator.AddStandardMaterialResource( materialDiffuseColor: Color4.CornflowerBlue, useVertexColors: false, enableShaderGeneratedBorder: true) }; // Create cube geometry resource var resGeometry = manipulator.AddGeometryResource( new CustomGeometryFactory(BuildCustomGeometry)); // Create cube meshes var meshes = new List <Mesh>(3); meshes.Add(new Mesh(resGeometry, resMaterials[1]) { Position = new Vector3(-3f, 0.5f, 0f) }); meshes.Add(new Mesh(resGeometry, resMaterials) { Position = new Vector3(0, 0.5f, 0f) }); meshes.Add(new Mesh(resGeometry, resMaterials[0], resMaterials[1]) { Position = new Vector3(3f, 0.5f, 0f) }); foreach (var actCubeMesh in meshes) { var actCubeMeshInner = actCubeMesh; actCubeMeshInner.BuildAnimationSequence() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_180DEG, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_360DEG, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .CallAction(() => actCubeMeshInner.RotationEuler = Vector3.Zero) .ApplyAndRewind(); manipulator.AddObject(actCubeMeshInner); } }); }
public override Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); _sampleSettings = (Primitive3DSampleSettings)settings; return(Task.CompletedTask); }
public override void UpdateSettings(string sceneCanvasName) { if (settings == null) { settings = new SampleSettings(); settings.name = sceneCanvasName; } }
protected override void SetSampleFile(SampleFiles sampleFiles) { var settingsReturned = new SampleSettingsPresentation(); var samples = new SampleSettings { SampleFiles = sampleFiles }; var request = new ChangeSampleSettingsRequest { UserKey = WindowsContext.UserKey, Settings = samples }; var response = _settingsClientProxy.SetSampleSettings(request); settingsReturned.Settings = response.Settings; settingsReturned.SettingsChanged = response.Success; }
public void Add_WhenTypeAndInstanceTypeAreNotSame_ShouldThrowInvalidOperationExceptionWithExpectedMessage() { var instance = new SampleSettings(); var provider = new AutoBoundConfigurationProvider(); var thrown = Assert.Throws <InvalidOperationException>(() => provider.Add(typeof(OtherSettings), instance)); Assert.Equal("Cannot add instance of type DotNetNinja.AutoBoundConfiguration.TestAssembly.SampleSettings for type DotNetNinja.AutoBoundConfiguration.TestAssembly.OtherSettings.", thrown.Message); }
public App( TelemetryClient telemetryClient, ISampleManager sampleManager, IOptions <SampleSettings> sampleSettings ) { _telemetryClient = telemetryClient; _sampleManager = sampleManager; _sampleSettings = sampleSettings.Value; }
public async Task <IActionResult> ShowSettings(SampleSettings settings) { var model = settings; if (model.TimeInterval == 0) { model = await _settingsService.GetSampleSettings(); } return(View(model)); }
public override async Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); var castedSettings = settings as Direct2DTextureSampleSettings ?? new Direct2DTextureSampleSettings(); // 2D rendering is made here _solidBrush = new SolidBrushResource(Color4.Gray); _textFormat = new TextFormatResource("Arial", 36); _textBrush = new SolidBrushResource(Color4.RedColor); var d2DDrawingLayer = new Custom2DDrawingLayer(graphics => { var d2DRectangle = new RectangleF(10, 10, 236, 236); graphics.Clear(Color4.LightBlue); graphics.FillRoundedRectangle( d2DRectangle, 30, 30, _solidBrush); d2DRectangle.Inflate(-10, -10); graphics.DrawText( castedSettings.DisplayText, _textFormat, d2DRectangle, _textBrush); }); // Build 3D scene await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator => { // Create floor this.BuildStandardFloor( manipulator, Scene.DEFAULT_LAYER_NAME); // Define Direct2D texture resource var resD2DTexture = manipulator.AddResource( _ => new Direct2DTextureResource(d2DDrawingLayer, 256, 256)); var resD2DMaterial = manipulator.AddStandardMaterialResource(resD2DTexture, enableShaderGeneratedBorder: true); // Create cube geometry resource var resGeometry = manipulator.AddResource( _ => new GeometryResource(new CubeGeometryFactory())); // Create cube object var cubeMesh = new Mesh(resGeometry, resD2DMaterial); cubeMesh.Color = Color4.GreenColor; cubeMesh.YPos = 0.5f; cubeMesh.BuildAnimationSequence() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_180DEG, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_360DEG, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .CallAction(() => cubeMesh.RotationEuler = Vector3.Zero) .ApplyAndRewind(); manipulator.AddObject(cubeMesh); }); }
public override Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); _castedSettings = (RectangleSampleSettings)settings; _fillBrush = new SolidBrushResource(Color4.Gray); _fillBrushTransparent = new SolidBrushResource(Color4.Gray, 0.5f); return(Task.FromResult <object?>(null)); }
public static SampleSettings Default() { var settings = new SampleSettings(); settings.volume = 1; settings.pitch = 1; settings.pan = 0; settings.spatialBlend = 0; settings.ignoreTimescale = false; return(settings); }
public void Add_ShouldAddInstanceToConfigurations() { var instance = new SampleSettings(); var provider = new AutoBoundConfigurationProvider(); provider.Add(typeof(SampleSettings), instance); Assert.True(provider.Registrations.ContainsKey(typeof(SampleSettings)), "An instance of SampleSettings was added but was not found in the internal Registrations dictionary."); Assert.Same(instance, provider.Registrations[typeof(SampleSettings)]); }
public static SampleSettings Default() { var settings = new SampleSettings(); settings.renderTarget = VideoRenderTarget.CameraBackground; settings.playbackSpeed = 1; settings.alpha = 1; settings.aspectRatio = VideoAspectRatio.FitHorizontally; settings.audioVolume = 1; return(settings); }
public void Add_WhenTypeHasAlreadyBeenAdded_ShouldThrow() { var instance = new SampleSettings(); var provider = new AutoBoundConfigurationProvider(); provider.Add(typeof(SampleSettings), instance); var thrown = Assert.Throws <ArgumentException>(() => provider.Add(typeof(SampleSettings), instance)); Assert.StartsWith("An item with the same key has already been added.", thrown.Message); }
public async Task <IActionResult> SaveSettings(SampleSettings settings) { var newSettings = new SampleSettings(); if (ModelState.IsValid) { newSettings = await _settingsService.UpdateSampleSettings(settings); ViewBag.UpdateSucceeded = "Zaktualizowano ustawienia"; } return(RedirectToAction("ShowSettings", "Home", newSettings)); }
public void GetSampleSettings_ReturnsSampleSettings() { // Arrange. var expectedSettings = new SampleSettings { Id = 123 }; var editableRoot = new TestEdit { Sample_SampleSettings = expectedSettings.ToXml() }; // Act. var settings = SampleUtils.Instance.GetSampleSettings(editableRoot, SampleFieldName); // Assert. Assert.AreEqual(123, settings.Id); }
private static void TestSingleComposite() { IQuery q1 = new QueryBuilder().SelectAs("Data1", "setting1") .SelectAs("Data2", "setting2") .SelectAs("Data3", "setting3") .Composite().Single() .From("D:/Projects/temp/test.csv") .Build(); Packet p1 = q1.Execute(); SampleSettings s = Decoder.DecodeAs <SampleSettings>(p1); }
public void GetSampleType_ReturnsSampleType_FromSampleTypeField() { // Arrange. var sampleSettings = new SampleSettings { SampleTypeFieldName = "SampleType" }; var editableRoot = new TestEdit { Sample_SampleSettings = sampleSettings.ToXml(), SampleType = SampleTypes.Boolean.ToString() }; // Act. var sampleType = SampleUtils.Instance.GetSampleType(editableRoot, SampleFieldName); // Assert. Assert.AreEqual(SampleTypes.Boolean, sampleType); }
public void GetSampleSizeType_ReturnsSizeType_FromSamplingTechniqueField() { // Arrange. var sampleSettings = new SampleSettings { SampleSizeType = SampleSizeTypes.AQL_BatchSize, SamplingTechniqueFieldName = "SamplingTechnique" }; var editableRoot = new TestEdit { Sample_SampleSettings = sampleSettings.ToXml(), SamplingTechnique = SampleSizeTypes.Manual.ToString() }; // Act. var sizeType = SampleUtils.Instance.GetSampleSizeType(editableRoot, SampleFieldName); // Assert. Assert.AreEqual(SampleSizeTypes.Manual, sizeType); }
public override Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); _castedSettings = (ImageSampleSettings)settings; _bitmap = new StandardBitmapResource( new AssemblyResourceLink( this.GetType(), "SimpleImage.png")); return(Task.FromResult <object?>(null)); }
public void SerializationTest() { // Arrange. const int Id = 123; const string SampleTypeFieldName = "SampleTypeField"; const string UpperSpecFieldName = "UpperSpecField"; const string LowerSpecFieldName = "LowerSpecField"; const string SamplingTechniqueFieldName = "SamplingTechniqueField"; const SampleSizeTypes SampleSizeType = SampleSizeTypes.Manual; const string SampleSizeFieldName = "SampleSizeField"; const string BatchSizeFieldName = "BatchSizeField"; const string AQLTableFieldName = "AQLTableField"; const string AQLFieldName = "AQLField"; const string NumberOfDecimalsFieldName = "NumberOfDecimalsField"; var originalSettings = new SampleSettings { Id = Id, SampleTypeFieldName = SampleTypeFieldName, UpperSpecFieldName = UpperSpecFieldName, LowerSpecFieldName = LowerSpecFieldName, SamplingTechniqueFieldName = SamplingTechniqueFieldName, SampleSizeType = SampleSizeType, SampleSizeFieldName = SampleSizeFieldName, BatchSizeFieldName = BatchSizeFieldName, AQLTableFieldName = AQLTableFieldName, AQLFieldName = AQLFieldName, NumberOfDecimalsFieldName = NumberOfDecimalsFieldName }; // Act. var xml = originalSettings.ToXml(); var newSettings = SampleSettings.Parse(xml); // Assert. Assert.AreEqual(Id, newSettings.Id); Assert.AreEqual(SampleTypeFieldName, newSettings.SampleTypeFieldName); Assert.AreEqual(UpperSpecFieldName, newSettings.UpperSpecFieldName); Assert.AreEqual(LowerSpecFieldName, newSettings.LowerSpecFieldName); Assert.AreEqual(SamplingTechniqueFieldName, newSettings.SamplingTechniqueFieldName); Assert.AreEqual(SampleSizeType, newSettings.SampleSizeType); Assert.AreEqual(SampleSizeFieldName, newSettings.SampleSizeFieldName); Assert.AreEqual(BatchSizeFieldName, newSettings.BatchSizeFieldName); Assert.AreEqual(AQLTableFieldName, newSettings.AQLTableFieldName); Assert.AreEqual(AQLFieldName, newSettings.AQLFieldName); Assert.AreEqual(NumberOfDecimalsFieldName, newSettings.NumberOfDecimalsFieldName); }
public override async Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); _castedSettings = (ObjectFilteringSettings)settings; await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator => { // Create floor this.BuildStandardFloor( manipulator, Scene.DEFAULT_LAYER_NAME); // Create material var resMaterial = manipulator.AddStandardMaterialResource(); // Create resources var resGeometryCube = manipulator.AddResource( _ => new GeometryResource(new CubeGeometryFactory())); var resGeometrySphere = manipulator.AddResource( _ => new GeometryResource(new GeosphereGeometryFactory())); var resGeometryPyramid = manipulator.AddResource( _ => new GeometryResource(new PyramidGeometryFactory())); // Create all objects and write a simple type name into the Tag1 property // We will use this Tag1 property for filter visible objects by the object type for (var loop = 0; loop < 3; loop++) { var newMesh = new Mesh(resGeometrySphere, resMaterial); newMesh.Color = Color4.BlueColor; newMesh.Position = new Vector3(-1.5f, 1f, -1.5f + loop * 1.5f); newMesh.Tag1 = "Sphere"; manipulator.AddObject(newMesh); newMesh = new Mesh(resGeometryCube, resMaterial); newMesh.Color = Color4.GreenColor; newMesh.Position = new Vector3(0f, 1f, -1.5f + loop * 1.5f); newMesh.Tag1 = "Cube"; manipulator.AddObject(newMesh); newMesh = new Mesh(resGeometryPyramid, resMaterial); newMesh.Color = Color4.RedColor; newMesh.Position = new Vector3(1.5f, 1f, -1.5f + loop * 1.5f); newMesh.Tag1 = "Pyramid"; manipulator.AddObject(newMesh); } }); }
protected override Mesh CreateMesh(SceneManipulator manipulator, SampleSettings sampleSettings, NamedOrGenericKey resMaterial) { var castedSettings = (PyramidSampleSettings)sampleSettings; var resGeometry = manipulator.AddResource( device => new GeometryResource( new PyramidGeometryFactory { Width = castedSettings.Width, Height = castedSettings.Height })); var result = new Mesh(resGeometry, resMaterial); result.Position = new Vector3(0f, 0.5f + castedSettings.Height / 2f, 0f); return(result); }
protected override Mesh CreateMesh(SceneManipulator manipulator, SampleSettings sampleSettings, NamedOrGenericKey resMaterial) { var castedSettings = (GeosphereSampleSettings)sampleSettings; var resGeometry = manipulator.AddResource( device => new GeometryResource( new GeosphereGeometryFactory { CountSubdivisions = castedSettings.CountSubdivisions, Radius = castedSettings.Radius })); var result = new Mesh(resGeometry, resMaterial); result.Position = new Vector3(0f, 0.5f + castedSettings.Radius, 0f); return(result); }
protected override Mesh CreateMesh(SceneManipulator manipulator, SampleSettings sampleSettings, NamedOrGenericKey resMaterial) { var castedSettings = (CylinderSampleSettings)sampleSettings; var resGeometry = manipulator.AddResource( device => new GeometryResource( new CylinderGeometryFactory { Radius = castedSettings.Radius, Height = castedSettings.Height, CountOfSegments = castedSettings.CountOfSegments })); var result = new Mesh(resGeometry, resMaterial); result.Position = new Vector3(0f, 0.5f, 0f); return(result); }
protected override Mesh CreateMesh(SceneManipulator manipulator, SampleSettings sampleSettings, NamedOrGenericKey resMaterial) { var castedSettings = (TorusSampleSettings)sampleSettings; var resGeometry = manipulator.AddResource( device => new GeometryResource( new TorusGeometryFactory() { TDiv = castedSettings.TDiv, PDiv = castedSettings.PDiv, TorusRadius = castedSettings.TorusRadius, TubeRadius = castedSettings.TubeRadius, })); var result = new Mesh(resGeometry, resMaterial); result.Position = new Vector3(0f, 0.5f + castedSettings.TubeRadius + castedSettings.TorusRadius, 0f); return(result); }
public override async Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); _castedSettings = (FocusSampleSettings)settings; await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator => { // Create floor this.BuildStandardFloor( manipulator, Scene.DEFAULT_LAYER_NAME); var defaultLayer = manipulator.GetLayer(Scene.DEFAULT_LAYER_NAME); // Create the focus effect and attach it to a new 'Focus' layer var keyPostprocess = manipulator.AddResource( _ => new FocusPostprocessEffectResource()); var focusLayer = manipulator.AddLayer("Focus"); focusLayer.PostprocessEffectKey = keyPostprocess; var resGeometry = manipulator.AddResource( _ => new GeometryResource(new CubeGeometryFactory())); var resMaterial = manipulator.AddStandardMaterialResource(); var frontMesh = manipulator.AddMeshObject(resGeometry, defaultLayer.Name, resMaterial); frontMesh.Color = Color4.BlueColor; frontMesh.Scaling = new Vector3(1f, 0.5f, 0.5f); frontMesh.Position = new Vector3(1f, 2f, 1f); var backMesh = manipulator.AddMeshObject(resGeometry, defaultLayer.Name, resMaterial); backMesh.RotationEuler = new Vector3(0f, EngineMath.RAD_90DEG / 3f, 0f); backMesh.Scaling = new Vector3(2f, 2f, 2f); backMesh.Color = Color4.RedColor; // This mesh will render the focus effect itself (it is placed on the focus layer) _focusMesh = manipulator.AddMeshObject(resGeometry, focusLayer.Name, resMaterial); _focusMesh.TransformSourceObject = backMesh; _focusMesh.TransformationType = SpacialTransformationType.TakeFromOtherObject; _focusMesh.Color = Color4.RedColor; }); }
public override async Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator => { // Create floor this.BuildStandardFloor( manipulator, Scene.DEFAULT_LAYER_NAME); // Create edge detect resource var resEdgeDetect = manipulator.AddResource(device => new EdgeDetectPostprocessEffectResource { BorderColor = Color4.BlueColor, Thickness = 5f }); var edgeLayer = manipulator.AddLayer("EdgeDetectLayer"); edgeLayer.PostprocessEffectKey = resEdgeDetect; // Create resources var resGeometry = manipulator.AddResource( device => new GeometryResource(new CubeGeometryFactory())); var resMaterial = manipulator.AddStandardMaterialResource(enableShaderGeneratedBorder: true); // Create object and put it on the EdgeDetectLayer var cubeMesh = new Mesh(resGeometry, resMaterial); cubeMesh.Color = Color4.GreenColor; cubeMesh.Position = new Vector3(0f, 0.5f, 0f); cubeMesh.BuildAnimationSequence() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_180DEG, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_360DEG, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .CallAction(() => cubeMesh.RotationEuler = Vector3.Zero) .ApplyAndRewind(); manipulator.AddObject(cubeMesh, "EdgeDetectLayer"); }); }
public override async Task OnReloadAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator => { // Clear previous scene manipulator.Clear(); // Create floor this.BuildStandardFloor( manipulator, Scene.DEFAULT_LAYER_NAME); // Create material resource NamedOrGenericKey resMaterial; if (_sampleSettings !.Textured) { var resTexture = manipulator.AddTextureResource( new AssemblyResourceLink( typeof(Primitive3DSampleBase), "PrimitiveTexture.png")); resMaterial = manipulator.AddStandardMaterialResource(resTexture); }
public override async Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings) { mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop)); await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator => { // Create floor this.BuildStandardFloor(manipulator, Scene.DEFAULT_LAYER_NAME); // Create resources var resGeometry = manipulator.AddGeometryResource(new CubeGeometryFactory()); var resMaterial = manipulator.AddStandardMaterialResource(enableShaderGeneratedBorder: true); // Create cube object var cubeMesh = new Mesh(resGeometry, resMaterial); cubeMesh.Color = Color4.GreenColor; cubeMesh.Position = new Vector3(0f, 0.5f, 0f); cubeMesh.BuildAnimationSequence() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_180DEG, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_360DEG, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .CallAction(() => cubeMesh.RotationEuler = Vector3.Zero) .ApplyAndRewind(); manipulator.AddObject(cubeMesh); var resSkyboxTexture = manipulator.AddTextureResource( new AssemblyResourceLink(this.GetType(), "SkyBox.dds")); // Create the skybox on a new layer manipulator.AddLayer("Skybox"); var skyboxObject = new Skybox(resSkyboxTexture); manipulator.AddObject(skyboxObject, "Skybox"); }); }
public async Task <SampleSettings> UpdateSampleSettings(SampleSettings newSettings) { var settings = await _context.SampleSettings.AsNoTracking().FirstOrDefaultAsync(); if (settings == null) { settings = new SampleSettings { TimeInterval = newSettings.TimeInterval, MaxLoadTime = newSettings.MaxLoadTime }; await _context.SampleSettings.AddAsync(settings); await _context.SaveChangesAsync(); return(settings); } settings.TimeInterval = newSettings.TimeInterval; settings.MaxLoadTime = newSettings.MaxLoadTime; settings.StartPage = newSettings.StartPage; settings.Email = newSettings.Email; _context.SampleSettings.Update(settings); await _context.SaveChangesAsync(); return(settings); }
///Sample an VideoClip on the VideoPlayer of the specified key ID object public static void SampleForID(object keyID, VideoClip clip, float time, float previousTime, SampleSettings settings) { var source = GetSourceForID(keyID); Sample(source, clip, time, previousTime, settings); }
///Sample an VideoClip in the specified VideoPlayer directly public static void Sample(VideoPlayer source, VideoClip clip, float time, float previousTime, SampleSettings settings) { if (source == null) { return; } if (previousTime == time) { source.time = time; source.Pause(); return; } source.clip = clip; source.renderMode = (VideoRenderMode)settings.renderTarget; source.playbackSpeed = settings.playbackSpeed; source.targetCameraAlpha = settings.alpha; source.aspectRatio = settings.aspectRatio; source.GetTargetAudioSource(0).volume = settings.audioVolume; time = Mathf.Repeat(time, (float)clip.length - 0.001f); if (!source.isPlaying) { source.Play(); source.time = time; } if (Mathf.Abs((float)source.time - time) > 0.1f * Time.timeScale) { source.time = time; } }
private void VerifyEmptySettings(SampleSettings settings) { Assert.AreEqual(0, settings.Id); Assert.IsNull(settings.SampleTypeFieldName); Assert.IsNull(settings.UpperSpecFieldName); Assert.IsNull(settings.LowerSpecFieldName); Assert.IsNull(settings.SamplingTechniqueFieldName); Assert.AreEqual(SampleSizeTypes.Fixed, settings.SampleSizeType); Assert.IsNull(settings.SampleSizeFieldName); Assert.IsNull(settings.BatchSizeFieldName); Assert.IsNull(settings.AQLTableFieldName); Assert.IsNull(settings.AQLFieldName); Assert.IsNull(settings.NumberOfDecimalsFieldName); }