Last change
on this file since 1171 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
|
Rev | Line | |
---|
[1114] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Globalization;
|
---|
| 4 |
|
---|
| 5 | namespace Oni.Totoro
|
---|
| 6 | {
|
---|
| 7 | internal class BodyDaeImporter
|
---|
| 8 | {
|
---|
| 9 | private readonly bool generateNormals;
|
---|
| 10 | private readonly bool flatNormals;
|
---|
| 11 | private readonly float shellOffset;
|
---|
| 12 |
|
---|
| 13 | public BodyDaeImporter(string[] args)
|
---|
| 14 | {
|
---|
| 15 | foreach (string arg in args)
|
---|
| 16 | {
|
---|
| 17 | if (arg == "-normals")
|
---|
| 18 | {
|
---|
| 19 | generateNormals = true;
|
---|
| 20 | }
|
---|
| 21 | else if (arg == "-flat")
|
---|
| 22 | {
|
---|
| 23 | flatNormals = true;
|
---|
| 24 | }
|
---|
| 25 | else if (arg == "-cel" || arg.StartsWith("-cel:", StringComparison.Ordinal))
|
---|
| 26 | {
|
---|
| 27 | int i = arg.IndexOf(':');
|
---|
| 28 |
|
---|
| 29 | if (i != -1)
|
---|
| 30 | shellOffset = float.Parse(arg.Substring(i + 1), CultureInfo.InvariantCulture);
|
---|
| 31 | else
|
---|
| 32 | shellOffset = 0.07f;
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public ImporterDescriptor Import(string filePath, ImporterFile importer)
|
---|
| 38 | {
|
---|
| 39 | var scene = Dae.Reader.ReadFile(filePath);
|
---|
| 40 |
|
---|
| 41 | Dae.FaceConverter.Triangulate(scene);
|
---|
| 42 |
|
---|
| 43 | var body = BodyDaeReader.Read(scene, generateNormals, flatNormals, shellOffset);
|
---|
| 44 |
|
---|
| 45 | return BodyDatWriter.Write(body, importer);
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.