public WaterSceneNode(SceneNode parent, SceneManager mgr, Dimension2Df tileSize, Dimension2D tileCount, Dimension2D precision, int id) : base(parent, mgr, id) { _scene = mgr; _driver = mgr.VideoDriver; AnimatedMesh wmesh = _scene.AddHillPlaneMesh("watermesh" + _current, tileSize, tileCount, 0, new Dimension2Df(0, 0), new Dimension2Df(1, 1)); _current++; int dmat; if (_driver.DriverType == DriverType.OpenGL) dmat = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial( WATER_VERTEX_GLSL, "main", VertexShaderType._1_1, WATER_FRAGMENT_GLSL, "main", PixelShaderType._1_1, OnShaderSet, MaterialType.TransparentAlphaChannel, 0); else dmat = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial( WATER_HLSL, "vertexMain", VertexShaderType._2_0, WATER_HLSL, "pixelMain", PixelShaderType._2_0, OnShaderSet, MaterialType.TransparentAlphaChannel, 2); if (_driver.DriverType == DriverType.OpenGL) ClampShader = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial( CLAMP_VERTEX_GLSL, "main", VertexShaderType._1_1, CLAMP_FRAGMENT_GLSL, "main", PixelShaderType._1_1, OnShaderSet, MaterialType.TransparentAlphaChannel, 1); else ClampShader = _driver.GPUProgrammingServices.AddHighLevelShaderMaterial( CLAMP_HLSL, "vertexMain", VertexShaderType._2_0, CLAMP_HLSL, "pixelMain", PixelShaderType._2_0, OnShaderSet, MaterialType.TransparentAlphaChannel, 3); _waternode = _scene.AddMeshSceneNode(wmesh.GetMesh(0), this, -1); _waternode.SetMaterialType(dmat); _waternode.SetMaterialFlag(MaterialFlag.BackFaceCulling, false); _waternode.SetMaterialFlag(MaterialFlag.Lighting, false); _waternode.SetMaterialFlag(MaterialFlag.FogEnable, false); _rt = _driver.CreateRenderTargetTexture(precision); _waternode.SetMaterialTexture(0, _rt); CameraSceneNode oldcam = _scene.ActiveCamera; _fixedcam = _scene.AddCameraSceneNode(null); if (oldcam != null) _scene.ActiveCamera = oldcam; }