//Return the subpolygons selected ... this are fake subpolygons... a bunch of them public List <Vector3> SubPolygonsSelected(int cols, int rows, ref List <Vector3> objsHitTerrain, Vector3 iniHit, SubDivider subDivide, int rotationFacer, bool isMouseOnTerrain, Vertexer vertex, UPoly poly, List <Vector3> currentHoverVertices) { List <Vector3> subPolys = new List <Vector3>(); subPolys = CreateListSelected(ref objsHitTerrain, cols, rows, iniHit, subDivide, isMouseOnTerrain, vertex, poly, currentHoverVertices); //print(cols + ".c||r."+rows+ " ini:."+iniHit); //print(objsHitTerrain.Count + " objsHitTerrain.cou"); //print(subPolys.Count + " subPolys.coun"); //List<Vector3> firstRow = ReturnFirstRow(subPolys, rotationFacer); return(subPolys); }
/// Creates a list for the selected sub polygons given the columns and rows List <Vector3> CreateListSelected(ref List <Vector3> objsHitTerrain, int columns, int rows, Vector3 iniHit, SubDivider subDivide, bool isMouseOnTerrain, Vertexer vertex, UPoly poly, List <Vector3> currentHoverVertices) { objsHitTerrain = UMesh.ReturnThePos(iniHit, subDivide.XSubStep, subDivide.ZSubStep, columns, rows); List <Vector3> res = new List <Vector3>(); for (int i = 0; i < objsHitTerrain.Count; i++) { res = UList.AddOneListToList(res, CreateOneSubPoly(objsHitTerrain[i], isMouseOnTerrain, vertex, subDivide, poly, currentHoverVertices)); } //still needs to eliminate duplicates return(res); }
//Initialize the Lot Steps values... for scanTerra() will not change the nextStart here. //For loading mesh vertices from file we change the Vector3 nextStart for 1st only time here public void InitializeLotStepVal( ref Vector3 nextStart, SubDivider subDivide, List <Vector3> wholeMalla, Vector3[] Vertices, ref float lotStepX, ref float lotStepZ, int inPolyDiv = 0, int polyX = 0, int polyZ = 0) { if (nextStart == wholeMalla[0] && polyX != 0) { subDivide.SubDivideLot(ref nextStart, polyX, polyZ, StepX, StepZ, inPolyDiv, Vertices); } if (lotStepZ == 0) { lotStepZ = wholeMalla[0].z - nextStart.z; lotStepX = wholeMalla[0].x - nextStart.x; //print(lotStepZ + "lotStepZ." + lotStepX + "lotStepX"); //print(wholeMalla[0] + "wholeMalla." + nextStart + "nextStart"); } }
//create one subpoly based on where we hit the terrain List <Vector3> CreateOneSubPoly(Vector3 hitPointOnSubPoly, bool isMouseOnTerrain, Vertexer vertex, SubDivider subDivide, UPoly poly, List <Vector3> currentHoverVertices) { //print(isMouseOnTerrain + "isMouseOnTerrain"); List <Vector3> subPoly = new List <Vector3>(); if (isMouseOnTerrain) { Vector3 firstVertex = vertex.FindClosestVertex(hitPointOnSubPoly, currentHoverVertices.ToArray()); Dir quadrant = vertex.FindVertexQuadrant(firstVertex, hitPointOnSubPoly); Vector3 lefTopVertex = vertex.FindTopLeftVertex(firstVertex, quadrant, subDivide.XSubStep, subDivide.ZSubStep, currentHoverVertices.ToArray()); subPoly = UPoly.FindPoly(lefTopVertex, subDivide.XSubStep, subDivide.ZSubStep, vertex, currentHoverVertices.ToArray()); //UVisHelp.CreateHelpers(subPoly, Root.blueCube); } return(subPoly); }
// Use this for initialization void Start() { camera = USearch.FindCurrentCamera(); Malla = (Malla)General.Create(Root.malla, container: Program.ClassContainer.transform); Poly = new UPoly(); subDivide = new SubDivider(); Vertex = new Vertexer(); iniTerr = new InitializerTerrain(); iniTerr.Initializer(ref Vertices, ref mesh); iniTerr.InitializeMallaStats(Vertices, ref wholeMalla, ref nextStart, ref zLot); SubPolyr = new SubPolyr(); subMesh = new SubMeshData(); IsLoading = true; //bz is static and if a new game is started needs to clean up and start again CrystalManager1 = new CrystalManager(); }
protected override RadialBindModel[] GenerateChildren() { return(SubDivider.SubDivideTriangle(_triangle, this, GetChild)); }
protected override TextureBreakModel[] GenerateChildren() { return(SubDivider.SubDivideTriangle(_triangle, this, GetChild)); }