private void CalculateVerticesLastPoint(RTBranchContainer rtBranchContainer) { if (rtBranchContainer.branchPoints.Count > 1) { RTBranchPoint branchPoint = rtBranchContainer.branchPoints[rtBranchContainer.branchPoints.Count - 2]; float radius = CalculateRadius(branchPoint.length); Vector3 axis = GetLoopAxis(branchPoint, rtBranchContainer, rtIvyContainer, ivyGO); Vector3 firstVector = GetFirstVector(branchPoint, rtBranchContainer, rtIvyContainer, ivyParameters, axis); branchPoint.CalculateCenterLoop(ivyGO); branchPoint.CalculateVerticesLoop(ivyParameters, rtIvyContainer, ivyGO, firstVector, axis, radius); } }
public RTBranchContainer(BranchContainer branchContainer, IvyParameters ivyParameters, RTIvyContainer rtIvyContainer, GameObject ivyGO, RTMeshData[] leavesMeshesByChosenLeaf) { this.totalLength = branchContainer.totalLenght; this.growDirection = branchContainer.growDirection; this.randomizeHeight = branchContainer.randomizeHeight; this.heightVar = branchContainer.heightVar; this.newHeight = branchContainer.newHeight; this.heightParameter = branchContainer.heightParameter; this.deltaHeight = branchContainer.deltaHeight; this.currentHeight = branchContainer.currentHeight; this.branchSense = branchContainer.branchSense; this.falling = branchContainer.falling; this.rotationOnFallIteration = branchContainer.rotationOnFallIteration; this.branchNumber = branchContainer.branchNumber; this.branchPoints = new List <RTBranchPoint>(branchContainer.branchPoints.Count); for (int i = 0; i < branchContainer.branchPoints.Count; i++) { RTBranchPoint rtBranchPoint = new RTBranchPoint(branchContainer.branchPoints[i], this); rtBranchPoint.CalculateCenterLoop(ivyGO); rtBranchPoint.PreInit(ivyParameters); rtBranchPoint.CalculateVerticesLoop(ivyParameters, rtIvyContainer, ivyGO); this.branchPoints.Add(rtBranchPoint); } branchContainer.PrepareRTLeavesDict(); if (ivyParameters.generateLeaves) { this.leavesOrderedByInitSegment = new RTLeafPoint[branchPoints.Count][]; for (int i = 0; i < branchPoints.Count; i++) { List <LeafPoint> leavesToBake = branchContainer.dictRTLeavesByInitSegment[i]; int numLeaves = 0; if (leavesToBake != null) { numLeaves = leavesToBake.Count; } this.leavesOrderedByInitSegment[i] = new RTLeafPoint[numLeaves]; for (int j = 0; j < numLeaves; j++) { RTLeafPoint rtLeafPoint = new RTLeafPoint(leavesToBake[j], ivyParameters); RTMeshData leafMeshData = leavesMeshesByChosenLeaf[rtLeafPoint.chosenLeave]; rtLeafPoint.CreateVertices(ivyParameters, leafMeshData, ivyGO); this.leavesOrderedByInitSegment[i][j] = rtLeafPoint; } } } }