• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnityEngine.MeshFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ManualUpdate

    public void ManualUpdate()
    {
        if (Group != 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 != Group.Material)
            {
                SgtHelper.BeginStealthSet(MeshRenderer);
                {
                    MeshRenderer.sharedMaterial = Group.Material;
                }
                SgtHelper.EndStealthSet();
            }
        }
    }
开发者ID:Battlespud,项目名称:ducking-octo-shame,代码行数:27,代码来源:SgtBeltModel.cs


示例17: FRenderLayer

    public FRenderLayer(FStage stage, FAtlas atlas, FShader shader)
    {
        _stage = stage;

        _atlas = atlas;
        _shader = shader;

        _expansionAmount = Futile.quadsPerLayerExpansion;
        _maxEmptyQuads = Futile.maxEmptyQuadsPerLayer;

        batchIndex = atlas.index*10000 + shader.index;

        _gameObject = new GameObject("FRenderLayer ("+_stage.name+")");
        _transform = _gameObject.transform;

        _transform.parent = Futile.instance.gameObject.transform;

        _meshFilter = _gameObject.AddComponent<MeshFilter>();
        _meshRenderer = _gameObject.AddComponent<MeshRenderer>();
        _meshRenderer.castShadows = false;
        _meshRenderer.receiveShadows = false;

        _mesh = _meshFilter.mesh;

        _material = new Material(_shader.shader);
        _material.mainTexture = _atlas.texture;

        _meshRenderer.renderer.material = _material;

        _gameObject.active = false;

        ExpandMaxQuadLimit(Futile.startingQuadsPerLayer);

        UpdateTransform();
    }
开发者ID:HaKDMoDz,项目名称:awayteam,代码行数:35,代码来源:FRenderLayer.cs


示例18: Start

 void Start()
 {
     mf_ = GetComponent<MeshFilter>();
     mr_ = GetComponent<MeshRenderer>();
     mf_.sharedMesh = Explosion.Instance.getMesh();
     mr_.sharedMaterial = Explosion.Instance.getMaterial();
 }
开发者ID:XuTenTen,项目名称:MultiThreadComponent,代码行数:7,代码来源:ExplosionRenderer.cs


示例19: Initialize

 public void Initialize()
 {
     gameObject.AddComponent<MeshRenderer>();
     mf = gameObject.AddComponent<MeshFilter>();
     renderer.material = new Material(Shader.Find("VertexLit"));
     Draw(0);
 }
开发者ID:sergutsan,项目名称:it2l-fractions-lab,代码行数:7,代码来源:MeshLineElement.cs


示例20: combineMeshes

    //combines single mesh into the base mesh
    public static void combineMeshes(GameObject addMeshObject, GameObject baseMeshObject)
    {
        startPosition = baseMeshObject.transform.position;
        baseMeshObject.transform.position = new Vector3(0,0,0);

        addMesh = addMeshObject.GetComponent<MeshFilter>();
        baseMesh = baseMeshObject.GetComponent<MeshFilter>();

        if (baseMesh == null) {
            baseMesh.mesh = addMesh.mesh;
            baseMeshObject.transform.position = startPosition;
            return;
        }

        combine[0].mesh = addMesh.sharedMesh;
        combine[0].transform = addMesh.transform.localToWorldMatrix;

        combine[1].mesh = baseMesh.sharedMesh;
        combine[1].transform = baseMesh.transform.localToWorldMatrix;

        baseMeshObject.transform.GetComponent<MeshFilter>().mesh = new Mesh();
        baseMeshObject.transform.GetComponent<MeshFilter>().mesh.CombineMeshes(combine,true);
        baseMeshObject.transform.gameObject.active = true;

        baseMeshObject.transform.position = startPosition;
    }
开发者ID:bondematt,项目名称:SpaceShipGame,代码行数:27,代码来源:CombineMeshes.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnityEngine.MeshRenderer类代码示例发布时间:2022-05-26
下一篇:
C# UnityEngine.MeshCollider类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap