source: OniSplit/ImporterDescriptorExtensions.cs@ 1131

Last change on this file since 1131 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 1.8 KB
RevLine 
[1114]1using System;
2using System.Collections.Generic;
3
4namespace Oni
5{
6 internal static class ImporterDescriptorExtensions
7 {
8 public static void WriteIndices(this ImporterDescriptor descriptor, int[] indices)
9 {
10 using (var writer = descriptor.OpenWrite(20))
11 {
12 writer.Write(indices.Length);
13 writer.Write(indices);
14 }
15 }
16
17 public static void WritePoints(this ImporterDescriptor descriptor, ICollection<Vector3> points)
18 {
19 var bbox = BoundingBox.CreateFromPoints(points);
20 var bsphere = BoundingSphere.CreateFromPoints(points);
21
22 using (var writer = descriptor.OpenWrite(12))
23 {
24 writer.Write(bbox);
25 writer.Write(bsphere);
26 writer.Write(points.Count);
27 writer.Write(points);
28 }
29 }
30
31 public static void WriteTexCoords(this ImporterDescriptor descriptor, ICollection<Vector2> texCoords)
32 {
33 using (var writer = descriptor.OpenWrite(20))
34 {
35 writer.Write(texCoords.Count);
36 writer.Write(texCoords);
37 }
38 }
39
40 public static void WriteVectors(this ImporterDescriptor descriptor, ICollection<Vector3> vectors)
41 {
42 using (var writer = descriptor.OpenWrite(20))
43 {
44 writer.Write(vectors.Count);
45 writer.Write(vectors);
46 }
47 }
48
49 public static void WritePlanes(this ImporterDescriptor descriptor, ICollection<Plane> planes)
50 {
51 using (var writer = descriptor.OpenWrite(20))
52 {
53 writer.Write(planes.Count);
54 writer.Write(planes);
55 }
56 }
57 }
58}
Note: See TracBrowser for help on using the repository browser.