本文整理汇总了C#中Polygon.UpdateBounds方法的典型用法代码示例。如果您正苦于以下问题:C# Polygon.UpdateBounds方法的具体用法?C# Polygon.UpdateBounds怎么用?C# Polygon.UpdateBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygon
的用法示例。
在下文中一共展示了Polygon.UpdateBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Generate
public void Generate(Polygon _polygon)
{
//_polygon = new Polygon(_polygon.GenerateWithCurveInverse());
// On genere les meshs des composants de la piscine
if (_polygon.GetPoints ().Count < 3)
return;
if (!_polygon.IsClosed ())
{
_polygon.Close ();
}
_polygon = _polygon.GetMirrorX();
_polygon.UpdateBounds ();
Vector2 translation = _polygon.GetPolygonCenter () * -1;
Vector2 mirror = new Vector2(1,-1);
// exprime le polygone en coordonnées monde, avec son repere centré sur son centre
PolygonRawData polyRaw = new PolygonRawData ();
foreach (Vector2 pt in _polygon.GenerateWithCurve ())
//foreach (Vector2 pt in _polygon.GenerateWithCurveInverse ())
//PolygonRawData polydata = _polygon.GenerateWithCurveInverse ();
//polydata.Reverse();
//foreach (Vector2 pt in polydata)
{
Vector2 transformedPt = (pt + translation) * _polygonScaleFactor;
/*Vector2 newpt = new Vector2();
newpt.x=pt.x;
newpt.y=pt.y;
newpt.y = 2*_polygon.bounds.center.z - newpt.y;
Vector2 transformedPt = (newpt + translation) * _polygonScaleFactor;*/
polyRaw.Add (transformedPt);
}
_transformedPolygon = new Polygon (polyRaw);
// generate liner
Mesh linerMesh = _liner.GetComponent<MeshFilter> ().mesh;
PolygonExtruder linerExtrusion = new PolygonExtruder (_transformedPolygon, linerMesh, -1.5f, false, true, true);
linerExtrusion.Generate ();
LinerScatteringMapper lsm = new LinerScatteringMapper (linerMesh);
lsm.Generate ();
PolygonExtruderMapper pem = new PolygonExtruderMapper (linerExtrusion);
pem.Generate ();
// generate sidewalk
Mesh sidewalkMesh = _sidewalk.GetComponent<MeshFilter> ().mesh;
SideWalkExtruder se = new SideWalkExtruder (_transformedPolygon, sidewalkMesh, -0.02f, 2);
se.Generate ();
PlannarMapper pm = new PlannarMapper (sidewalkMesh, Vector3.up);
pm.Generate ();
// generate rim
_rimGenerator.Generate (_polygon);
// generate occlusion
PolygonRawData occluShape = new PolygonRawData ();
occluShape.Add (new Vector2 (0.28f, 0));
occluShape.Add (new Vector2 (0.33f, 0));
Polygon occluProfile = new Polygon (occluShape);
occluProfile.SetClosed (false);
Mesh occluMesh = _occlusion.GetComponent<MeshFilter> ().mesh;
PolygonLofter occluLofter = new PolygonLofter (_transformedPolygon, occluProfile, occluMesh);
_occlusion.GetComponent<Renderer>().enabled = false;
occluLofter.Generate ();
// generate water
Mesh waterMesh = _water.GetComponent<MeshFilter> ().mesh;
PolygonExtruder waterPlan = new PolygonExtruder (_transformedPolygon, waterMesh, 0, true, false, false);
waterPlan.Generate ();
PlannarMapper waterMapper = new PlannarMapper (waterMesh, Vector3.down, UVChannel.uv0, 5);
waterMapper.Generate ();
// generate frieze
Mesh friezeMesh = _frieze.GetComponent<MeshFilter> ().mesh;
PolygonExtruder friezeExtrusion = new PolygonExtruder (_transformedPolygon, friezeMesh, -0.10f, false, false, true);
friezeExtrusion.Generate ();
PolygonExtruderMapper friezeMapper = new PolygonExtruderMapper (friezeExtrusion);
friezeMapper.Generate ();
LinerScatteringMapper lsmFrieze = new LinerScatteringMapper (friezeMesh);
lsmFrieze.Generate ();
// generate mask
Mesh maskMesh = _mask.GetComponent<MeshFilter> ().mesh;
PolygonExtruder maskExtrusion = new PolygonExtruder (_transformedPolygon, maskMesh, -0.10f, false, false, true);
maskExtrusion.Generate ();
PolygonExtruderMapper maskMapper = new PolygonExtruderMapper (maskExtrusion);
maskMapper.Generate ();
//.........这里部分代码省略.........