private MeshWriteData AllocRawVertsIndices(uint vertexCount, uint indexCount, ref MeshBuilder.AllocMeshData allocatorData) { this.m_CurrentEntry.vertices = this.m_VertsPool.Alloc(vertexCount); this.m_CurrentEntry.indices = this.m_IndicesPool.Alloc(indexCount); MeshWriteData pooledMeshWriteData = this.GetPooledMeshWriteData(); pooledMeshWriteData.Reset(this.m_CurrentEntry.vertices, this.m_CurrentEntry.indices); return(pooledMeshWriteData); }
public MeshWriteData DrawMesh(int vertexCount, int indexCount, Texture texture, Material material, MeshGenerationContext.MeshFlags flags) { MeshWriteData pooledMeshWriteData = this.GetPooledMeshWriteData(); bool flag = vertexCount == 0 || indexCount == 0; MeshWriteData result; if (flag) { pooledMeshWriteData.Reset(default(NativeSlice <Vertex>), default(NativeSlice <ushort>)); result = pooledMeshWriteData; } else { this.m_CurrentEntry = new UIRStylePainter.Entry { vertices = this.m_VertsPool.Alloc((uint)vertexCount), indices = this.m_IndicesPool.Alloc((uint)indexCount), material = material, uvIsDisplacement = (flags == MeshGenerationContext.MeshFlags.UVisDisplacement), clipRectID = this.m_ClipRectID, isStencilClipped = this.m_StencilClip, addFlags = VertexFlags.IsSolid }; Debug.Assert(this.m_CurrentEntry.vertices.Length == vertexCount); Debug.Assert(this.m_CurrentEntry.indices.Length == indexCount); Rect uvRegion = new Rect(0f, 0f, 1f, 1f); bool flag2 = flags == MeshGenerationContext.MeshFlags.IsSVGGradients; bool flag3 = flags == MeshGenerationContext.MeshFlags.IsCustomSVGGradients; bool flag4 = flag2 | flag3; if (flag4) { this.m_CurrentEntry.addFlags = (flag2 ? VertexFlags.IsSVGGradients : VertexFlags.IsCustomSVGGradients); bool flag5 = flag3; if (flag5) { this.m_CurrentEntry.custom = texture; } this.currentElement.renderChainData.usesAtlas = true; } else { bool flag6 = texture != null; if (flag6) { RectInt rectInt; bool flag7 = this.m_AtlasManager != null && this.m_AtlasManager.TryGetLocation(texture as Texture2D, out rectInt); if (flag7) { this.m_CurrentEntry.addFlags = ((texture.filterMode == FilterMode.Point) ? VertexFlags.IsAtlasTexturedPoint : VertexFlags.IsAtlasTexturedBilinear); this.currentElement.renderChainData.usesAtlas = true; uvRegion = new Rect((float)rectInt.x, (float)rectInt.y, (float)rectInt.width, (float)rectInt.height); } else { this.m_CurrentEntry.addFlags = VertexFlags.IsCustomTextured; this.m_CurrentEntry.custom = texture; } } } pooledMeshWriteData.Reset(this.m_CurrentEntry.vertices, this.m_CurrentEntry.indices, uvRegion); this.m_Entries.Add(this.m_CurrentEntry); this.totalVertices += this.m_CurrentEntry.vertices.Length; this.totalIndices += this.m_CurrentEntry.indices.Length; this.m_CurrentEntry = default(UIRStylePainter.Entry); result = pooledMeshWriteData; } return(result); }