private void Update()
 {
     //IL_004d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0052: Unknown result type (might be due to invalid IL or missing references)
     //IL_0091: Unknown result type (might be due to invalid IL or missing references)
     //IL_0096: Unknown result type (might be due to invalid IL or missing references)
     //IL_00ac: Unknown result type (might be due to invalid IL or missing references)
     if (subdivionsHeight > 0 && subdivionsWidth > 0)
     {
         if (isMeshUpdate)
         {
             if (targetVector.y < 0.5f * parametricPlane._height)
             {
                 isDrag       = false;
                 targetVector = Vector3.get_zero();
             }
             else
             {
                 isDrag = true;
             }
             SmoothingFilter();
             int i = 0;
             for (int num = nowVectors.Length; i < num; i++)
             {
                 vertWork[i] = nowVectors[i];
             }
             meshFilter.get_mesh().set_vertices(vertWork);
         }
         TouchSlimeUpdateAnim();
     }
 }
Пример #2
0
    public static void UpdatePlane(MeshFilter meshFilter, float fUvScale, NcSpriteFactory.NcFrameInfo ncSpriteFrameInfo, NcSpriteFactory.ALIGN_TYPE alignType)
    {
        Vector2 vector = new Vector2(fUvScale * ncSpriteFrameInfo.m_FrameScale.x, fUvScale * ncSpriteFrameInfo.m_FrameScale.y);
        float   num    = (alignType != NcSpriteFactory.ALIGN_TYPE.BOTTOM) ? ((alignType != NcSpriteFactory.ALIGN_TYPE.TOP) ? 0f : (-1f * vector.y)) : (1f * vector.y);

        Vector3[] vertices = new Vector3[]
        {
            new Vector3(ncSpriteFrameInfo.m_FrameUvOffset.get_xMax() * vector.x, ncSpriteFrameInfo.m_FrameUvOffset.get_yMax() * vector.y + num),
            new Vector3(ncSpriteFrameInfo.m_FrameUvOffset.get_xMax() * vector.x, ncSpriteFrameInfo.m_FrameUvOffset.get_yMin() * vector.y + num),
            new Vector3(ncSpriteFrameInfo.m_FrameUvOffset.get_xMin() * vector.x, ncSpriteFrameInfo.m_FrameUvOffset.get_yMin() * vector.y + num),
            new Vector3(ncSpriteFrameInfo.m_FrameUvOffset.get_xMin() * vector.x, ncSpriteFrameInfo.m_FrameUvOffset.get_yMax() * vector.y + num)
        };
        meshFilter.get_mesh().set_vertices(vertices);
        meshFilter.get_mesh().RecalculateBounds();
    }
Пример #3
0
            public static void Create(GameObject go, IEnumerable <Vector3> vertices)
            {
                if (vertices == null || vertices.Count <Vector3>() < 3)
                {
                    return;
                }
                MeshFilter meshFilter = (MeshFilter)go.GetComponent <MeshFilter>();

                if (Object.op_Equality((Object)meshFilter, (Object)null))
                {
                    meshFilter = (MeshFilter)go.AddComponent <MeshFilter>();
                }
                UnityEngine.Mesh mesh = meshFilter.get_mesh();
                mesh.Clear();
                mesh.set_vertices(vertices.ToArray <Vector3>());
                int[] numArray = new int[(mesh.get_vertices().Length - 2) * 3];
                int   index    = 0;
                int   num      = 0;

                while (index < numArray.Length)
                {
                    numArray[index]     = 0;
                    numArray[index + 1] = num + 1;
                    numArray[index + 2] = num + 2;
                    index += 3;
                    ++num;
                }
                mesh.set_triangles(numArray);
                mesh.RecalculateNormals();
                mesh.RecalculateBounds();
                meshFilter.set_sharedMesh(mesh);
            }
Пример #4
0
    public bool AddMesh(GameObject go)
    {
        if (this._lut.ContainsKey(((Object)go).GetInstanceID()))
        {
            return(true);
        }
        if (Object.op_Equality((Object)go.GetComponent <Renderer>(), (Object)null))
        {
            return(false);
        }
        MeshFilter component = (MeshFilter)go.GetComponent(typeof(MeshFilter));

        if (Object.op_Equality((Object)component, (Object)null))
        {
            return(false);
        }
        MeshData meshData1 = new MeshData();

        meshData1._instID        = ((Object)go).GetInstanceID();
        meshData1._vertCount     = component.get_mesh().get_vertexCount();
        meshData1._materialCount = ((Renderer)go.GetComponent <Renderer>()).get_sharedMaterials().Length;
        MeshData meshData2 = meshData1;
        Bounds   bounds    = ((Renderer)go.GetComponent <Renderer>()).get_bounds();
        Vector3  size      = ((Bounds) ref bounds).get_size();
        double   magnitude = (double)((Vector3) ref size).get_magnitude();

        meshData2._boundSize = (float)magnitude;
        meshData1._camDist   = !Object.op_Inequality((Object)DataCollector.MainCamera, (Object)null) ? 0.0f : Vector3.Distance(go.get_transform().get_position(), DataCollector.MainCamera.get_transform().get_position());
        this._lut.Add(meshData1._instID, meshData1);
        return(true);
    }
Пример #5
0
 private void ModifyMesh(Vector3 displacement, Vector3 center)
 {
     using (List <MeshFilter> .Enumerator enumerator = this.m_Filters.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             MeshFilter current  = enumerator.Current;
             Mesh       mesh1    = current.get_mesh();
             Vector3[]  vertices = mesh1.get_vertices();
             for (int index = 0; index < vertices.Length; ++index)
             {
                 Vector3 pos = ((Component)current).get_transform().TransformPoint(vertices[index]);
                 vertices[index] = Vector3.op_Addition(vertices[index], Vector3.op_Multiply(displacement, MeshTool.Gaussian(pos, center, this.m_Radius)));
             }
             mesh1.set_vertices(vertices);
             mesh1.RecalculateBounds();
             MeshCollider component = (MeshCollider)((Component)current).GetComponent <MeshCollider>();
             if (Object.op_Inequality((Object)component, (Object)null))
             {
                 Mesh mesh2 = new Mesh();
                 mesh2.set_vertices(mesh1.get_vertices());
                 mesh2.set_triangles(mesh1.get_triangles());
                 component.set_sharedMesh(mesh2);
             }
         }
     }
 }
Пример #6
0
 public static void UpdateMeshUVs(MeshFilter meshFilter, Rect uv)
 {
     Vector2[] uv2 = new Vector2[]
     {
         new Vector2(uv.get_x() + uv.get_width(), uv.get_y() + uv.get_height()),
         new Vector2(uv.get_x() + uv.get_width(), uv.get_y()),
         new Vector2(uv.get_x(), uv.get_y()),
         new Vector2(uv.get_x(), uv.get_y() + uv.get_height())
     };
     meshFilter.get_mesh().set_uv(uv2);
 }
Пример #7
0
    private void Initialize()
    {
        this.m_initialized  = true;
        this.m_meshRenderer = this.m_obj.GetComponent <MeshRenderer>();
        if (this.m_meshRenderer != null)
        {
            this.m_sharedMaterials = this.m_meshRenderer.get_sharedMaterials();
        }
        MeshFilter component = this.m_obj.GetComponent <MeshFilter>();

        if (component != null)
        {
            this.m_mesh = component.get_mesh();
        }
    }
Пример #8
0
    public static void CreatePlane(MeshFilter meshFilter, float fUvScale, NcSpriteFactory.NcFrameInfo ncSpriteFrameInfo, NcSpriteFactory.ALIGN_TYPE alignType, NcSpriteFactory.MESH_TYPE m_MeshType)
    {
        Vector2 vector = new Vector2(fUvScale * ncSpriteFrameInfo.m_FrameScale.x, fUvScale * ncSpriteFrameInfo.m_FrameScale.y);
        float   num    = (alignType != NcSpriteFactory.ALIGN_TYPE.BOTTOM) ? ((alignType != NcSpriteFactory.ALIGN_TYPE.TOP) ? 0f : (-1f * vector.y)) : (1f * vector.y);

        Vector3[] vertices = new Vector3[]
        {
            new Vector3(ncSpriteFrameInfo.m_FrameUvOffset.get_xMax() * vector.x, ncSpriteFrameInfo.m_FrameUvOffset.get_yMax() * vector.y + num),
            new Vector3(ncSpriteFrameInfo.m_FrameUvOffset.get_xMax() * vector.x, ncSpriteFrameInfo.m_FrameUvOffset.get_yMin() * vector.y + num),
            new Vector3(ncSpriteFrameInfo.m_FrameUvOffset.get_xMin() * vector.x, ncSpriteFrameInfo.m_FrameUvOffset.get_yMin() * vector.y + num),
            new Vector3(ncSpriteFrameInfo.m_FrameUvOffset.get_xMin() * vector.x, ncSpriteFrameInfo.m_FrameUvOffset.get_yMax() * vector.y + num)
        };
        Color[] colors = new Color[]
        {
            Color.get_white(),
                Color.get_white(),
                Color.get_white(),
                Color.get_white()
        };
        Vector3[] normals = new Vector3[]
        {
            new Vector3(0f, 0f, -1f),
            new Vector3(0f, 0f, -1f),
            new Vector3(0f, 0f, -1f),
            new Vector3(0f, 0f, -1f)
        };
        Vector4[] tangents = new Vector4[]
        {
            new Vector4(1f, 0f, 0f, -1f),
            new Vector4(1f, 0f, 0f, -1f),
            new Vector4(1f, 0f, 0f, -1f),
            new Vector4(1f, 0f, 0f, -1f)
        };
        int[] triangles;
        if (m_MeshType == NcSpriteFactory.MESH_TYPE.BuiltIn_Plane)
        {
            triangles = new int[]
            {
                1,
                2,
                0,
                0,
                2,
                3
            };
        }
        else
        {
            triangles = new int[]
            {
                1,
                2,
                0,
                0,
                2,
                3,
                1,
                0,
                3,
                3,
                2,
                1
            };
        }
        Vector2[] uv = new Vector2[]
        {
            new Vector2(1f, 1f),
            new Vector2(1f, 0f),
            new Vector2(0f, 0f),
            new Vector2(0f, 1f)
        };
        meshFilter.get_mesh().Clear();
        meshFilter.get_mesh().set_vertices(vertices);
        meshFilter.get_mesh().set_colors(colors);
        meshFilter.get_mesh().set_normals(normals);
        meshFilter.get_mesh().set_tangents(tangents);
        meshFilter.get_mesh().set_triangles(triangles);
        meshFilter.get_mesh().set_uv(uv);
        meshFilter.get_mesh().RecalculateBounds();
    }
Пример #9
0
 public static Vector3 NearestVertexTo(this MeshFilter meshFilter, Vector3 point)
 {
     return(MathExtension.NearestVertexTo(((Component)meshFilter).get_transform(), meshFilter.get_mesh(), point));
 }
    public void Initialize(int karyoku, int raisou, int taiku, int kaihi, int taikyu)
    {
        MeshRenderer component = base.GetComponent <MeshRenderer>();

        if (component == null)
        {
            Debug.Log("No MeshRenderer component");
            return;
        }
        this.mat = component.get_material();
        this.mat.set_renderQueue(5000);
        this.mat.set_color(Color.get_clear());
        MeshFilter component2 = base.GetComponent <MeshFilter>();

        if (component2 == null)
        {
            Debug.Log("No MeshFilter component");
            return;
        }
        this.mesh = component2.get_mesh();
        this.mesh.Clear();
        Vector3[] array = new Vector3[6];
        array[0] = new Vector3(0f, 0f, 0f);
        for (int i = 0; i < 5; i++)
        {
            array[i + 1] = new Vector3(Mathf.Cos((float)(-(float)i * 72) * 3.14159274f / 180f + 1.57079637f), Mathf.Sin((float)(-(float)i * 72) * 3.14159274f / 180f + 1.57079637f), 0f);
        }
        Vector3[] array2 = new Vector3[6];
        for (int j = 0; j < 6; j++)
        {
            array2[j] = new Vector3(0f, 0f, -1f);
        }
        int[] array3 = new int[15];
        for (int k = 0; k < 5; k++)
        {
            array3[3 * k]     = 0;
            array3[3 * k + 1] = k + 1;
            array3[3 * k + 2] = k + 2;
        }
        array3[14] = 1;
        this.mesh.set_vertices(array);
        this.mesh.set_normals(array2);
        this.mesh.set_triangles(array3);
        this.mesh.RecalculateNormals();
        this.mesh.RecalculateBounds();
        this.mesh.Optimize();
        component = this.outline.GetComponent <MeshRenderer>();
        if (component == null)
        {
            Debug.Log("No MeshRenderer component on sibling GameObject StatsPentagonOutline");
            return;
        }
        this.outMat = component.get_material();
        this.outMat.set_renderQueue(5000);
        this.outMat.set_color(Color.get_clear());
        component2 = this.outline.GetComponent <MeshFilter>();
        if (component2 == null)
        {
            Debug.Log("No MeshFilter component on sibling GameObject StatsPentagonOutline");
            return;
        }
        this.outMesh = component2.get_mesh();
        this.outMesh.Clear();
        array    = new Vector3[11];
        array[0] = new Vector3(0f, 0f, 0f);
        for (int l = 0; l < 5; l++)
        {
            array[2 * l + 1] = new Vector3(Mathf.Cos((float)(-(float)l * 72) * 3.14159274f / 180f + 1.59534f), Mathf.Sin((float)(-(float)l * 72) * 3.14159274f / 180f + 1.59534f), 0f);
            array[2 * l + 2] = new Vector3(Mathf.Cos((float)(-(float)l * 72) * 3.14159274f / 180f + 1.54625273f), Mathf.Sin((float)(-(float)l * 72) * 3.14159274f / 180f + 1.54625273f), 0f);
        }
        array2 = new Vector3[11];
        for (int m = 0; m < 11; m++)
        {
            array2[m] = new Vector3(0f, 0f, -1f);
        }
        array3 = new int[30];
        for (int n = 0; n < 10; n++)
        {
            array3[3 * n]     = 0;
            array3[3 * n + 1] = n + 1;
            array3[3 * n + 2] = n + 2;
        }
        array3[29] = 1;
        this.outMesh.set_vertices(array);
        this.outMesh.set_normals(array2);
        this.outMesh.set_triangles(array3);
        this.outMesh.RecalculateNormals();
        this.outMesh.RecalculateBounds();
        this.outMesh.Optimize();
        this.mat.set_color(Color.get_clear());
        this.outMat.set_color(Color.get_clear());
        this.mKaryoku = karyoku;
        this.mRaisou  = raisou;
        this.mTaiku   = taiku;
        this.mKaihi   = kaihi;
        this.mTaikyu  = taikyu;
    }
Пример #11
0
    public void UpdateGeometry(int widgetCount)
    {
        //IL_0057: Unknown result type (might be due to invalid IL or missing references)
        //IL_0079: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d7: Expected O, but got Unknown
        //IL_0415: Unknown result type (might be due to invalid IL or missing references)
        //IL_042b: Unknown result type (might be due to invalid IL or missing references)
        //IL_0467: Unknown result type (might be due to invalid IL or missing references)
        //IL_0489: Unknown result type (might be due to invalid IL or missing references)
        //IL_04a9: Unknown result type (might be due to invalid IL or missing references)
        //IL_04bf: Unknown result type (might be due to invalid IL or missing references)
        this.widgetCount = widgetCount;
        int size = verts.size;

        if (size > 0 && size == uvs.size && size == cols.size && size % 4 == 0)
        {
            if (mFilter == null)
            {
                mFilter = this.get_gameObject().GetComponent <MeshFilter>();
            }
            if (mFilter == null)
            {
                mFilter = this.get_gameObject().AddComponent <MeshFilter>();
            }
            if (verts.size < 65000)
            {
                int  num  = (size >> 1) * 3;
                bool flag = mIndices == null || mIndices.Length != num;
                if (mMesh == null)
                {
                    mMesh = new Mesh();
                    mMesh.set_hideFlags(52);
                    mMesh.set_name((!(mMaterial != null)) ? "[NGUI] Mesh" : ("[NGUI] " + mMaterial.get_name()));
                    mMesh.MarkDynamic();
                    flag = true;
                }
                bool flag2 = uvs.buffer.Length != verts.buffer.Length || cols.buffer.Length != verts.buffer.Length || (norms.buffer != null && norms.buffer.Length != verts.buffer.Length) || (tans.buffer != null && tans.buffer.Length != verts.buffer.Length);
                if (!flag2 && panel.renderQueue != 0)
                {
                    flag2 = (mMesh == null || mMesh.get_vertexCount() != verts.buffer.Length);
                }
                mTriangles = verts.size >> 1;
                if (flag2 || verts.buffer.Length > 65000)
                {
                    if (flag2 || mMesh.get_vertexCount() != verts.size)
                    {
                        mMesh.Clear();
                        flag = true;
                    }
                    mMesh.set_vertices(verts.ToArray());
                    mMesh.set_uv(uvs.ToArray());
                    mMesh.set_colors32(cols.ToArray());
                    if (norms != null)
                    {
                        mMesh.set_normals(norms.ToArray());
                    }
                    if (tans != null)
                    {
                        mMesh.set_tangents(tans.ToArray());
                    }
                }
                else
                {
                    if (mMesh.get_vertexCount() != verts.buffer.Length)
                    {
                        mMesh.Clear();
                        flag = true;
                    }
                    mMesh.set_vertices(verts.buffer);
                    mMesh.set_uv(uvs.buffer);
                    mMesh.set_colors32(cols.buffer);
                    if (norms != null)
                    {
                        mMesh.set_normals(norms.buffer);
                    }
                    if (tans != null)
                    {
                        mMesh.set_tangents(tans.buffer);
                    }
                }
                if (flag)
                {
                    mIndices = GenerateCachedIndexBuffer(size, num);
                    mMesh.set_triangles(mIndices);
                }
                if (flag2 || !alwaysOnScreen)
                {
                    mMesh.RecalculateBounds();
                }
                mFilter.set_mesh(mMesh);
            }
            else
            {
                mTriangles = 0;
                if (mFilter.get_mesh() != null)
                {
                    mFilter.get_mesh().Clear();
                }
                Debug.LogError((object)("Too many vertices on one panel: " + verts.size));
            }
            if (mRenderer == null)
            {
                mRenderer = this.get_gameObject().GetComponent <MeshRenderer>();
            }
            if (mRenderer == null)
            {
                mRenderer = this.get_gameObject().AddComponent <MeshRenderer>();
            }
            UpdateMaterials();
        }
        else
        {
            if (mFilter.get_mesh() != null)
            {
                mFilter.get_mesh().Clear();
            }
            Debug.LogError((object)("UIWidgets must fill the buffer with 4 vertices per quad. Found " + size));
        }
        verts.Clear();
        uvs.Clear();
        cols.Clear();
        norms.Clear();
        tans.Clear();
    }