private void SetupControls() { SelectMenu technique = TrayManager.CreateThickSelectMenu(TrayLocation.TopLeft, "TechniqueType", "Instancing Technique", 200, 3); technique.AddItem("Instancing"); technique.AddItem("Static Geometry"); technique.AddItem("Independent Entities"); SelectMenu objectType = TrayManager.CreateThickSelectMenu(TrayLocation.TopLeft, "ObjectType", "Object : ", 200, 4); objectType.AddItem("razor"); objectType.AddItem("knot"); objectType.AddItem("tudorhouse"); objectType.AddItem("woodpallet"); TrayManager.CreateThickSlider(TrayLocation.TopLeft, "ObjectCountSlider", "Object count", 200, 50, 0, 1000, 101). SetValue(160, false); TrayManager.CreateThickSlider(TrayLocation.TopLeft, "CPUOccupationSlider", "CPU Load (ms)", 200, 75, 0, 1000.0f / 60, 20); TrayManager.CreateCheckBox(TrayLocation.TopLeft, "ShadowCheckBox", "Shadows", 200); TrayManager.CreateCheckBox(TrayLocation.TopLeft, "PostEffectCheckBox", "Post Effect", 200); TrayManager.ShowCursor(); }
/// <summary> /// /// </summary> protected void SetupGUI() { SelectMenu selectMenu = TrayManager.CreateLongSelectMenu(TrayLocation.TopLeft, "MaterialSelectMenu", "Material", 300, 200, 5); for (int i = 0; i < this.materialControlsContainer.Count; i++) { selectMenu.AddItem(this.materialControlsContainer[i].DisplayName); } selectMenu.SelectedIndexChanged += selectMenu_SelectedIndexChanged; CheckBox box = TrayManager.CreateCheckBox(TrayLocation.TopLeft, "SpinLightButton", "Spin Light", 175); box.IsChecked = true; box.CheckChanged += new CheckChangedHandler(box_CheckChanged); Button btn = TrayManager.CreateButton(TrayLocation.TopRight, "PageButtonControl", "Page", 175); btn.CursorPressed += new CursorPressedHandler(btn_CursorPressed); for (int i = 0; i < ControlsPerPage; i++) { this.shaderControls[i] = TrayManager.CreateThickSlider(TrayLocation.TopRight, "ShaderControlSlider" + i, "Control", 256, 80, 0, 1, 100); } selectMenu.SelectItem(0); TrayManager.ShowCursor(); }
private void _setupControls() { TrayManager.ShowCursor(); // make room for the controls TrayManager.ShowLogo(TrayLocation.TopRight); TrayManager.ShowFrameStats(TrayLocation.TopRight); TrayManager.ToggleAdvancedFrameStats(); this.infoLabel = TrayManager.CreateLabel(TrayLocation.Top, "TInfo", "", 350); this.editMenu = TrayManager.CreateLongSelectMenu(TrayLocation.Bottom, "EditMode", "Edit Mode", 370, 250, 3); this.editMenu.AddItem("None"); this.editMenu.AddItem("Elevation"); this.editMenu.AddItem("Blend"); this.editMenu.SelectItem(0); // no edit mode this.editMenu.SelectedIndexChanged += _itemSelected; this.flyBox = TrayManager.CreateCheckBox(TrayLocation.Bottom, "Fly", "Fly"); this.flyBox.SetChecked(false, false); this.flyBox.CheckChanged += _checkBoxToggled; this.shadowsMenu = TrayManager.CreateLongSelectMenu(TrayLocation.Bottom, "Shadows", "Shadows", 370, 250, 3); this.shadowsMenu.AddItem("None"); this.shadowsMenu.AddItem("Color Shadows"); this.shadowsMenu.AddItem("Depth Shadows"); this.shadowsMenu.SelectItem(0); this.shadowsMenu.SelectedIndexChanged += _itemSelected; var names = new List <string>(); names.Add("Help"); //a friendly reminder TrayManager.CreateParamsPanel(TrayLocation.TopLeft, "Help", 100, names).SetParamValue(0, "H/F1"); }
protected override void SetupContent() { SceneManager.SetSkyBox(true, "Examples/StormySkyBox", 5000); // add a skybox // setup some basic lighting for our scene SceneManager.AmbientLight = new ColorEx(0.5f, 0.5f, 0.5f); SceneManager.CreateLight("DynTexLight1").Position = new Vector3(20, 80, 50); // set initial camera position CameraManager.setStyle(CameraStyle.Manual); Camera.Position = new Vector3(0, 0, 200); TrayManager.ShowCursor(); // create our dynamic texture with 8-bit luminance texels var tex = TextureManager.Instance.CreateManual("thaw", ResourceGroupManager.DefaultResourceGroupName, TextureType.TwoD, TEXTURE_SIZE, TEXTURE_SIZE, 0, PixelFormat.L8, TextureUsage.DynamicWriteOnly); this.mTexBuf = tex.GetBuffer(); // save off the texture buffer // initialise the texture to have full luminance this.mTexBuf.Lock(BufferLocking.Discard); Memory.Set(this.mTexBuf.CurrentLock.Data, 0xff, this.mTexBuf.Size); this.mTexBuf.Unlock(); // create a penguin and attach him to our penguin node var penguin = SceneManager.CreateEntity("Penguin", "penguin.mesh"); this.mPenguinNode = SceneManager.RootSceneNode.CreateChildSceneNode(); this.mPenguinNode.AttachObject(penguin); // get and enable the penguin idle animation this.mPenguinAnimState = penguin.GetAnimationState("amuse"); this.mPenguinAnimState.IsEnabled = true; // create a snowstorm over the scene, and fast forward it a little var ps = ParticleSystemManager.Instance.CreateSystem("Snow", "Examples/Snow"); SceneManager.RootSceneNode.AttachObject(ps); ps.FastForward(30); // create a frosted screen in front of the camera, using our dynamic texture to "thaw" certain areas var ent = SceneManager.CreateEntity("Plane", PrefabEntity.Plane); ent.MaterialName = "Examples/Frost"; var node = SceneManager.RootSceneNode.CreateChildSceneNode(); node.Position = new Vector3(0, 0, 50); node.AttachObject(ent); this.mPlaneSize = ent.BoundingBox.Size.x; // remember the size of the plane this.mCursorQuery = SceneManager.CreateRayQuery(new Ray()); // create a ray scene query for the cursor this.mTimeSinceLastFreeze = 0; this.mWiping = false; }
/// <summary> /// Creates and initializes all the scene's GUI elements not defined in SdkSample /// </summary> protected void SetupGUI() { this.selectionModeMenu = TrayManager.CreateLongSelectMenu(TrayLocation.TopRight, "SelectionModeMenu", "Selection Mode", 300, 150, 3); this.selectionModeMenu.AddItem("None"); this.selectionModeMenu.AddItem("Mouse Select"); this.selectionModeMenu.AddItem("Selection Box"); this.selectionModeMenu.SelectItem(0); this.selectionModeMenu.SelectedIndexChanged += selectionModeMenu_SelectedIndexChanged; this.MouseLocationLabel = TrayManager.CreateLabel(TrayLocation.TopLeft, "Mouse Location", "", 350); TrayManager.ShowCursor(); }
protected override void SetupContent() { Viewport.BackgroundColor = ColorEx.White; // setup some basic lighting for our scene SceneManager.AmbientLight = new ColorEx(0.3f, 0.3f, 0.3f); SceneManager.CreateLight("SphereMappingSampleLight").Position = new Vector3(20, 80, 50); // set our camera to orbit around the origin and show cursor CameraManager.setStyle(CameraStyle.Orbit); TrayManager.ShowCursor(); // create our model, give it the environment mapped material, and place it at the origin Entity ent = SceneManager.CreateEntity("Head", "ogrehead.mesh"); ent.MaterialName = "Examples/SphereMappedRustySteel"; SceneManager.RootSceneNode.AttachObject(ent); }
protected void CreateControls() { TrayManager.CreateLabel(TrayLocation.TopLeft, "JuliaParamLabel", "Julia Parameters", 200); Slider sl = TrayManager.CreateThickSlider(TrayLocation.TopLeft, "RealSlider", "Real", 200, 80, -1, 1, 50); sl.SetValue(this.globalReal, false); sl.SliderMoved += new SliderMovedHandler(sl_SliderMoved); sl = TrayManager.CreateThickSlider(TrayLocation.TopLeft, "ImagSlider", "Imag", 200, 80, -1, 1, 50); sl.SetValue(this.globalImag, false); sl.SliderMoved += new SliderMovedHandler(sl_SliderMoved); sl = TrayManager.CreateThickSlider(TrayLocation.TopLeft, "ThetaSlider", "Theta", 200, 80, -1, 1, 50); sl.SetValue(this.globalTheta, false); sl.SliderMoved += new SliderMovedHandler(sl_SliderMoved); TrayManager.ShowCursor(); }
protected override void SetupContent() { // setup some basic lighting for our scene SceneManager.AmbientLight = new ColorEx(0.3f, 0.3f, 0.3f); SceneManager.CreateLight("ParticleSampleLight").Position = new Vector3(20, 80, 50); // set our camera to orbit around the origin and show cursor CameraManager.setStyle(CameraStyle.Orbit); CameraManager.SetYawPitchDist(0, 15, 250); TrayManager.ShowCursor(); // create an ogre head entity and place it at the origin Entity ent = SceneManager.CreateEntity("Head", "ogrehead.mesh"); SceneManager.RootSceneNode.AttachObject(ent); SetupParticles(); SetupTogglers(); }
protected override void SetupContent() { ResourceGroupManager.Instance.InitializeAllResourceGroups(); // setup some basic lighting for our scene SceneManager.AmbientLight = new ColorEx(0.5f, 0.5f, 0.5f); SceneManager.CreateLight("BezierLight").Position = new Vector3(100, 100, 100); // define the control point vertices for our patch // Patch data var patchVertices = new PatchVertex[9]; patchVertices[0].X = -500; patchVertices[0].Y = 200; patchVertices[0].Z = -500; patchVertices[0].Nx = -0.5f; patchVertices[0].Ny = 0.5f; patchVertices[0].Nz = 0; patchVertices[0].U = 0; patchVertices[0].V = 0; patchVertices[1].X = 0; patchVertices[1].Y = 500; patchVertices[1].Z = -750; patchVertices[1].Nx = 0; patchVertices[1].Ny = 0.5f; patchVertices[1].Nz = 0; patchVertices[1].U = 0.5f; patchVertices[1].V = 0; patchVertices[2].X = 500; patchVertices[2].Y = 1000; patchVertices[2].Z = -500; patchVertices[2].Nx = 0.5f; patchVertices[2].Ny = 0.5f; patchVertices[2].Nz = 0; patchVertices[2].U = 1; patchVertices[2].V = 0; patchVertices[3].X = -500; patchVertices[3].Y = 0; patchVertices[3].Z = 0; patchVertices[3].Nx = -0.5f; patchVertices[3].Ny = 0.5f; patchVertices[3].Nz = 0; patchVertices[3].U = 0; patchVertices[3].V = 0.5f; patchVertices[4].X = 0; patchVertices[4].Y = 500; patchVertices[4].Z = 0; patchVertices[4].Nx = 0; patchVertices[4].Ny = 0.5f; patchVertices[4].Nz = 0; patchVertices[4].U = 0.5f; patchVertices[4].V = 0.5f; patchVertices[5].X = 500; patchVertices[5].Y = -50; patchVertices[5].Z = 0; patchVertices[5].Nx = 0.5f; patchVertices[5].Ny = 0.5f; patchVertices[5].Nz = 0; patchVertices[5].U = 1; patchVertices[5].V = 0.5f; patchVertices[6].X = -500; patchVertices[6].Y = 0; patchVertices[6].Z = 500; patchVertices[6].Nx = -0.5f; patchVertices[6].Ny = 0.5f; patchVertices[6].Nz = 0; patchVertices[6].U = 0; patchVertices[6].V = 1; patchVertices[7].X = 0; patchVertices[7].Y = 500; patchVertices[7].Z = 500; patchVertices[7].Nx = 0; patchVertices[7].Ny = 0.5f; patchVertices[7].Nz = 0; patchVertices[7].U = 0.5f; patchVertices[7].V = 1; patchVertices[8].X = 500; patchVertices[8].Y = 200; patchVertices[8].Z = 800; patchVertices[8].Nx = 0.5f; patchVertices[8].Ny = 0.5f; patchVertices[8].Nz = 0; patchVertices[8].U = 1; patchVertices[8].V = 1; // specify a vertex format declaration for our patch: 3 floats for position, 3 floats for normal, 2 floats for UV this.patchDeclaration = HardwareBufferManager.Instance.CreateVertexDeclaration(); this.patchDeclaration.AddElement(0, 0, VertexElementType.Float3, VertexElementSemantic.Position); this.patchDeclaration.AddElement(0, 12, VertexElementType.Float3, VertexElementSemantic.Normal); this.patchDeclaration.AddElement(0, 24, VertexElementType.Float2, VertexElementSemantic.TexCoords, 0); // create a patch mesh using vertices and declaration this.patch = MeshManager.Instance.CreateBezierPatch("patch", ResourceGroupManager.DefaultResourceGroupName, patchVertices, this.patchDeclaration, 3, 3, 5, 5, VisibleSide.Both, BufferUsage.StaticWriteOnly, BufferUsage.DynamicWriteOnly, true, true); // Start patch at 0 detail this.patch.Subdivision = 0; // Create entity based on patch this.patchEntity = SceneManager.CreateEntity("Entity1", "patch"); var material = (Material)MaterialManager.Instance.Create("TextMat", ResourceGroupManager.DefaultResourceGroupName, null); material.GetTechnique(0).GetPass(0).CreateTextureUnitState("BumpyMetal.jpg"); this.patchEntity.MaterialName = "TextMat"; this.patchPass = material.GetTechnique(0).GetPass(0); // Attach the entity to the root of the scene SceneManager.RootSceneNode.AttachObject(this.patchEntity); // save the main pass of the material so we can toggle wireframe on it if (material != null) { this.patchPass = material.GetTechnique(0).GetPass(0); // use an orbit style camera CameraManager.setStyle(CameraStyle.Orbit); CameraManager.SetYawPitchDist(0, 0, 250); TrayManager.ShowCursor(); // create slider to adjust detail and checkbox to toggle wireframe Slider slider = TrayManager.CreateThickSlider(TrayLocation.TopLeft, "Detail", "Detail", 120, 44, 0, 1, 6); CheckBox box = TrayManager.CreateCheckBox(TrayLocation.TopLeft, "Wireframe", "Wireframe", 120); slider.SliderMoved += new SliderMovedHandler(slider_SliderMoved); box.CheckChanged += new CheckChangedHandler(box_CheckChanged); } }