void CreatePlane()
{
if( RenderSystem.Instance.IsDeviceLost() )
return;
DestroyPlane();
Viewport defaultViewport = RendererWorld.Instance.DefaultViewport;
if( RenderSystem.Instance.HasShaderModel2() &&
RenderSystem.Instance.Capabilities.UserClipPlanes &&
ReflectionLevel != ReflectionLevels.None )
{
CreateReflectionTexture();
}
string meshName = MeshManager.Instance.GetUniqueName( "WaterPlane" );
Vec2 tile;
if( fixedPipelineMapTiling != 0 )
tile = size / fixedPipelineMapTiling;
else
tile = new Vec2( 0, 0 );
meshPlane = MeshManager.Instance.CreatePlane( meshName, new Plane( new Vec3( 0, 0, 1 ), 0 ),
size, segments, true, 1, tile, new Vec3( 0, 1, 0 ) );
//create material
string materialName = MaterialManager.Instance.GetUniqueName( "_GeneratedWaterPlane" );
material = (WaterPlaneHighLevelMaterial)HighLevelMaterialManager.Instance.
CreateMaterial( materialName, "WaterPlaneHighLevelMaterial" );
material.Init( this );
material.UpdateBaseMaterial();
//change material of mesh
foreach( SubMesh subMesh in meshPlane.SubMeshes )
subMesh.MaterialName = material.Name;
meshObject = SceneManager.Instance.CreateMeshObject( meshName );
meshObject.RenderQueueGroup = renderQueueGroup;
sceneNode = new SceneNode();
sceneNode.Attach( meshObject );
sceneNode.Position = position;
sceneNode.Visible = Visible;
needUpdatePlane = false;
}