private void AttachHydrax() { m_Log.LogMessage("Hydrax initialization..."); m_Hydrax = new MHydrax.MHydrax(m_SceneManager, m_Camera, m_Viewport); MHydrax.MProjectedGrid grid = new MHydrax.MProjectedGrid(m_Hydrax, new MHydrax.MPerlin(), new Plane(new Vector3(0, 1, 0), new Vector3()), MHydrax.MMaterialManager.MNormalMode.NM_VERTEX); m_Hydrax.SetModule(grid); m_Hydrax.LoadCfg("../scenes/Default/Hydrax/Hydrax.hdx"); m_Hydrax.Create(); m_Log.LogMessage("Hydrax initialized."); }
public void CreateWater() { //return; if (OgreEngine.mGame.GameSettings.Water == GameSettings.VideoQuality.VERYLOW) { Plane p; p.normal = Vector3.UNIT_Y; p.d = 0; MeshManager.Singleton.CreatePlane("WaterPlane", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, p, 6000F, 6000F, 1, 1, true, 1, 500F, 500F, Vector3.UNIT_Z); Entity water = OgreEngine.mMgr.CreateEntity("water", "WaterPlane"); water.CastShadows = false; water.SetMaterialName("Examples/TextureEffect4");// SceneNode waterNode = OgreEngine.mMgr.RootSceneNode.CreateChildSceneNode("WaterNode", new Mogre.Vector3(1000, 50, 1000)); waterNode.AttachObject(water); } else { mWater = new MHydrax.MHydrax(OgreEngine.mMgr, OgreEngine.mCam, OgreEngine.mWin.GetViewport(0)); if (OgreEngine.mGame.GameSettings.Water >= GameSettings.VideoQuality.HIGH) mWater.Components |= MHydrax.MHydraxComponent.HYDRAX_COMPONENT_CAUSTICS; mWater.Components |= MHydrax.MHydraxComponent.HYDRAX_COMPONENT_DEPTH; if (OgreEngine.mGame.GameSettings.Water >= GameSettings.VideoQuality.MEDIUM) mWater.Components |= MHydrax.MHydraxComponent.HYDRAX_COMPONENT_FOAM; if (OgreEngine.mGame.GameSettings.Water >= GameSettings.VideoQuality.MEDIUM) mWater.Components |= MHydrax.MHydraxComponent.HYDRAX_COMPONENT_SMOOTH; if (OgreEngine.mGame.GameSettings.Water >= GameSettings.VideoQuality.HIGH) mWater.Components |= MHydrax.MHydraxComponent.HYDRAX_COMPONENT_SUN; mWater.Components |= MHydrax.MHydraxComponent.HYDRAX_COMPONENT_UNDERWATER; /* if (OgreEngine.mGame.GameSettings.Water >= GameSettings.VideoQuality.ULTRA) mWater.Components |= MHydrax.MHydraxComponent.HYDRAX_COMPONENT_UNDERWATER_GODRAYS; */ if (OgreEngine.mGame.GameSettings.Water >= GameSettings.VideoQuality.MEDIUM) mWater.Components |= MHydrax.MHydraxComponent.HYDRAX_COMPONENT_UNDERWATER_REFLECTIONS; int complexity = 256; if (OgreEngine.mGame.GameSettings.Water >= GameSettings.VideoQuality.LOW) complexity = 16; if (OgreEngine.mGame.GameSettings.Water >= GameSettings.VideoQuality.MEDIUM) complexity = 32; if (OgreEngine.mGame.GameSettings.Water >= GameSettings.VideoQuality.HIGH) complexity = 128; if (OgreEngine.mGame.GameSettings.Water >= GameSettings.VideoQuality.ULTRA) complexity = 256; MHydrax.MProjectedGrid m = new MHydrax.MProjectedGrid(mWater, new MHydrax.MPerlin(new MHydrax.MPerlin.MOptions(8, 0.085f, 0.49f, 1.4f, 1.27f, 2f, new Vector3(0.5f, 50f, 150000f))), new Plane(new Vector3(0, 1, 0), new Vector3(0, 0, 0)), MHydrax.MMaterialManager.MNormalMode.NM_VERTEX, new MHydrax.MProjectedGrid.MOptions(complexity, 35f, 50f, false, false, true, 3.75f)); mWater.SetModule(m); mWater.Visible = true; // #Main options mWater.Position = new Vector3(0, 50, 0); mWater.PlanesError = 100f; mWater.ShaderMode = MHydrax.MMaterialManager.MShaderMode.SM_HLSL; mWater.FullReflectionDistance = 100000000000; mWater.GlobalTransparency = 0; mWater.NormalDistortion = 0.075f; mWater.WaterColor = new Vector3(0.139765f, 0.359464f, 0.425373f); // #Sun parameters mWater.SunPosition = new Vector3(0, 10000, 0); mWater.SunStrength = 1.75f; mWater.SunArea = 150; mWater.SunColor = new Vector3(1f, 0.9f, 0.6f); // #Foam parameters mWater.FoamMaxDistance = 75000000; mWater.FoamScale = 0.0075f; mWater.FoamStart = 0; mWater.FoamTransparency = 1; // #Depth parameters mWater.DepthLimit = 20; // #Smooth transitions parameters mWater.SmoothPower = 5; // #Caustics parameters mWater.CausticsScale = 135; mWater.CausticsPower = 10.5f; mWater.CausticsEnd = 0.8f; // #God rays parameters mWater.GodRaysExposure = new Vector3(0.76f, 2.46f, 2.29f); mWater.GodRaysIntensity = 0.015f; mWater.GodRaysManager.SimulationSpeed = 5; mWater.GodRaysManager.NumberOfRays = 100; mWater.GodRaysManager.RaysSize = 0.03f; mWater.GodRaysManager.ObjectsIntersectionsEnabled = false; mWater.Create();//*/ mWater.MaterialManager.AddDepthTechnique(((MaterialPtr)MaterialManager.Singleton.GetByName("ETTerrainMaterial")).CreateTechnique(), true); /*Create.MaterialManager.AddDepthTechnique( _ CType(MaterialManager.Singleton.GetByName("Island"), MaterialPtr) _ .CreateTechnique())*/ //mWater.MaterialManager.AddDepthTechnique(new Technique(MaterialManager.Singleton.GetByName("Island"))); //mWater.MaterialManager.AddDepthTechnique(MaterialManager.Singleton.GetByName("Island")); } }