protected Mesh CreateSkyDomePlane( BoxPlane plane,
float curvature,
float tiling,
float distance,
Quaternion orientation,
string groupName )
{
Plane p = new Plane();
Vector3 up = Vector3.Zero;
string meshName = "SkyDomePlane_";
// set up plane equation
p.D = distance;
switch ( plane )
{
case BoxPlane.Front:
p.Normal = Vector3.UnitZ;
up = Vector3.UnitY;
meshName += "Front";
break;
case BoxPlane.Back:
p.Normal = -Vector3.UnitZ;
up = Vector3.UnitY;
meshName += "Back";
break;
case BoxPlane.Left:
p.Normal = Vector3.UnitX;
up = Vector3.UnitY;
meshName += "Left";
break;
case BoxPlane.Right:
p.Normal = -Vector3.UnitX;
up = Vector3.UnitY;
meshName += "Right";
break;
case BoxPlane.Up:
p.Normal = -Vector3.UnitY;
up = Vector3.UnitZ;
meshName += "Up";
break;
case BoxPlane.Down:
return null;
}
// modify orientation
p.Normal = orientation * p.Normal;
up = orientation * up;
// check to see if mesh exists
MeshManager meshManager = MeshManager.Instance;
Mesh planeMesh = (Mesh)meshManager[ meshName ];
// destroy existing
if ( planeMesh != null )
{
meshManager.Unload( planeMesh );
planeMesh.Dispose();
}
// create new
float planeSize = distance * 2;
int segments = 16;
planeMesh =
meshManager.CreateCurvedIllusionPlane(
meshName,
groupName,
p,
planeSize,
planeSize,
curvature,
segments,
segments,
false,
1,
tiling,
tiling,
up,
orientation,
BufferUsage.DynamicWriteOnly,
BufferUsage.StaticWriteOnly,
true,
true );
return planeMesh;
}