summaryrefslogtreecommitdiff
path: root/TestApp/Main.cs
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-02-13 04:03:59 +0100
committerTreeki <treeki@gmail.com>2011-02-13 04:03:59 +0100
commit52aada22e106b6fd36b6b94fb3064510ac3ee40c (patch)
tree5cf5eb6866e33b023bfdaaf94ab1deb4b8ff71ab /TestApp/Main.cs
parent8b48608d45c8266b765e8ee29e612fb18376aa65 (diff)
downloadnw4rtools-52aada22e106b6fd36b6b94fb3064510ac3ee40c.tar.gz
nw4rtools-52aada22e106b6fd36b6b94fb3064510ac3ee40c.zip
it converts textures too, now! some formats missing, I'll add them later.
Diffstat (limited to '')
-rw-r--r--TestApp/Main.cs9
1 files changed, 8 insertions, 1 deletions
diff --git a/TestApp/Main.cs b/TestApp/Main.cs
index afe6dda..408c95f 100644
--- a/TestApp/Main.cs
+++ b/TestApp/Main.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.Collections.Generic;
using NW4RTools;
namespace TestApp {
@@ -7,7 +8,7 @@ namespace TestApp {
public static void Main(string[] args) {
string mdlPath = "/home/me/Games/Newer/ModelRev/";
- string mdlName = "CS_W7";
+ string mdlName = "CS_W9";
//string mdlName = "bgB_4502";
string whatever = (mdlName == "CS_W2" || mdlName == "CS_W3" || mdlName == "CS_W6") ? "a" : "";
@@ -15,6 +16,12 @@ namespace TestApp {
byte[] file = File.ReadAllBytes(mdlPath + mdlName + ".brres");
ResFile rf = BrresReader.LoadFile(file);
+ var texs = rf.GetGroup<Texture>("Textures(NW4R)");
+ // wtf C#?!
+ foreach (var kv in (IEnumerable<KeyValuePair<string,Texture>>)texs) {
+ kv.Value.BaseImage.Save(mdlPath + kv.Key + ".png");
+ }
+
//var objFile = File.Open(mdlPath + mdlName + ".obj", FileMode.OpenOrCreate);
var objFile = File.Open(mdlPath + mdlName + ".dae", FileMode.OpenOrCreate);
//var sw = new StreamWriter(objFile);