summaryrefslogtreecommitdiff
path: root/NW4RTools/Models/VertexData.cs
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-02-11 04:33:24 +0100
committerTreeki <treeki@gmail.com>2011-02-11 04:33:24 +0100
commitf6f657812c1973172d25d7895aabb37f900071a7 (patch)
tree29797b41f60113373fc7e83493bcbee72dfbfc88 /NW4RTools/Models/VertexData.cs
parent0d017deb24e7f6f8e049616a71691f1401c50b6a (diff)
downloadnw4rtools-f6f657812c1973172d25d7895aabb37f900071a7.tar.gz
nw4rtools-f6f657812c1973172d25d7895aabb37f900071a7.zip
lots of progress. semi-working Wavefront OBJ exporter
Diffstat (limited to 'NW4RTools/Models/VertexData.cs')
-rw-r--r--NW4RTools/Models/VertexData.cs49
1 files changed, 15 insertions, 34 deletions
diff --git a/NW4RTools/Models/VertexData.cs b/NW4RTools/Models/VertexData.cs
index b1f65cd..5b1a50a 100644
--- a/NW4RTools/Models/VertexData.cs
+++ b/NW4RTools/Models/VertexData.cs
@@ -1,31 +1,11 @@
using System;
namespace NW4RTools.Models {
- public enum CompCount {
- Position2 = 0,
- Position3 = 1,
- Normal3 = 0,
- Color3 = 0,
- Color4 = 1,
- TexCoord1 = 0,
- TexCoord2 = 1
- }
-
-
- public enum CompType {
- UInt8 = 0,
- Int8 = 1,
- UInt16 = 2,
- Int16 = 3,
- Float32 = 4
- }
-
-
public abstract class VertexDataBase {
public UInt32 Index;
- public CompCount ComponentCount;
- public CompType ComponentType;
+ public VertexSettings.CompCount ComponentCount;
+ public VertexSettings.CompType ComponentType;
public byte Fraction /* Not used for colours */, EntrySize;
public UInt16 EntryCount;
@@ -46,18 +26,19 @@ namespace NW4RTools.Models {
for (int i = 0; i < ret.Length; i++) {
switch (ComponentType) {
- case CompType.UInt8:
+ case VertexSettings.CompType.UInt8:
break;
- case CompType.Int8:
+ case VertexSettings.CompType.Int8:
ret[i] = (float)ins.ReadSByte() * scale;
break;
- case CompType.UInt16:
+ case VertexSettings.CompType.UInt16:
ret[i] = (float)ins.ReadUInt16() * scale;
break;
- case CompType.Int16:
+ case VertexSettings.CompType.Int16:
ret[i] = (float)ins.ReadInt16() * scale;
+ //Console.WriteLine("Output into {0}: {3:X} {1} with scale {2}", i, ret[i], scale, v);
break;
- case CompType.Float32:
+ case VertexSettings.CompType.Float32:
ret[i] = ins.ReadFloat();
break;
default:
@@ -80,9 +61,9 @@ namespace NW4RTools.Models {
public override int GetRealCount() {
switch (ComponentCount) {
- case CompCount.Position2:
+ case VertexSettings.CompCount.Position2:
return 2;
- case CompCount.Position3:
+ case VertexSettings.CompCount.Position3:
return 3;
default:
return -1;
@@ -97,7 +78,7 @@ namespace NW4RTools.Models {
public override int GetRealCount() {
switch (ComponentCount) {
- case CompCount.Normal3:
+ case VertexSettings.CompCount.Normal3:
return 3;
default:
return -1;
@@ -112,9 +93,9 @@ namespace NW4RTools.Models {
public override int GetRealCount() {
switch (ComponentCount) {
- case CompCount.Color3:
+ case VertexSettings.CompCount.Color3:
return 3;
- case CompCount.Color4:
+ case VertexSettings.CompCount.Color4:
return 4;
default:
return -1;
@@ -131,9 +112,9 @@ namespace NW4RTools.Models {
public override int GetRealCount() {
switch (ComponentCount) {
- case CompCount.TexCoord1:
+ case VertexSettings.CompCount.TexCoord1:
return 1;
- case CompCount.TexCoord2:
+ case VertexSettings.CompCount.TexCoord2:
return 2;
default:
return -1;