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


C# Mesh类代码示例

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


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

示例1: RobotCellUR

 internal RobotCellUR(string name, RobotArm robot, IO io, Plane basePlane, Mesh environment) : base(name, Manufacturers.UR, io, basePlane, environment)
 {
     this.Robot = robot as RobotUR;
     this.DisplayMesh = new Mesh();
     DisplayMesh.Append(robot.DisplayMesh);
     this.DisplayMesh.Transform(this.BasePlane.ToTransform());
 }
开发者ID:visose,项目名称:Robots,代码行数:7,代码来源:RobotCellUR.cs

示例2: Initialize

	public void Initialize (Mesh mesh, Material[] materials, Color32 color, bool additive, float speed, int sortingLayerID, int sortingOrder) {
		StopAllCoroutines();

		gameObject.SetActive(true);


		meshRenderer.sharedMaterials = materials;
		meshRenderer.sortingLayerID = sortingLayerID;
		meshRenderer.sortingOrder = sortingOrder;

		meshFilter.sharedMesh = (Mesh)Instantiate(mesh);

		colors = meshFilter.sharedMesh.colors32;

		if ((color.a + color.r + color.g + color.b) > 0) {
			for (int i = 0; i < colors.Length; i++) {
				colors[i] = color;
			}
		}

		fadeSpeed = speed;

		if (additive)
			StartCoroutine(FadeAdditive());
		else
			StartCoroutine(Fade());
	}
开发者ID:Colorwen,项目名称:spine-runtimes,代码行数:27,代码来源:SkeletonGhostRenderer.cs

示例3: Start

    private void Start()
    {
        mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;

        CreateMesh();
    }
开发者ID:J-Roux,项目名称:project_pathfinder,代码行数:7,代码来源:PointCloud.cs

示例4: 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

示例5: BakePatternDesign

    public void BakePatternDesign()
    {
        List<InstanceData> positions = GeneratePositions();

        lastCount = positions.Count;
        var lastBuiltMesh = BakeMesh(positions.ToArray());

        #if UNITY_EDITOR
        string assetPath;

        if (generatedBakedMesh != null)
        {
            assetPath = UnityEditor.AssetDatabase.GetAssetPath(generatedBakedMesh);
        }
        else
        {
            assetPath = UnityEditor.AssetDatabase.GenerateUniqueAssetPath("Assets/AsteroidBelt.asset");
        }

        UnityEditor.AssetDatabase.CreateAsset(lastBuiltMesh, assetPath);
        UnityEditor.AssetDatabase.Refresh(UnityEditor.ImportAssetOptions.Default);
        UnityEditor.AssetDatabase.SaveAssets();

        generatedBakedMesh = UnityEditor.AssetDatabase.LoadAssetAtPath<Mesh>(assetPath);
        #endif
    }
开发者ID:Ronmenator,项目名称:GalaxyExplorer,代码行数:26,代码来源:AsteroidRing.cs

示例6: Setup

 public void Setup(Mesh m)
 {
     for (int index = 0; index < m.SubMeshes.Count; index++)
     {
         addSubMeshFunc(m.SubMeshes[index]);
     }
 }
开发者ID:justshiv,项目名称:LightSavers,代码行数:7,代码来源:BlockBasedSceneGraph.cs

示例7: Renumber

        /// <summary>
        /// Gets the permutation vector for the Reverse Cuthill-McKee numbering.
        /// </summary>
        /// <param name="mesh">The mesh.</param>
        /// <returns>Permutation vector.</returns>
        public int[] Renumber(Mesh mesh)
        {
            // Algorithm needs linear numbering of the nodes.
            mesh.Renumber(NodeNumbering.Linear);

            return Renumber(new AdjacencyMatrix(mesh));
        }
开发者ID:cmberryau,项目名称:Triangle.NET-3.5,代码行数:12,代码来源:CuthillMcKee.cs

示例8: Prepare

 public override void Prepare(Mesh mesh)
 {
   base.Prepare(mesh);
   this.randomSeed.Set(new Vector3(RandomHelper.Unit(), RandomHelper.Unit(), RandomHelper.Unit()));
   this.material.Diffuse = mesh.Material.Diffuse;
   this.material.Opacity = mesh.Material.Opacity;
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:7,代码来源:ShimmeringPointsEffect.cs

示例9: Awake

    void Awake()
    {
        if (mesh == null)
            mesh = new Mesh();
        mf.sharedMesh = mesh;
        mr.sharedMaterial = material;
        var verts = new Vector3[4];
        var tris = new int[] {0, 1, 2, 0, 2, 3};
        var uvs = new Vector2[4];
        verts[0] = targetPosition - size;
        verts[1] = targetPosition + Vector3.up * size.y - Vector3.right * size.x;
        verts[2] = targetPosition + size;
        verts[3] = targetPosition - Vector3.up * size.y + Vector3.right * size.x;

        uvs[0] = new Vector2(0, 0);
        uvs[1] = new Vector2(0, size.y);
        uvs[2] = new Vector2(size.x, size.y);
        uvs[3] = new Vector2(size.x, 0);

        mesh.vertices = verts;
        mesh.triangles = tris;
        mesh.uv = uvs;

        if (!underGround) {
            var bc = gameObject.GetComponent<BoxCollider2D>();
            bc.size = size * 2f;
        }
    }
开发者ID:kirlosev,项目名称:projectjumpius,代码行数:28,代码来源:Ground.cs

示例10: CreateQuad

    static void CreateQuad(Mesh mesh, float W, float H)
    {
        Vector3[] verts = new Vector3[4];
        Vector2[] uvs = new Vector2[4];

        verts[0] = new Vector3(-W/2, H/2, 0);
        verts[1] = new Vector3(W/2, H/2, 0);
        verts[2] = new Vector3(W/2, -H/2, 0);
        verts[3] = new Vector3(-W/2, -H/2, 0);

        uvs[0] = new Vector2(0, 1);
        uvs[1] = new Vector2(1, 1);
        uvs[2] = new Vector3(1, 0);
        uvs[3] = new Vector3(0, 0);

        int[] triangles = new int[6];
        triangles[0] = 0;
        triangles[1] = 1;
        triangles[2] = 3;
        triangles[3] = 3;
        triangles[4] = 1;
        triangles[5] = 2;

        mesh.Clear();
        mesh.vertices = verts;
        mesh.uv = uvs;
        mesh.triangles = triangles;
    }
开发者ID:joeriedel,项目名称:DarkForcesUnity,代码行数:28,代码来源:Game.cs

示例11: Start

    void Start()
    {
        // Create Vector2 vertices
        Vector3[] vertices3D = new Vector3[] {
            new Vector3(5, 10, 0),
            new Vector3(10, -5, 0),
            new Vector3(-7, -3, 0),
            new Vector3(-2, -8, 0),
            new Vector3(9, -10, 0),
        };

        // Use the triangulator to get indices for creating triangles
        MidpointTriangulator tr = new MidpointTriangulator(vertices3D);

        Vector3[] vertices = tr.Triangulate().ToArray();
        int[] indices = new int[vertices.Length];

        // Create the Vector3 vertices
        for (int i = 0; i < vertices.Length; i++)
        {
          indices[i] = i;
        }

        // Create the mesh
        Mesh msh = new Mesh();
        msh.vertices = vertices;
        msh.triangles = indices;
        msh.RecalculateNormals();
        msh.RecalculateBounds();

        // Set up game object with mesh;
        MeshFilter filter = gameObject.AddComponent(typeof(MeshFilter)) as MeshFilter;
        filter.mesh = msh;
    }
开发者ID:jonas-halbach,项目名称:DestructibleGeometry,代码行数:34,代码来源:TriangulatorTest.cs

示例12: createCylinder

    public void createCylinder(float radius, float height, int slices, GameObject go, Matrix4x4 matrix)
    {
        Mesh cylinderMesh = new Mesh();
        vertices = new Vector3[(slices+1) * 4];
        Vector3[] cylPoints1 = createCylinderPoints(radius, height, slices, true);
        Vector3[] cylPoints2 = createCylinderPoints(radius, height, slices, false);
        for (int i = 0; i <cylPoints1.Length; i++) {
            vertices[i] = cylPoints1[i];
        }
        for (int k = 0; k < cylPoints2.Length; k++) {
            vertices[k + cylPoints1.Length] = cylPoints2[k];
        }

        createCylinderNormals(vertices, radius);
        for (int j = 0; j < vertices.Length; j++) {
            vertices[j] = matrix.MultiplyPoint(vertices[j]);
            normals[j] = matrix.MultiplyPoint(normals[j]);
        }

        trianglesIndex = 0;
        createCylinderTriangles(slices+1);

        cylinderMesh.vertices = vertices;
        cylinderMesh.triangles = triangles;
        cylinderMesh.normals = normals;
        cylinderMesh.uv = uvs;

        MeshFilter filter = (MeshFilter)go.GetComponent("MeshFilter");
        filter.mesh = cylinderMesh;
    }
开发者ID:nyuvlg,项目名称:4DExperiments,代码行数:30,代码来源:MeshGenerator.cs

示例13: encode

        public virtual void encode(Mesh m, CtmOutputStream output)
        {
            int vc = m.getVertexCount();

            output.writeLittleInt(MeshDecoder.INDX);
            writeIndicies(m.indices, output);

            output.writeLittleInt(MeshDecoder.VERT);
            writeFloatArray(m.vertices, output, vc * 3, 1);

            // Write normals
            if (m.normals != null) {
                output.writeLittleInt(MeshDecoder.NORM);
                writeFloatArray(m.normals, output, vc, 3);
            }

            foreach (AttributeData ad in m.texcoordinates) {
                output.writeLittleInt(MeshDecoder.TEXC);
                output.writeString(ad.name);
                output.writeString(ad.materialName);
                writeFloatArray(ad.values, output, vc, 2);
            }

            foreach (AttributeData ad in m.attributs) {
                output.writeLittleInt(MeshDecoder.ATTR);
                output.writeString(ad.name);
                writeFloatArray(ad.values, output, vc, 4);
            }
        }
开发者ID:archimy,项目名称:OpenCtm-CSharp,代码行数:29,代码来源:RawEncoder.cs

示例14: Start

    // Use this for initialization
    void Start()
    {
        theTarget = building1;

        initialMesh = building1.GetComponent<MeshFilter>().mesh;
        swapMesh = building1alt.GetComponent<MeshFilter>().mesh;
    }
开发者ID:Haserde,项目名称:Week-4,代码行数:8,代码来源:MeshChange.cs

示例15: Generate

        /// <summary>
        /// Generate the Voronoi diagram from given triangle mesh..
        /// </summary>
        /// <param name="mesh"></param>
        /// <param name="bounded"></param>
        protected void Generate(Mesh mesh)
        {
            mesh.Renumber();

            base.edges = new List<HalfEdge>();
            this.rays = new List<HalfEdge>();

            // Allocate space for Voronoi diagram.
            var vertices = new Vertex[mesh.triangles.Count + mesh.hullsize];
            var faces = new Face[mesh.vertices.Count];

            if (factory == null)
            {
                factory = new DefaultVoronoiFactory();
            }

            factory.Initialize(vertices.Length, 2 * mesh.NumberOfEdges, faces.Length);

            // Compute triangles circumcenters.
            var map = ComputeVertices(mesh, vertices);

            // Create all Voronoi faces.
            foreach (var vertex in mesh.vertices.Values)
            {
                faces[vertex.id] = factory.CreateFace(vertex);
            }

            ComputeEdges(mesh, vertices, faces, map);

            // At this point all edges are computed, but the (edge.next) pointers aren't set.
            ConnectEdges(map);

            base.vertices = new List<Vertex>(vertices);
            base.faces = new List<Face>(faces);
        }
开发者ID:cmberryau,项目名称:Triangle.NET-3.5,代码行数:40,代码来源:VoronoiBase.cs


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