コード例 #1
0
        static void AddLeafVertex(IvyRootMeshCache ivyRoot, Vector3 center, Vector3 offsetScalar, float ivyLeafSize, Quaternion facing)
        {
            var tmpVertex = Vector3.zero;

            tmpVertex  = center + ivyLeafSize * offsetScalar;
            tmpVertex  = facing * (tmpVertex - center) + center; // thank you "The Pirate Duck" https://forum.unity.com/threads/rotate-vertices-around-pivot.124131/
            tmpVertex += Random.onUnitSphere * ivyLeafSize * 0.5f;
            ivyRoot.leafVertices.Add(tmpVertex);
        }
 public static IvyRootMeshCache Get(long cacheID)
 {
     if (meshCache.ContainsKey(cacheID))
     {
         return(meshCache[cacheID]);
     }
     else
     {
         var newCache = new IvyRootMeshCache();
         meshCache.Add(cacheID, newCache);
         return(newCache);
     }
 }
コード例 #3
0
 static void AddTriangle(IvyRootMeshCache ivyRoot, int offset1, int offset2, int offset3)
 {
     ivyRoot.triangles.Add(ivyRoot.vertices.Count - offset1);
     ivyRoot.triangles.Add(ivyRoot.vertices.Count - offset2);
     ivyRoot.triangles.Add(ivyRoot.vertices.Count - offset3);
 }