示例#1
0
 public void Execute()
 {
     TrailSystem.ClearNormals();
     for (var i = 0; i < trail_data_list_.Length; ++i)
     {
         var td           = trail_data_list_[i];
         var trail_points = trail_points_list_[i];
         for (var j = 0; j < TrailConfig.NODE_NUM; ++j)
         {
             int idx = td.trail_head_index_ - j;
             if (idx < 0)
             {
                 idx += TrailConfig.NODE_NUM;
             }
             Vector3 n = trail_points[idx].normal_;
             TrailSystem.AddNormal(ref n);
             TrailSystem.AddNormal(ref n);
         }
     }
 }
示例#2
0
            public void Execute()
            {
                TrailSystem.ClearVertices();
                TrailSystem.ClearNormals();
                TrailSystem.ClearUVs();
                TrailSystem.ClearTriangles();
                for (var i = 0; i < trail_data_list_.Length; ++i)
                {
                    var td           = trail_data_list_[i];
                    var trail_points = trail_points_list_[i];
                    for (var j = 0; j < TrailConfig.NODE_NUM; ++j)
                    {
                        int idx = td.trail_head_index_ - j;
                        if (idx < 0)
                        {
                            idx += TrailConfig.NODE_NUM;
                        }
                        Vector3 v = trail_points[idx].position_;
                        Vector3 n = trail_points[idx].normal_;

                        TrailSystem.AddVertex(ref v);
                        TrailSystem.AddVertex(ref v); // two by two
                        TrailSystem.AddNormal(ref n);
                        TrailSystem.AddNormal(ref n);
                        float alpha = (((float)j) / (float)TrailConfig.NODE_NUM);
                        alpha = (1f - alpha * alpha) * 0.8f;
                        var uv = new Vector2(td.color_type_, alpha);
                        TrailSystem.AddUV(ref uv);
                        TrailSystem.AddUV(ref uv);
                        if (j < TrailConfig.NODE_NUM - 1)
                        {
                            TrailSystem.AddTriangle(i * TrailConfig.NODE_NUM * 2 + (j + 0) * 2 + 0,
                                                    i * TrailConfig.NODE_NUM * 2 + (j + 0) * 2 + 1,
                                                    i * TrailConfig.NODE_NUM * 2 + (j + 1) * 2 + 0);
                            TrailSystem.AddTriangle(i * TrailConfig.NODE_NUM * 2 + (j + 1) * 2 + 0,
                                                    i * TrailConfig.NODE_NUM * 2 + (j + 0) * 2 + 1,
                                                    i * TrailConfig.NODE_NUM * 2 + (j + 1) * 2 + 1);
                        }
                    }
                }
            }