Last change
on this file since 1147 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.4 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 |
|
---|
4 | namespace Oni.Akira
|
---|
5 | {
|
---|
6 | internal static class OctreeBuilder
|
---|
7 | {
|
---|
8 | private static readonly BoundingBox rootBoundingBox = new BoundingBox(new Vector3(-4096.0f), new Vector3(4096.0f));
|
---|
9 |
|
---|
10 | public static OctreeNode Build(PolygonMesh mesh, bool debug)
|
---|
11 | {
|
---|
12 | IEnumerable<Polygon> polygons = mesh.Polygons;
|
---|
13 |
|
---|
14 | if (debug)
|
---|
15 | polygons = polygons.Concatenate(mesh.Ghosts);
|
---|
16 |
|
---|
17 | var root = new OctreeNode(rootBoundingBox, polygons, mesh.Rooms);
|
---|
18 | root.Build();
|
---|
19 | return root;
|
---|
20 | }
|
---|
21 |
|
---|
22 | public static OctreeNode Build(PolygonMesh mesh, GunkFlags excludeFlags)
|
---|
23 | {
|
---|
24 | var root = new OctreeNode(rootBoundingBox, mesh.Polygons.Where(p => (p.Flags & excludeFlags) == 0), mesh.Rooms);
|
---|
25 | root.Build();
|
---|
26 | return root;
|
---|
27 | }
|
---|
28 |
|
---|
29 | public static OctreeNode Build(PolygonMesh mesh, Func<Polygon, bool> polygonFilter)
|
---|
30 | {
|
---|
31 | var root = new OctreeNode(rootBoundingBox, mesh.Polygons.Where(polygonFilter), mesh.Rooms);
|
---|
32 | root.Build();
|
---|
33 | return root;
|
---|
34 | }
|
---|
35 |
|
---|
36 | public static OctreeNode BuildRoomsOctree(PolygonMesh mesh)
|
---|
37 | {
|
---|
38 | var root = new OctreeNode(rootBoundingBox, new Polygon[0], mesh.Rooms);
|
---|
39 | root.Build();
|
---|
40 | return root;
|
---|
41 | }
|
---|
42 | }
|
---|
43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.