// Just override the mandatory create scene method public override void CreateScene() { // Set ambient light sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f); // Create a point light Light l = sceneMgr.CreateLight("MainLight"); // Accept default settings: point light, white diffuse, just set position // NB I could attach the light to a SceneNode if I wanted it to move automatically with // other objects, but I don't l.Position = new Vector3(20, 80, 50); createScalingPlane(); createScrollingKnot(); createWateryPlane(); // Set up a material for the skydome MaterialPtr skyMat = MaterialManager.Singleton.Create("SkyMat", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); // Perform no dynamic lighting on the sky skyMat.SetLightingEnabled(false); // Use a cloudy sky TextureUnitState t = skyMat.GetTechnique(0).GetPass(0).CreateTextureUnitState("clouds.jpg"); // Scroll the clouds t.SetScrollAnimation(0.15f, 0f); // System will automatically set no depth write // Create a skydome sceneMgr.SetSkyDome(true, "SkyMat", -5, 2); }
protected override void CreateScene() { // since whole screen is being redrawn every frame, dont bother clearing // option works for GL right now, uncomment to test it out. huge fps increase // also, depth_write in the skybox material must be set to on //mainViewport.ClearEveryFrame = false; // set some ambient light scene.TargetRenderSystem.LightingEnabled = true; scene.AmbientLight = ColorEx.Gray; // create a point light (default) Light light = scene.CreateLight("MainLight"); light.Position = new Vector3(20, 80, 50); CreateScalingPlane(); CreateScrollingKnot(); CreateWateryPlane(); // set up a material for the skydome Material skyMaterial = scene.CreateMaterial("SkyMat"); skyMaterial.Lighting = false; // use a cloudy sky Pass pass = skyMaterial.GetTechnique(0).GetPass(0); TextureUnitState textureLayer = pass.CreateTextureUnitState("clouds.jpg"); // scroll the clouds textureLayer.SetScrollAnimation(0.15f, 0); // create the skydome scene.SetSkyDome(true, "SkyMat", -5, 2); }
private void _ogre_OnInitialised(object sender, RoutedEventArgs e) { var sceneMgr = _ogreImage.SceneManager; // Set ambient light sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f); // Create a point light Light l = sceneMgr.CreateLight("MainLight"); // Accept default settings: point light, white diffuse, just set position // NB I could attach the light to a SceneNode if I wanted it to move automatically with // other objects, but I don't l.Position = new Vector3(20, 80, 50); // Set up a material for the skydome MaterialPtr skyMat = MaterialManager.Singleton.Create("SkyMat", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); // Perform no dynamic lighting on the sky skyMat.SetLightingEnabled(false); // Use a cloudy sky TextureUnitState t = skyMat.GetTechnique(0).GetPass(0).CreateTextureUnitState("clouds.jpg"); // Scroll the clouds t.SetScrollAnimation(0.15f, 0f); // System will automatically set no depth write // Create a skydome sceneMgr.SetSkyDome(true, "SkyMat", -5, 2); //当窗口改变大小时。会重表创建渲染窗口,这时,场景管理器中的所有结点会被销毁,所以这需重新创建。 EsdSceneManager.Singleton.MainNode = sceneMgr.RootSceneNode.CreateChildSceneNode("ogreNode"); EsdSceneManager.Singleton.AddmodelNode = sceneMgr.RootSceneNode.CreateChildSceneNode(); EsdSceneManager.Singleton.WRnode = sceneMgr.RootSceneNode.CreateChildSceneNode("wrnode"); inittool(); }
private void CreateProceduralTextureMods(int p, TextureUnitState t) { // Procedural mods // Custom - don't use mod if generating environment // Because I do env a different way it look horrible if (pass[p].texGen != ShaderTextureGen.Environment) { if (pass[p].tcModRotate != 0.0f) { t.SetRotateAnimation(pass[p].tcModRotate); } if ((pass[p].tcModScroll[0] != 0.0f) || (pass[p].tcModScroll[1] != 0.0f)) { if (pass[p].tcModTurbOn) { // Turbulent scroll if (pass[p].tcModScroll[0] != 0.0f) { t.SetTransformAnimation(TextureTransform.TranslateU, WaveformType.Sine, pass[p].tcModTurb[0], pass[p].tcModTurb[3], pass[p].tcModTurb[2], pass[p].tcModTurb[1]); } if (pass[p].tcModScroll[1] != 0.0f) { t.SetTransformAnimation(TextureTransform.TranslateV, WaveformType.Sine, pass[p].tcModTurb[0], pass[p].tcModTurb[3], pass[p].tcModTurb[2], pass[p].tcModTurb[1]); } } else { // Constant scroll t.SetScrollAnimation(pass[p].tcModScroll[0], pass[p].tcModScroll[1]); } } if (pass[p].tcModStretchWave != ShaderWaveType.None) { WaveformType wft = WaveformType.Sine; switch (pass[p].tcModStretchWave) { case ShaderWaveType.Sin: wft = WaveformType.Sine; break; case ShaderWaveType.Triangle: wft = WaveformType.Triangle; break; case ShaderWaveType.Square: wft = WaveformType.Square; break; case ShaderWaveType.SawTooth: wft = WaveformType.Sawtooth; break; case ShaderWaveType.InverseSawtooth: wft = WaveformType.InverseSawtooth; break; } // Create wave-based stretcher t.SetTransformAnimation(TextureTransform.ScaleU, wft, pass[p].tcModStretchParams[3], pass[p].tcModStretchParams[0], pass[p].tcModStretchParams[2], pass[p].tcModStretchParams[1]); t.SetTransformAnimation(TextureTransform.ScaleV, wft, pass[p].tcModStretchParams[3], pass[p].tcModStretchParams[0], pass[p].tcModStretchParams[2], pass[p].tcModStretchParams[1]); } } }