public void DrawRectangle(MeshGenerationContextUtils.RectangleParams rectParams) { bool flag = this.currentElement.panel.contextType == ContextType.Editor; if (flag) { rectParams.color *= rectParams.playmodeTintColor; } MeshBuilder.AllocMeshData meshAlloc = new MeshBuilder.AllocMeshData { alloc = this.m_AllocThroughDrawMeshDelegate, texture = rectParams.texture, material = rectParams.material }; bool flag2 = rectParams.vectorImage != null; if (flag2) { this.DrawVectorImage(rectParams); } else { bool flag3 = rectParams.texture != null; if (flag3) { MeshBuilder.MakeTexturedRect(rectParams, 0f, meshAlloc); } else { MeshBuilder.MakeSolidRect(rectParams, 0f, meshAlloc); } } }
public void DrawVectorImage(MeshGenerationContextUtils.RectangleParams rectParams) { VectorImage vectorImage = rectParams.vectorImage; Debug.Assert(vectorImage != null); VertexFlags vertexFlags = (vectorImage.atlas != null) ? VertexFlags.IsSVGGradients : VertexFlags.IsSolid; int settingIndexOffset = 0; bool flag = vectorImage.atlas != null && this.m_VectorImageManager != null; if (flag) { GradientRemap gradientRemap = this.m_VectorImageManager.AddUser(vectorImage); vertexFlags = (gradientRemap.isAtlassed ? VertexFlags.IsSVGGradients : VertexFlags.IsCustomSVGGradients); settingIndexOffset = gradientRemap.destIndex; } int count = this.m_Entries.Count; MeshGenerationContext.MeshFlags flags = MeshGenerationContext.MeshFlags.None; bool flag2 = vertexFlags == VertexFlags.IsSVGGradients; if (flag2) { flags = MeshGenerationContext.MeshFlags.IsSVGGradients; } else { bool flag3 = vertexFlags == VertexFlags.IsCustomSVGGradients; if (flag3) { flags = MeshGenerationContext.MeshFlags.IsCustomSVGGradients; } } MeshBuilder.AllocMeshData meshAlloc = new MeshBuilder.AllocMeshData { alloc = this.m_AllocThroughDrawMeshDelegate, texture = ((vertexFlags == VertexFlags.IsCustomSVGGradients) ? vectorImage.atlas : null), flags = flags }; int num; int num2; MeshBuilder.MakeVectorGraphics(rectParams, settingIndexOffset, meshAlloc, out num, out num2); Debug.Assert(count <= this.m_Entries.Count + 1); bool flag4 = count != this.m_Entries.Count; if (flag4) { this.m_SVGBackgroundEntryIndex = this.m_Entries.Count - 1; bool flag5 = num != 0 && num2 != 0; if (flag5) { UIRStylePainter.Entry entry = this.m_Entries[this.m_SVGBackgroundEntryIndex]; entry.vertices = entry.vertices.Slice(0, num); entry.indices = entry.indices.Slice(0, num2); this.m_Entries[this.m_SVGBackgroundEntryIndex] = entry; } } }
MeshWriteData AllocRawVertsIndices(uint vertexCount, uint indexCount, ref MeshBuilder.AllocMeshData allocatorData) { m_CurrentEntry.vertices = m_VertsPool.Alloc(vertexCount); m_CurrentEntry.indices = m_IndicesPool.Alloc(indexCount); var mwd = GetPooledMeshWriteData(); mwd.Reset(m_CurrentEntry.vertices, m_CurrentEntry.indices); return(mwd); }
MeshWriteData AllocThroughDrawGradients(uint vertexCount, uint indexCount, ref MeshBuilder.AllocMeshData allocatorData) { return(AddGradientsEntry((int)vertexCount, (int)indexCount, allocatorData.svgTexture, allocatorData.material, allocatorData.flags)); }
MeshWriteData AllocThroughDrawMesh(uint vertexCount, uint indexCount, ref MeshBuilder.AllocMeshData allocatorData) { return(DrawMesh((int)vertexCount, (int)indexCount, allocatorData.texture, allocatorData.material, allocatorData.flags)); }
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); }