AoMEngineLibrary.Graphics.Grn.GrnMesh.WriteRenderPass C# (CSharp) Method

WriteRenderPass() public method

public WriteRenderPass ( GrnNode rendPassSecNode, int meshIndex ) : void
rendPassSecNode GrnNode
meshIndex int
return void
        public void WriteRenderPass(GrnNode rendPassSecNode, int meshIndex)
        {
            Dictionary<int, List<int>> matFaceMap = new Dictionary<int, List<int>>();
            for (int i = 0; i < this.Faces.Count; ++i)
            {
                if (!matFaceMap.ContainsKey(this.Faces[i].MaterialIndex))
                {
                    matFaceMap.Add(this.Faces[i].MaterialIndex, new List<int>());
                }
                matFaceMap[this.Faces[i].MaterialIndex].Add(i);
            }
            foreach (KeyValuePair<int, List<int>> matFace in matFaceMap)
            {
                GrnRenderPassNode rendPassNode = new GrnRenderPassNode(rendPassSecNode);
                rendPassNode.FormMeshIndex = meshIndex;
                rendPassNode.MaterialIndex = matFace.Key + 1;
                rendPassSecNode.AppendChild(rendPassNode);

                GrnNode rpFieldSecNode = new GrnNode(rendPassNode, GrnNodeType.RenderPassFieldSection);
                rendPassNode.AppendChild(rpFieldSecNode);
                GrnNode rpFieldConstNode = new GrnNode(rpFieldSecNode, GrnNodeType.RenderPassFieldConstant);
                rpFieldConstNode.Data = new byte[] { 0x00, 0x00, 0x80, 0x3F,
                    0x00, 0x00, 0x80, 0x3F,
                    0x00, 0x00, 0x80, 0x3F };
                rpFieldSecNode.AppendChild(rpFieldConstNode);
                GrnNode rpFieldAssNode = new GrnNode(rpFieldSecNode, GrnNodeType.RenderPassFieldAssignment);
                rpFieldAssNode.Data = new byte[] { 0x00, 0x00, 0x00, 0x00 };
                rpFieldSecNode.AppendChild(rpFieldAssNode);

                GrnRenderPassTrianglesNode rpTriNode = new GrnRenderPassTrianglesNode(rendPassNode);
                foreach (int faceIndex in matFace.Value)
                {
                    rpTriNode.TextureIndices.Add(faceIndex, this.Faces[faceIndex].TextureIndices);
                }
                rendPassNode.AppendChild(rpTriNode);
            }
        }