public UInt32 createTriangleMesh( Tuple <double, double, double>[] P, Tuple <UInt32, UInt32, UInt32>[] PI, Tuple <double, double, double>[] N, Tuple <UInt32, UInt32, UInt32>[] NI) { if (PI.Length != NI.Length) { throw new InvalidOperationException(); } var tess = new PRC3DTess(); var tessFace = new PRCTessFace(); tessFace.used_entities_flag = PRCTessFace.PRC_FACETESSDATA_Triangle; tessFace.number_of_texture_coordinate_indexes = 0; foreach (var p in P) { tess.coordinates.Add(p.Item1); tess.coordinates.Add(p.Item2); tess.coordinates.Add(p.Item3); } foreach (var p in N) { tess.normal_coordinate.Add(p.Item1); tess.normal_coordinate.Add(p.Item2); tess.normal_coordinate.Add(p.Item3); } for (int i = 0; i < PI.Length; i++) { tess.triangulated_index.Add(3 * NI[i].Item1); tess.triangulated_index.Add(3 * PI[i].Item1); tess.triangulated_index.Add(3 * NI[i].Item2); tess.triangulated_index.Add(3 * PI[i].Item2); tess.triangulated_index.Add(3 * NI[i].Item3); tess.triangulated_index.Add(3 * PI[i].Item3); } tessFace.sizes_triangulated.Add((UInt32)PI.Length); tess.face_tessellation.Add(tessFace); _tessellations.Add(tess); return((UInt32)(_tessellations.Count - 1)); }
public void SerializeContentTessFace(PRCTessFace t) { WriteUint32(PRCType.PRC_TYPE_TESS_Face); WriteUInt32List(t.line_attributes); WriteUint32(t.start_wire); WriteUInt32List(t.sizes_wire); WriteUint32(t.used_entities_flag); WriteUint32(t.start_triangulated); WriteUInt32List(t.sizes_triangulated); WriteUint32(t.number_of_texture_coordinate_indexes); WriteBool(false); //HasVertexColors = False if (t.line_attributes.Count > 0) { WriteUint32(t.behaviour); } }