当前位置: 首页>>代码示例>>C#>>正文


C# UnityEngine.MeshFilter类代码示例

本文整理汇总了C#中UnityEngine.MeshFilter的典型用法代码示例。如果您正苦于以下问题:C# MeshFilter类的具体用法?C# MeshFilter怎么用?C# MeshFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MeshFilter类属于UnityEngine命名空间,在下文中一共展示了MeshFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RestoreOriginalMeshesUV

 private void RestoreOriginalMeshesUV(MeshFilter[] meshFilters, Vector2[][] backupUVs)
 {
     for (int i = 0; i < meshFilters.Length; i++)
     {
         meshFilters[i].mesh.uv = backupUVs[i];
     }
 }
开发者ID:Shkoda,项目名称:RenderCombine,代码行数:7,代码来源:ObjectFromMeshesBuilder.cs

示例2: NewTarget

    public void NewTarget(GameObject targ)
    {
        if ( target != targ )
        {
            target = targ;
            t = 0.0f;

            if ( target )
            {
                filter = (MeshFilter)target.GetComponent(typeof(MeshFilter));

                if ( filter != null )
                    center = filter.mesh.bounds.center;
                else
                {
                    render = (MeshRenderer)target.GetComponent(typeof(MeshRenderer));

                    if ( render != null )
                        center = render.bounds.center;
                    else
                    {
                        srender = (SkinnedMeshRenderer)target.GetComponent(typeof(SkinnedMeshRenderer));

                        if ( srender != null )
                            center = srender.bounds.center;
                    }
                }
            }
        }
    }
开发者ID:mobeid,项目名称:NP_SIMULATOR,代码行数:30,代码来源:MOrbit.cs

示例3: Reset

    public virtual void Reset()
    {
        if (meshFilter != null) meshFilter.sharedMesh = null;
        if (mesh != null) DestroyImmediate(mesh);
        if (renderer != null) renderer.sharedMaterial = null;
        mesh = null;
        mesh1 = null;
        mesh2 = null;
        lastVertexCount = 0;
        vertices = null;
        colors = null;
        uvs = null;
        sharedMaterials = new Material[0];
        submeshMaterials.Clear();
        submeshes.Clear();
        valid = false;

        if(skeleton==null)
        {
            return;
        }
        valid = true;
        meshFilter = GetComponent<MeshFilter>();
        mesh1 = newMesh();
        mesh2 = newMesh();
        vertices = new Vector3[0];

        if (initialSkinName != null && initialSkinName.Length > 0 && initialSkinName != "default")
            skeleton.SetSkin(initialSkinName);
    }
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:30,代码来源:SkeletonRendererCL.cs

示例4: MeshToString

    public static string MeshToString(MeshFilter mf)
    {
        Mesh m = mf.mesh;
        //Material[] mats = mf.GetComponent<Renderer>().sharedMaterials;

        StringBuilder sb = new StringBuilder();

        sb.Append("g ").Append(mf.name).Append("\n");
        foreach (Vector3 v in m.vertices)
        {
            sb.Append(string.Format("v {0} {1} {2}\n", v.x, v.y, v.z));
        }
        sb.Append("\n");
        foreach (Vector3 v in m.normals)
        {
            sb.Append(string.Format("vn {0} {1} {2}\n", v.x, v.y, v.z));
        }
        sb.Append("\n");
        foreach (Vector3 v in m.uv)
        {
            sb.Append(string.Format("vt {0} {1}\n", v.x, v.y));
        }

        sb.Append("\n");
        int[] triangles = m.GetTriangles(0);
        for (int i = 0; i < triangles.Length; i += 3)
        {
            sb.Append(string.Format("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\n",
                triangles[i] + 1, triangles[i + 1] + 1, triangles[i + 2] + 1));
        }

        return sb.ToString();
    }
开发者ID:ja003,项目名称:Fractal-Nature-II,代码行数:33,代码来源:ObjExporter.cs

示例5: MeshToFile

 public static void MeshToFile(MeshFilter mf, string filename)
 {
     using (StreamWriter streamWriter = new StreamWriter(filename))
     {
         streamWriter.Write(RTPObjExporter.MeshToString(mf));
     }
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:7,代码来源:RTPObjExporter.cs

示例6: Start

	void Start ()
	{
	    meshFilter = GetComponent<MeshFilter>();
	    switch (shape)
	    {
	        case PGMesh.Shape.Triangle:
                meshFilter.sharedMesh = PGMesh.Triangle(Vector3.left / 2 + Vector3.down / 2, Vector3.up, Vector3.right / 2 + Vector3.down / 2);
	            break;
	        case PGMesh.Shape.Quad:
                meshFilter.sharedMesh = PGMesh.Quad(Vector3.left / 2 + Vector3.down / 2, Vector3.right, Vector3.up);
	            break;
            case PGMesh.Shape.Plane:
                meshFilter.sharedMesh = PGMesh.Plane(Vector3.left / 2 + Vector3.down / 2, Vector3.right, Vector3.up, 1, 3);
	            break;
	        case PGMesh.Shape.Tetrahedron:
                meshFilter.sharedMesh = PGMesh.Tetrahedron(1);
	            break;
            case PGMesh.Shape.Cube:
                meshFilter.sharedMesh = PGMesh.Cube(1);
	            break;
            case PGMesh.Shape.Octahedron:
                meshFilter.sharedMesh = PGMesh.Octahedron(1);
                break;
	        case PGMesh.Shape.Icosahedron:
                meshFilter.sharedMesh = PGMesh.Icosahedron(1);
                break;
	    }
	}
开发者ID:cupsster,项目名称:ProceduralExperiments,代码行数:28,代码来源:ProceduralGeneratedMesh.cs

示例7: Awake

		// Use this for initialization
		protected void Awake()
		{
			Filter = gameObject.GetComponent<MeshFilter>();
			Coll = gameObject.GetComponent<MeshCollider>();

			//past here is just to set up an example chunk
			//Blocks = new VoxBlock[ChunkSize, ChunkSize, ChunkSize];

			for (var x = 0; x < World.ChunkSize; x++)
			{
				for (var y = 0; y < World.ChunkSize; y++)
				{
					for (var z = 0; z < World.ChunkSize; z++)
					{
						Blocks[x, y, z] = new Block(Color.white) { BlockType = VoxBlockType.Empty };
					}
				}
			}

			//Blocks[1, 14, 1] = new VoxBlock();

			//Blocks[3, 5, 2] = new VoxBlock();
			//Blocks[4, 5, 2] = new VoxBlock();


			//UpdateChunk();

		}
开发者ID:Quixotic7,项目名称:VR-Vox,代码行数:29,代码来源:Chunk.cs

示例8: Start

 void Start()
 {
     mesh = new Mesh();
     mesh.name = "GeneratedMesh";
     meshFilter = GetComponent<MeshFilter>();
     meshFilter.mesh = mesh;
 }
开发者ID:brulo,项目名称:the_pantry,代码行数:7,代码来源:GenerateMesh.cs

示例9: Awake

        private void Awake()
        {
            mf = GetComponent<MeshFilter>();
            if (mf != null)
            {
                //modify collider points to snipping tringle
                //poll.points

                Vector2[] vert2d = new Vector2[mf.mesh.vertexCount];

                for (int v = 0; v < mf.mesh.vertexCount; v++)
                {
                    vert2d[v] = new Vector2(mf.mesh.vertices[v].x, mf.mesh.vertices[v].y);
                }

                Triangulator tr = new Triangulator(vert2d);
                int[] indices = tr.Triangulate();
                Vector3[] vertices = new Vector3[indices.Length];
                for (int i = 0; i < vertices.Length; i++)
                {
                    vertices[i] = new Vector3(vertices[i].x, vertices[i].y, 0);
                }

                // Create the mesh
                Mesh msh = mf.mesh;
                msh.vertices = vertices;
                msh.triangles = indices;
                msh.RecalculateNormals();
                msh.RecalculateBounds();
                mf.mesh = msh;
                // mesh.mesh.triangles = newTriangles;
            }
        }
开发者ID:Badeye,项目名称:impulse,代码行数:33,代码来源:MoveTriangle.cs

示例10: Start

    // Use this for initialization
    void Start ()
    {
        m_Creature = PlayerPrefs.GetString("m_Character" + m_PlayerProperty);

        m_Appearance = GetComponent<MeshFilter>();
        rb_MyRigidBody = this.GetComponent<Rigidbody>();

        switch (m_Creature)
        {
            case "Cochon":
                m_Appearance.mesh = s_VisuArray.a_MeshArray[0];
                break;

            case "Paresseux":
                m_Appearance.mesh = s_VisuArray.a_MeshArray[1];
                break;

            case "Mouton":
                m_Appearance.mesh = s_VisuArray.a_MeshArray[2];
                break;

            case "Canard":
                m_Appearance.mesh = s_VisuArray.a_MeshArray[3];
                break;
        }
	}
开发者ID:daviddelseray,项目名称:OuKaShaHi,代码行数:27,代码来源:ScriptSideCreature.cs

示例11: BoidController

        public BoidController(MeshFilter meshFilter)
        {
            template = MeshDraft.Tetrahedron(0.3f);

            // Avoid vertex count overflow
            swarmCount = Mathf.Min(65000/template.vertices.Count, swarmCount);
            // Optimization trick: in each frame we simulate only small percent of all boids
            simulationUpdate = Mathf.RoundToInt(swarmCount*simulationPercent);
            int vertexCount = swarmCount*template.vertices.Count;

            draft = new MeshDraft
            {
                name = "Boids",
                vertices = new List<Vector3>(vertexCount),
                triangles = new List<int>(vertexCount),
                normals = new List<Vector3>(vertexCount),
                uv = new List<Vector2>(vertexCount),
                colors = new List<Color>(vertexCount)
            };
            for (var i = 0; i < swarmCount; i++)
            {
                boids.Add(new Boid());
                draft.Add(template);
            }

            mesh = draft.ToMesh();
            mesh.MarkDynamic();
            meshFilter.mesh = mesh;
        }
开发者ID:rickoskam,项目名称:ShepherdGame,代码行数:29,代码来源:BoidController.cs

示例12: VoronoiDiagram

 public VoronoiDiagram(MeshFilter mesh, Transform transform)
 {
     _initial = new Triangle(new Pnt(-10000, -10000), new Pnt(10000, -10000), new Pnt(0, 10000));
     _delaunay = new Triangulation(_initial);
     _mesh = mesh;
     _transform = transform;
 }
开发者ID:cybergen,项目名称:bri-lib,代码行数:7,代码来源:VoronoiDiagram.cs

示例13: Start

 void Start()
 {
     //renderer  = gameObject.AddComponent<MeshRenderer>();
     //renderer.material = SetMaterial();
     mesh      = gameObject.AddComponent<MeshFilter>();// = mesh = new MeshFilter();
     mesh.mesh = CreateQuad();
 }
开发者ID:TheVirtualBoys,项目名称:TOJam9,代码行数:7,代码来源:SimpleSprite.cs

示例14: ManualUpdate

    public void ManualUpdate(Mesh mesh, Material material, Quaternion rotation)
    {
        if (Ring != null)
        {
            if (MeshFilter == null) MeshFilter = gameObject.AddComponent<MeshFilter>();

            if (MeshRenderer == null) MeshRenderer = gameObject.AddComponent<MeshRenderer>();

            if (MeshFilter.sharedMesh != mesh)
            {
                SgtHelper.BeginStealthSet(MeshFilter);
                {
                    MeshFilter.sharedMesh = mesh;
                }
                SgtHelper.EndStealthSet();
            }

            if (MeshRenderer.sharedMaterial != material)
            {
                SgtHelper.BeginStealthSet(MeshRenderer);
                {
                    MeshRenderer.sharedMaterial = material;
                }
                SgtHelper.EndStealthSet();
            }

            SgtHelper.SetLocalRotation(transform, rotation);
        }
    }
开发者ID:JasonSlingsCode,项目名称:Mindjammer,代码行数:29,代码来源:SgtRingSegment.cs

示例15: ManualUpdate

    public void ManualUpdate(Mesh mesh, Material material)
    {
        if (Jovian != null)
        {
            if (MeshFilter == null) MeshFilter = gameObject.AddComponent<MeshFilter>();

            if (MeshRenderer == null) MeshRenderer = gameObject.AddComponent<MeshRenderer>();

            if (MeshFilter.sharedMesh != mesh)
            {
                SgtHelper.BeginStealthSet(MeshFilter);
                {
                    MeshFilter.sharedMesh = mesh;
                }
                SgtHelper.EndStealthSet();
            }

            if (MeshRenderer.sharedMaterial != material)
            {
                SgtHelper.BeginStealthSet(MeshRenderer);
                {
                    MeshRenderer.sharedMaterial = material;
                }
                SgtHelper.EndStealthSet();
            }
        }
    }
开发者ID:Battlespud,项目名称:ducking-octo-shame,代码行数:27,代码来源:SgtJovianModel.cs


注:本文中的UnityEngine.MeshFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。