internal static void InitializeUIScene(ScientificVisual3DControl scientificVisual3DControl) { if (scientificVisual3DControl == null) { return; } ColorCodedPickingScene UIScene = new ColorCodedPickingScene(); SceneElement root = UIScene.SceneContainer; UIScene.IsClear = false; root.Name = "UI Scene's container"; root.Children.Clear(); root.Effects.Clear(); UIScene.OpenGL = scientificVisual3DControl.OpenGL; scientificVisual3DControl.UIScene = UIScene; Initialize2DUI(scientificVisual3DControl); InitializeUISceneAttributes(root); SetSceneCameraToUICamera(scientificVisual3DControl); UIScene.RenderBoundingVolumes = false; }
internal static void InitializeScene(ScientificVisual3DControl scientificVisual3DControl) { if (scientificVisual3DControl == null) { return; } ColorCodedPickingScene scene = scientificVisual3DControl.Scene; scene.SceneContainer.Name = "Scene's container"; scene.SceneContainer.Children.Clear(); scene.SceneContainer.Effects.Clear(); SceneElement root = scene.SceneContainer; InitializeSceneAttributes(root); scene.RenderBoundingVolumes = false; //SceneElement scientificModelElementRoot = new SceneElement() //{ Name = "Scientific Model Elements' root" }; //scene.SceneContainer.AddChild(scientificModelElementRoot); //scientificVisual3DControl.scientificModelElementRoot = scientificModelElementRoot; ModelContainer container = new ModelContainer() { Name = "model space's container which contains models as children." }; scene.SceneContainer.AddChild(container); scientificVisual3DControl.modelContainer = container; scientificVisual3DControl.CameraRotation = new SatelliteRotation(); }
/// <summary> /// Initialises a modeling scene. A modeling scene has: /// - A 'Look At' camera targetting the centre of the scene /// - Three gentle omnidirectional lights /// - A design time grid and axis. /// </summary> /// <param name="scene">The scene.</param> public static void InitialiseModelingScene(ColorCodedPickingScene scene) { // Create the 'Look At' camera var lookAtCamera = new ScientificCamera() { Position = new Vertex(-10f, -10f, 10f), Target = new Vertex(0f, 0f, 0f), UpVector = new Vertex(0f, 0f, 1f) }; // Set the look at camera as the current camera. scene.CurrentCamera = lookAtCamera; // Add some design-time primitives. var folder = new Folder() { Name = "Design Primitives" }; folder.AddChild(new Grid()); folder.AddChild(new Axies()); scene.SceneContainer.AddChild(folder); // Create some lights. Light light1 = new Light() { Name = "Light 1", On = true, Position = new Vertex(-9, -9, 11), GLCode = OpenGL.GL_LIGHT0 }; Light light2 = new Light() { Name = "Light 2", On = true, Position = new Vertex(9, -9, 11), GLCode = OpenGL.GL_LIGHT1 }; Light light3 = new Light() { Name = "Light 3", On = true, Position = new Vertex(0, 15, 15), GLCode = OpenGL.GL_LIGHT2 }; // Add the lights. folder = new Folder() { Name = "Lights" }; folder.AddChild(light1); folder.AddChild(light2); folder.AddChild(light3); scene.SceneContainer.AddChild(folder); // Create a set of scene attributes. OpenGLAttributesEffect sceneAttributes = new OpenGLAttributesEffect() { Name = "Scene Attributes" }; // Specify the scene attributes. sceneAttributes.EnableAttributes.EnableDepthTest = true; sceneAttributes.EnableAttributes.EnableNormalize = true; sceneAttributes.EnableAttributes.EnableLighting = true; sceneAttributes.EnableAttributes.EnableTexture2D = true; sceneAttributes.EnableAttributes.EnableBlend = true; sceneAttributes.ColorBufferAttributes.BlendingSourceFactor = BlendingSourceFactor.SourceAlpha; sceneAttributes.ColorBufferAttributes.BlendingDestinationFactor = BlendingDestinationFactor.OneMinusSourceAlpha; sceneAttributes.LightingAttributes.TwoSided = true; scene.SceneContainer.AddEffect(sceneAttributes); }