protected override void BuildData() { VertexList.AddRange(new Vector3[] { new Vector3(.5f, -.5f, 0), new Vector3(-.5f, -.5f, 0), new Vector3(-.5f, .5f, 0), new Vector3(.5f, .5f, 0), }); NormalList.AddRange(new Vector3[] { Vector3.Backward, Vector3.Backward, Vector3.Backward, Vector3.Backward, }); TexCoordList.AddRange(new Vector2[] { new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0), }); ColorList.AddRange(new Color[] { Color.White, Color.White, Color.White, Color.White, }); IndexList.AddRange(new int[] { 0, 1, 2, 2, 3, 0, // Front }); CalculateTangents(); }
public void IteratorTest() { var indexList = new IndexList <string>(); indexList.Add("A"); var t = new List <string>(); t.Add("B"); t.Add("C"); indexList.AddRange(t); var str1 = ""; foreach (var x in indexList.Entries) { str1 = str1 + x; } var str2 = ""; if (indexList.Any()) { indexList.MoveFirst(); do { str2 = str2 + indexList.Value; } while (indexList.MoveNext()); } output.WriteLine("str1:{0} str2:{1}", str1, str2); Assert.True(str1 == str2); }
protected override void BuildData() { VertexList.AddRange(new Vector3[] { new Vector3(.5f, -.5f, .5f), new Vector3(-.5f, -.5f, .5f), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0), new Vector3(.5f, -.5f, -.5f), new Vector3(-.5f, -.5f, -.5f), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0), new Vector3(.5f, -.5f, -.5f), new Vector3(-.5f, -.5f, -.5f), new Vector3(-.5f, -.5f, .5f), new Vector3(.5f, -.5f, .5f), new Vector3(-.5f, -.5f, .5f), new Vector3(-.5f, -.5f, -.5f), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0), new Vector3(.5f, -.5f, .5f), new Vector3(.5f, -.5f, -.5f), new Vector3(0, .5f, 0), new Vector3(0, .5f, 0) }); NormalList.AddRange(new Vector3[] { Vector3.Backward + Vector3.Up, Vector3.Backward + Vector3.Up, Vector3.Backward + Vector3.Up, Vector3.Backward + Vector3.Up, Vector3.Forward + Vector3.Up, Vector3.Forward + Vector3.Up, Vector3.Forward + Vector3.Up, Vector3.Forward + Vector3.Up, Vector3.Up, Vector3.Up, Vector3.Up, Vector3.Up, Vector3.Down, Vector3.Down, Vector3.Down, Vector3.Down, Vector3.Left + Vector3.Up, Vector3.Left + Vector3.Up, Vector3.Left + Vector3.Up, Vector3.Left + Vector3.Up, Vector3.Right + Vector3.Up, Vector3.Right + Vector3.Up, Vector3.Right + Vector3.Up, Vector3.Right + Vector3.Up, }); TexCoordList.AddRange(new Vector2[] { new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0), new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0), new Vector2(0, 1), new Vector2(1, 1), new Vector2(1, 0), new Vector2(0, 0), }); ColorList.AddRange(new Color[] { Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, }); IndexList.AddRange(new int[] { 0, 1, 2, 2, 3, 0, // Front 4, 7, 6, 6, 5, 4, // Back 8, 11, 10, 10, 9, 8, // Top 12, 13, 14, 14, 15, 12, // Bottom 16, 17, 18, 18, 19, 16, // Left 20, 23, 22, 22, 21, 20, // Right }); CalculateTangents(); }
public ITempTable Indexes(params string[] indexes) { if (indexes == null) { throw new ArgumentException($"{indexes} is null"); } IndexList.AddRange(indexes); return(this); }
protected override void BuildData() { VertexList.AddRange(new Vector3[] { new Vector3(-0.4755286f, -1f, -0.1545086f), new Vector3(-0.4045088f, -1f, -0.2938928f), new Vector3(-0.2938928f, -1f, -0.4045087f), new Vector3(-0.1545086f, -1f, -0.4755285f), new Vector3(0f, -1f, -0.5000002f), new Vector3(0.1545086f, -1f, -0.4755285f), new Vector3(0.2938927f, -1f, -0.4045087f), new Vector3(0.4045086f, -1f, -0.2938927f), new Vector3(0.4755284f, -1f, -0.1545085f), new Vector3(0.5000001f, -1f, 0f), new Vector3(0.4755284f, -1f, 0.1545085f), new Vector3(0.4045086f, -1f, 0.2938927f), new Vector3(0.2938927f, -1f, 0.4045086f), new Vector3(0.1545085f, -1f, 0.4755283f), new Vector3(1.490116E-08f, -1f, 0.5000001f), new Vector3(-0.1545085f, -1f, 0.4755283f), new Vector3(-0.2938926f, -1f, 0.4045085f), new Vector3(-0.4045085f, -1f, 0.2938927f), new Vector3(-0.4755283f, -1f, 0.1545085f), new Vector3(-0.5f, -1f, 0f), new Vector3(-0.4755286f, 1f, -0.1545086f), new Vector3(-0.4045088f, 1f, -0.2938928f), new Vector3(-0.2938928f, 1f, -0.4045087f), new Vector3(-0.1545086f, 1f, -0.4755285f), new Vector3(0f, 1f, -0.5000002f), new Vector3(0.1545086f, 1f, -0.4755285f), new Vector3(0.2938927f, 1f, -0.4045087f), new Vector3(0.4045086f, 1f, -0.2938927f), new Vector3(0.4755284f, 1f, -0.1545085f), new Vector3(0.5000001f, 1f, 0f), new Vector3(0.4755284f, 1f, 0.1545085f), new Vector3(0.4045086f, 1f, 0.2938927f), new Vector3(0.2938927f, 1f, 0.4045086f), new Vector3(0.1545085f, 1f, 0.4755283f), new Vector3(1.490116E-08f, 1f, 0.5000001f), new Vector3(-0.1545085f, 1f, 0.4755283f), new Vector3(-0.2938926f, 1f, 0.4045085f), new Vector3(-0.4045085f, 1f, 0.2938927f), new Vector3(-0.4755283f, 1f, 0.1545085f), new Vector3(-0.5f, 1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0.5000001f, -1f, 0f), new Vector3(0.5000001f, 1f, 0f), new Vector3(-0.5f, -1f, 0f), new Vector3(-0.4755286f, 1f, -0.1545086f), new Vector3(-0.4755286f, -1f, -0.1545086f), new Vector3(-0.5f, 1f, 0f), new Vector3(-0.4045088f, -1f, -0.2938928f), new Vector3(-0.4755286f, -1f, -0.1545086f), new Vector3(-0.2938928f, -1f, -0.4045087f), new Vector3(-0.1545086f, -1f, -0.4755285f), new Vector3(0f, -1f, -0.5000002f), new Vector3(0.1545086f, -1f, -0.4755285f), new Vector3(0.2938927f, -1f, -0.4045087f), new Vector3(0.4045086f, -1f, -0.2938927f), new Vector3(0.4755284f, -1f, -0.1545085f), new Vector3(0.5000001f, -1f, 0f), new Vector3(0.4755284f, -1f, 0.1545085f), new Vector3(0.4045086f, -1f, 0.2938927f), new Vector3(0.2938927f, -1f, 0.4045086f), new Vector3(0.1545085f, -1f, 0.4755283f), new Vector3(1.490116E-08f, -1f, 0.5000001f), new Vector3(-0.1545085f, -1f, 0.4755283f), new Vector3(-0.2938926f, -1f, 0.4045085f), new Vector3(-0.4045085f, -1f, 0.2938927f), new Vector3(-0.4755283f, -1f, 0.1545085f), new Vector3(-0.5f, -1f, 0f), new Vector3(-0.4755286f, 1f, -0.1545086f), new Vector3(-0.4045088f, 1f, -0.2938928f), new Vector3(-0.2938928f, 1f, -0.4045087f), new Vector3(-0.1545086f, 1f, -0.4755285f), new Vector3(0f, 1f, -0.5000002f), new Vector3(0.1545086f, 1f, -0.4755285f), new Vector3(0.2938927f, 1f, -0.4045087f), new Vector3(0.4045086f, 1f, -0.2938927f), new Vector3(0.4755284f, 1f, -0.1545085f), new Vector3(0.5000001f, 1f, 0f), new Vector3(0.4755284f, 1f, 0.1545085f), new Vector3(0.4045086f, 1f, 0.2938927f), new Vector3(0.2938927f, 1f, 0.4045086f), new Vector3(0.1545085f, 1f, 0.4755283f), new Vector3(1.490116E-08f, 1f, 0.5000001f), new Vector3(-0.1545085f, 1f, 0.4755283f), new Vector3(-0.2938926f, 1f, 0.4045085f), new Vector3(-0.4045085f, 1f, 0.2938927f), new Vector3(-0.4755283f, 1f, 0.1545085f), new Vector3(-0.5f, 1f, 0f), }); NormalList.AddRange(new Vector3[] { new Vector3(-0.9334423f, 0f, -0.3587276f), new Vector3(-0.776903f, 0f, -0.6296204f), new Vector3(-0.5443152f, 0f, -0.8388808f), new Vector3(-0.258446f, 0f, -0.9660257f), new Vector3(0.05272146f, 0f, -0.9986092f), new Vector3(0.3587284f, 0f, -0.933442f), new Vector3(0.6296204f, 0f, -0.7769028f), new Vector3(0.8388808f, 0f, -0.5443152f), new Vector3(0.9660257f, 0f, -0.2584461f), new Vector3(0.9986093f, 0f, 0.05272135f), new Vector3(0.933442f, 0f, 0.3587283f), new Vector3(0.7769029f, 0f, 0.6296204f), new Vector3(0.5443153f, 0f, 0.8388808f), new Vector3(0.2584461f, 0f, 0.9660256f), new Vector3(-0.05272149f, 0f, 0.9986092f), new Vector3(-0.3587283f, 0f, 0.933442f), new Vector3(-0.6296203f, 0f, 0.776903f), new Vector3(-0.8388807f, 0f, 0.5443153f), new Vector3(-0.9660256f, 0f, 0.2584462f), new Vector3(-0.9986093f, 0f, -0.05272005f), new Vector3(-0.9660261f, 0f, -0.2584449f), new Vector3(-0.8388807f, 0f, -0.5443153f), new Vector3(-0.6296201f, 0f, -0.7769031f), new Vector3(-0.3587281f, 0f, -0.9334421f), new Vector3(-0.05272127f, 0f, -0.9986093f), new Vector3(0.2584463f, 0f, -0.9660256f), new Vector3(0.5443155f, 0f, -0.8388806f), new Vector3(0.7769032f, 0f, -0.6296201f), new Vector3(0.9334421f, 0f, -0.3587282f), new Vector3(0.9986093f, 0f, -0.05272135f), new Vector3(0.9660256f, 0f, 0.2584462f), new Vector3(0.8388806f, 0f, 0.5443155f), new Vector3(0.6296202f, 0f, 0.7769031f), new Vector3(0.3587282f, 0f, 0.9334421f), new Vector3(0.05272129f, 0f, 0.9986093f), new Vector3(-0.2584463f, 0f, 0.9660256f), new Vector3(-0.5443153f, 0f, 0.8388807f), new Vector3(-0.776903f, 0f, 0.6296203f), new Vector3(-0.9334421f, 0f, 0.3587282f), new Vector3(-0.9986092f, 0f, 0.05272201f), new Vector3(0f, -1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0.9986093f, 0f, 0.05272135f), new Vector3(0.9986093f, 0f, -0.05272135f), new Vector3(-0.9986093f, 0f, -0.05272005f), new Vector3(-0.9660261f, 0f, -0.2584449f), new Vector3(-0.9334423f, 0f, -0.3587276f), new Vector3(-0.9986092f, 0f, 0.05272201f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, -1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 1f, 0f), }); for (int v = 0; v < VertexList.Count; v++) { ColorList.Add(Color.White); } TexCoordList.AddRange(new Vector2[] { new Vector2(0.1005999f, 0.0004537381f), new Vector2(0.2005054f, 0.0004537381f), new Vector2(0.300411f, 0.0004537381f), new Vector2(0.4003165f, 0.0004537381f), new Vector2(0.500222f, 0.0004537381f), new Vector2(0.6001273f, 0.0004537381f), new Vector2(0.7000327f, 0.0004537381f), new Vector2(0.799938f, 0.0004537381f), new Vector2(0.8998432f, 0.0004537381f), new Vector2(0.999749f, 0.0004537381f), new Vector2(0.1005993f, 0.0004537381f), new Vector2(0.200505f, 0.0004537381f), new Vector2(0.3004106f, 0.0004537381f), new Vector2(0.400316f, 0.0004537381f), new Vector2(0.5002215f, 0.0004537381f), new Vector2(0.6001268f, 0.0004537381f), new Vector2(0.7000322f, 0.0004537381f), new Vector2(0.7999375f, 0.0004537381f), new Vector2(0.8998428f, 0.0004537381f), new Vector2(0.9997481f, 0.0004537381f), new Vector2(0.1005996f, 0.9994308f), new Vector2(0.2005053f, 0.9994308f), new Vector2(0.300411f, 0.9994308f), new Vector2(0.4003165f, 0.9994308f), new Vector2(0.500222f, 0.9994308f), new Vector2(0.6001273f, 0.9994308f), new Vector2(0.7000328f, 0.9994308f), new Vector2(0.7999381f, 0.9994308f), new Vector2(0.8998435f, 0.9994308f), new Vector2(0.9997491f, 0.9994308f), new Vector2(0.1005996f, 0.9994308f), new Vector2(0.2005051f, 0.9994308f), new Vector2(0.3004106f, 0.9994308f), new Vector2(0.400316f, 0.9994308f), new Vector2(0.5002215f, 0.9994308f), new Vector2(0.6001268f, 0.9994308f), new Vector2(0.7000321f, 0.9994308f), new Vector2(0.7999371f, 0.9994308f), new Vector2(0.8998424f, 0.9994308f), new Vector2(0.9997478f, 0.9994308f), new Vector2(0.5002239f, 0.4999443f), new Vector2(0.5002245f, 0.4999442f), new Vector2(0.0006936856f, 0.0004537381f), new Vector2(0.0006940446f, 0.9994308f), new Vector2(0.00069427f, 0.0004537381f), new Vector2(0.1005996f, 0.9994308f), new Vector2(0.1005999f, 0.0004537381f), new Vector2(0.0006939089f, 0.9994308f), new Vector2(0.0988569f, 0.7915539f), new Vector2(0.02838877f, 0.6532523f), new Vector2(0.2086136f, 0.9013107f), new Vector2(0.3469154f, 0.971779f), new Vector2(0.500224f, 0.9960608f), new Vector2(0.6535327f, 0.971779f), new Vector2(0.7918344f, 0.9013106f), new Vector2(0.901591f, 0.7915536f), new Vector2(0.9720588f, 0.6532521f), new Vector2(0.9963405f, 0.4999437f), new Vector2(0.9720586f, 0.3466355f), new Vector2(0.9015904f, 0.2083341f), new Vector2(0.7918337f, 0.09857755f), new Vector2(0.653532f, 0.02810944f), new Vector2(0.5002234f, 0.003827875f), new Vector2(0.346915f, 0.02810972f), new Vector2(0.2086136f, 0.09857795f), new Vector2(0.09885708f, 0.2083347f), new Vector2(0.02838913f, 0.3466361f), new Vector2(0.004107505f, 0.4999442f), new Vector2(0.9720596f, 0.6532523f), new Vector2(0.9015915f, 0.7915539f), new Vector2(0.7918347f, 0.9013107f), new Vector2(0.653533f, 0.971779f), new Vector2(0.5002243f, 0.9960608f), new Vector2(0.3469157f, 0.971779f), new Vector2(0.2086142f, 0.9013106f), new Vector2(0.0988576f, 0.7915537f), new Vector2(0.0283896f, 0.6532522f), new Vector2(0.004108027f, 0.4999439f), new Vector2(0.02838971f, 0.3466356f), new Vector2(0.09885782f, 0.2083341f), new Vector2(0.2086144f, 0.09857755f), new Vector2(0.3469159f, 0.02810938f), new Vector2(0.5002242f, 0.003827723f), new Vector2(0.6535327f, 0.02810941f), new Vector2(0.7918344f, 0.09857755f), new Vector2(0.901591f, 0.2083343f), new Vector2(0.9720591f, 0.3466357f), new Vector2(0.9963408f, 0.4999439f), }); IndexList.AddRange(new int[] { 0, 21, 1, 0, 20, 21, 1, 21, 22, 1, 22, 2, 2, 22, 23, 2, 23, 3, 3, 23, 24, 3, 24, 4, 4, 24, 25, 4, 25, 5, 5, 25, 26, 5, 26, 6, 6, 26, 27, 6, 27, 7, 7, 27, 28, 7, 28, 8, 8, 28, 29, 8, 29, 9, 42, 30, 10, 42, 43, 30, 10, 30, 31, 10, 31, 11, 11, 31, 32, 11, 32, 12, 12, 32, 33, 12, 33, 13, 13, 33, 34, 13, 34, 14, 14, 34, 35, 14, 35, 15, 15, 35, 36, 15, 36, 16, 16, 36, 37, 16, 37, 17, 17, 37, 38, 17, 38, 18, 18, 38, 39, 18, 39, 19, 44, 45, 46, 44, 47, 45, 48, 40, 49, 50, 40, 48, 51, 40, 50, 52, 40, 51, 53, 40, 52, 54, 40, 53, 55, 40, 54, 56, 40, 55, 57, 40, 56, 58, 40, 57, 59, 40, 58, 60, 40, 59, 61, 40, 60, 62, 40, 61, 63, 40, 62, 64, 40, 63, 65, 40, 64, 66, 40, 65, 67, 40, 66, 49, 40, 67, 68, 41, 69, 69, 41, 70, 70, 41, 71, 71, 41, 72, 72, 41, 73, 73, 41, 74, 74, 41, 75, 75, 41, 76, 76, 41, 77, 77, 41, 78, 78, 41, 79, 79, 41, 80, 80, 41, 81, 81, 41, 82, 82, 41, 83, 83, 41, 84, 84, 41, 85, 85, 41, 86, 86, 41, 87, 87, 41, 68, }); IndexList.Reverse(); CalculateTangents(); }
private IndexList BuildSortIndex(SortColumnCollection col) { IndexList arrayList = new IndexList(); PropertyDescriptor[] sortProperties = BuildSortProperties(col); for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++) { object rowItem = this.baseList[rowIndex]; object[] values = new object[col.Count]; // Hier bereits Wertabruf um dies nicht während des Sortierens tun zu müssen. for (int criteriaIndex = 0; criteriaIndex < sortProperties.Length; criteriaIndex++) { object value = sortProperties[criteriaIndex].GetValue(rowItem); // Hier auf Verträglichkeit testen um Vergleiche bei Sortierung zu vereinfachen. // Muss IComparable und gleicher Typ sein. if (value != null && value != DBNull.Value) { if (!(value is IComparable)) { throw new InvalidOperationException("ReportDataSource:BuildSortArray - > This type doesn't support IComparable." + value.ToString()); } values[criteriaIndex] = value; } } arrayList.Add(new SortComparer(col, rowIndex, values)); } if (arrayList[0].ObjectArray.GetLength(0) == 1) { List <BaseComparer> lbc = BaseListStrategy.GenericSorter(arrayList); arrayList.Clear(); arrayList.AddRange(lbc); } else { arrayList.Sort(); } return(arrayList); }
protected override void BuildData() { int SquareSize = 10; int[] index = new int[(SquareSize - 1) * (SquareSize - 1) * 6]; Vector2 uv = Vector2.Zero; Vector3 center = new Vector3(SquareSize, 0, SquareSize) * .5f; for (int x = 0; x < SquareSize; x++) { for (int y = 0; y < SquareSize; y++) { uv = new Vector2(x, y) / (float)(SquareSize - 1); VertexList.Add(new Vector3(x, 0, y) - center); NormalList.Add(Vector3.Up); TexCoordList.Add(uv); ColorList.Add(Color.White); } } for (int x = 0; x < SquareSize - 1; x++) { for (int y = 0; y < SquareSize - 1; y++) { index[(x + y * (SquareSize - 1)) * 6] = ((x + 1) + (y + 1) * SquareSize); index[(x + y * (SquareSize - 1)) * 6 + 1] = ((x + 1) + y * SquareSize); index[(x + y * (SquareSize - 1)) * 6 + 2] = (x + y * SquareSize); index[(x + y * (SquareSize - 1)) * 6 + 3] = ((x + 1) + (y + 1) * SquareSize); index[(x + y * (SquareSize - 1)) * 6 + 4] = (x + y * SquareSize); index[(x + y * (SquareSize - 1)) * 6 + 5] = (x + (y + 1) * SquareSize); } } IndexList.AddRange(index); CalculateTangents(); }
private IndexList BuildSortIndex(ColumnCollection col) { IndexList arrayList = new IndexList(); for (int rowIndex = 0; rowIndex < this.table.Rows.Count; rowIndex++) { DataRow rowItem = this.table.Rows[rowIndex]; object[] values = new object[col.Count]; for (int criteriaIndex = 0; criteriaIndex < col.Count; criteriaIndex++) { object value = ExtractColumnValue(rowItem, col, criteriaIndex); if (value != null && value != DBNull.Value) { values[criteriaIndex] = value; } else { values[criteriaIndex] = DBNull.Value; } } arrayList.Add(new SortComparer(col, rowIndex, values)); } if (arrayList[0].ObjectArray.GetLength(0) == 1) { List <BaseComparer> lbc = BaseListStrategy.GenericSorter(arrayList); arrayList.Clear(); arrayList.AddRange(lbc); } else { arrayList.Sort(); } return(arrayList); }
public void SetupVertices(PmxVertexData[] vertices, IEnumerable <int> indices, IEnumerable <int> faceCount, int boneCount) { List <int> convertedIndices = (from index in indices select index + VertexList.Count).ToList(); IndexList.AddRange(convertedIndices); int total = 0; foreach (int count in faceCount) { IndexOfEachMaterialList.Add(convertedIndices.GetRange(total, count)); total += count; } foreach (var vertex in vertices) { vertex.VertexId = VertexList.Count; for (int i = 0; i < vertex.BoneId.Length; i++) { vertex.BoneId[i] += boneCount; } VertexList.Add(vertex); } }
private IndexList BuildSortIndex(SortColumnCollection col) { IndexList arrayList = new IndexList(); PropertyDescriptor[] sortProperties = BuildSortProperties (col); for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++){ object rowItem = this.baseList[rowIndex]; object[] values = new object[col.Count]; // Hier bereits Wertabruf um dies nicht während des Sortierens tun zu müssen. for (int criteriaIndex = 0; criteriaIndex < sortProperties.Length; criteriaIndex++){ object value = sortProperties[criteriaIndex].GetValue(rowItem); // Hier auf Verträglichkeit testen um Vergleiche bei Sortierung zu vereinfachen. // Muss IComparable und gleicher Typ sein. if (value != null && value != DBNull.Value) { if (!(value is IComparable)){ throw new InvalidOperationException("ReportDataSource:BuildSortArray - > This type doesn't support IComparable." + value.ToString()); } values[criteriaIndex] = value; } } arrayList.Add(new SortComparer(col, rowIndex, values)); } if (arrayList[0].ObjectArray.GetLength(0) == 1) { List<BaseComparer> lbc = BaseListStrategy.GenericSorter (arrayList); arrayList.Clear(); arrayList.AddRange(lbc); } else { arrayList.Sort(); } return arrayList; }
private IndexList BuildSortIndex(ColumnCollection col) { IndexList arrayList = new IndexList(); for (int rowIndex = 0; rowIndex < this.table.Rows.Count; rowIndex++){ DataRow rowItem = this.table.Rows[rowIndex]; object[] values = new object[col.Count]; for (int criteriaIndex = 0; criteriaIndex < col.Count; criteriaIndex++) { object value = ExtractColumnValue(rowItem,col,criteriaIndex); if (value != null && value != DBNull.Value) { values[criteriaIndex] = value; } else { values[criteriaIndex] = DBNull.Value; } } arrayList.Add(new SortComparer(col, rowIndex, values)); } if (arrayList[0].ObjectArray.GetLength(0) == 1) { List<BaseComparer> lbc = BaseListStrategy.GenericSorter (arrayList); arrayList.Clear(); arrayList.AddRange(lbc); } else { arrayList.Sort(); } return arrayList; }
private void SetupShotModelData(ShotModelData data) { int[] indices = Array.ConvertAll(data.Indices, i => i + VertexList.Count); IndexList.AddRange(indices); PmxVertexData[] vertices = data.Vertices; foreach (var vertex in vertices) { vertex.VertexId = VertexList.Count; vertex.BoneId = Array.ConvertAll(vertex.BoneId, i => i + BoneList.Count); VertexList.Add(vertex); } PmxMaterialData[] materials = data.Materials; PmxMorphData morph = data.MaterialMorph; morph.MorphName = data.Property.Type.Name[0] + MorphList.Count.ToString(); morph.Type = 4; morph.MorphArray = ArrayUtil.Set(new PmxMorphMaterialData[materials.Length], i => new PmxMorphMaterialData()); for (int i = 0; i < materials.Length; i++) { morph.MorphArray[i].Index = MaterialList.Count + i; morph.MorphId = MorphList.Count + i; } MorphList.Add(morph); string[] textures = data.Textures; foreach (var texture in textures) { if (!TextureList.Contains(texture)) { TextureList.Add(texture); } } foreach (PmxMaterialData material in materials) { material.MaterialName = data.Property.Type.Name[0] + MaterialList.Count.ToString(); if (0 <= material.TextureId && material.TextureId < textures.Length) { material.TextureId = TextureList.IndexOf(textures[material.TextureId]); } else { material.TextureId = -1; } if (0 <= material.SphereId && material.SphereId < textures.Length) { material.SphereId = TextureList.IndexOf(textures[material.SphereId]); } else { material.SphereId = -1; } material.MaterialId = MaterialList.Count; MaterialList.Add(material); } SetupBone(data, data.Bones); ModelDataList.Add(data); }