void GetCorrectSegment() { if (mVertexsegment == null) { mVertexsegment = mPool.GetVertices(bufVertices.Count, bufIndices.Count); return; } //int vcount = mVertexsegment.VertCount; //int icount = mVertexsegment.IndexCount; //if (vcount < bufVertices.Count || icount < bufIndices.Count) //{ // mPool.DiscardSegment(mVertexsegment); // mVertexsegment = mPool.GetAvailableSegment(bufVertices.Count, bufIndices.Count); // Debug.LogWarning(mVertexsegment); // //re-create a bigger one. // if (mVertexsegment == null) // mVertexsegment = mPool.GetVertices(bufVertices.Count, bufIndices.Count); //} }
void InitMeshObj() { //init vertexpool mVertexPool = new VertexPool(MyMaterial, this); mVertexSegment = mVertexPool.GetVertices(Granularity * 3, (Granularity - 1) * 12); UpdateIndices(); }
private void InitMeshObj() { mMeshObj = new GameObject("_XWeaponTrailMesh: " + base.gameObject.name); mMeshObj.layer = base.gameObject.layer; mMeshObj.SetActive(value: true); MeshFilter meshFilter = mMeshObj.AddComponent <MeshFilter>(); MeshRenderer meshRenderer = mMeshObj.AddComponent <MeshRenderer>(); meshRenderer.castShadows = false; meshRenderer.receiveShadows = false; meshRenderer.renderer.sharedMaterial = MyMaterial; meshFilter.sharedMesh = new Mesh(); mVertexPool = new VertexPool(meshFilter.sharedMesh, MyMaterial); mVertexSegment = mVertexPool.GetVertices(Granularity * 3, (Granularity - 1) * 12); UpdateIndices(); }
void InitMeshObj() { //create a new mesh obj mMeshObj = new GameObject("_XWeaponTrailMesh: " + gameObject.name); mMeshObj.layer = gameObject.layer; mMeshObj.SetActive(true); MeshFilter mf = mMeshObj.AddComponent <MeshFilter>(); MeshRenderer mr = mMeshObj.AddComponent <MeshRenderer>(); mr.castShadows = false; mr.receiveShadows = false; mr.renderer.sharedMaterial = MyMaterial; mf.sharedMesh = new Mesh(); //init vertexpool mVertexPool = new VertexPool(mf.sharedMesh, MyMaterial); mVertexSegment = mVertexPool.GetVertices(Granularity * 3, (Granularity - 1) * 12); UpdateIndices(); }
void InitMeshObj() { //create a new mesh obj mMeshObj = new GameObject("_XWeaponTrailMesh: " + gameObject.name); mMeshObj.layer = gameObject.layer; mMeshObj.SetActive(true); MeshFilter mf = mMeshObj.AddComponent<MeshFilter>(); MeshRenderer mr = mMeshObj.AddComponent<MeshRenderer>(); mr.castShadows = false; mr.receiveShadows = false; mr.GetComponent<Renderer>().sharedMaterial = MyMaterial; mf.sharedMesh = new Mesh(); //init vertexpool mVertexPool = new VertexPool(mf.sharedMesh, MyMaterial); mVertexSegment = mVertexPool.GetVertices(Granularity * 3, (Granularity - 1) * 12); UpdateIndices(); }