[Archive] [Development] WoW Model Lib
[Archive] [Development] WoW Model Lib
Quote: Hello everybody!
At the moment im creating a .NET Interface for everyone of you capable using C#, VB.NET, J# or CLI/C++. It will give you very simple classes und functions to render wow models, change the models (e.g. the vertices) and save the models. Also it will contain a directX renderer that creates very simple context to render into form-controls. The other part is an interface to deal with MPQ-files without big overhead!
Here are some examples:
1. Loading a listfile of a MPQ:
Code:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
WoWRender.MpqHandler m_handler;
private void button1_Click(object sender, EventArgs e)
{
if(m_handler == null)
m_handler = new WoWRender.MpqHandler();
listBox1.Items.Clear();
openFileDialog1.ShowDialog();
string fName = openFileDialog1.FileName;
if (fName == "")
return;
m_handler.AddArchive(fName, false);
string[] files = m_handler.GetFileList(fName);
if (files == null)
return;
foreach (string s in files)
{
listBox1.Items.Add(s);
}
}
}
2. Modifying a .M2-file:
Code:
MpqHandler handler = new MpqHandler();
handler.AddArchive("data\\expansion.MPQ", true);
handler.AddArchive("data\\common.MPQ", true);
handler.AddArchive("data\\common-2.MPQ", true);
handler.AddArchive("data\\patch.MPQ", true);
handler.AddArchive("data\\patch-2.MPQ", true);
handler.AddArchive("data\\lichking.MPQ", true);
ModelCreator creator = new ModelCreator(handler, null);
model = creator.CreateModel(@"World\Expansion02\Doodads\DragonBlight\DragonBlight_Tree01.m2");
foreach (Vertex v in model.Vertices)
{
v.X *= 2.0f;
v.Y *= 2.0f;
v.Z *= 2.0f;
}
model.Save("C:\\Programme\\Tree.m2");
3. Render and animate a .M2 model:
Code:
namespace RenderTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
WoWRender.WoWRenderMgr mgr;
M2Model model;
private void Form1_Load(object sender, EventArgs e)
{
mgr = new WoWRender.WoWRenderMgr(panel1);
mgr.OnRender += new WoWRender.WoWRenderHandler(OnRender);
MpqHandler handler = new MpqHandler();
handler.AddArchive("data\\expansion.MPQ", true);
handler.AddArchive("data\\common.MPQ", true);
handler.AddArchive("data\\common-2.MPQ", true);
handler.AddArchive("data\\patch.MPQ", true);
handler.AddArchive("data\\patch-2.MPQ", true);
handler.AddArchive("data\\lichking.MPQ", true);
ModelCreator creator = new ModelCreator(handler, mgr);
model = creator.CreateModel(@"World\Expansion02\Doodads\DragonBlight\DragonBlight_Tree01.m2");
model.Effects.ScaleX *= 0.2f;
model.Effects.ScaleY *= 0.2f;
model.Effects.ScaleZ *= 0.2f;
model.RenderContext = mgr;
mgr.BeginRender();
}
private void OnRender()
{
if (model != null)
{
model.Effects.ScaleX *= 1.01f;
model.Effects.ScaleY *= 1.01f;
model.Effects.ScaleZ *= 1.01f;
model.Render();
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
mgr.EndRender();
}
private void button1_Click(object sender, EventArgs e)
{
mgr.BackgroundColor = Color.Blue;
}
}
}
Before the first release i need to implement some more threadsecurity and some more exceptions need to be thrown.
I hope that there will be more people acting in Modelediting if they get a easy library to modify and display the models!
Of course it will contain also support for ADT files so you will be able to change vertices for maps (no limit for exploitation, as it will allow every ADT in the game to be changed).
Greetings
Cromon
Archived author: Cromon • Posted: 2025-11-04T11:54:14.698088
Original source
Quote: Hello everybody!
At the moment im creating a .NET Interface for everyone of you capable using C#, VB.NET, J# or CLI/C++. It will give you very simple classes und functions to render wow models, change the models (e.g. the vertices) and save the models. Also it will contain a directX renderer that creates very simple context to render into form-controls. The other part is an interface to deal with MPQ-files without big overhead!
Here are some examples:
1. Loading a listfile of a MPQ:
Code:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
WoWRender.MpqHandler m_handler;
private void button1_Click(object sender, EventArgs e)
{
if(m_handler == null)
m_handler = new WoWRender.MpqHandler();
listBox1.Items.Clear();
openFileDialog1.ShowDialog();
string fName = openFileDialog1.FileName;
if (fName == "")
return;
m_handler.AddArchive(fName, false);
string[] files = m_handler.GetFileList(fName);
if (files == null)
return;
foreach (string s in files)
{
listBox1.Items.Add(s);
}
}
}
2. Modifying a .M2-file:
Code:
MpqHandler handler = new MpqHandler();
handler.AddArchive("data\\expansion.MPQ", true);
handler.AddArchive("data\\common.MPQ", true);
handler.AddArchive("data\\common-2.MPQ", true);
handler.AddArchive("data\\patch.MPQ", true);
handler.AddArchive("data\\patch-2.MPQ", true);
handler.AddArchive("data\\lichking.MPQ", true);
ModelCreator creator = new ModelCreator(handler, null);
model = creator.CreateModel(@"World\Expansion02\Doodads\DragonBlight\DragonBlight_Tree01.m2");
foreach (Vertex v in model.Vertices)
{
v.X *= 2.0f;
v.Y *= 2.0f;
v.Z *= 2.0f;
}
model.Save("C:\\Programme\\Tree.m2");
3. Render and animate a .M2 model:
Code:
namespace RenderTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
WoWRender.WoWRenderMgr mgr;
M2Model model;
private void Form1_Load(object sender, EventArgs e)
{
mgr = new WoWRender.WoWRenderMgr(panel1);
mgr.OnRender += new WoWRender.WoWRenderHandler(OnRender);
MpqHandler handler = new MpqHandler();
handler.AddArchive("data\\expansion.MPQ", true);
handler.AddArchive("data\\common.MPQ", true);
handler.AddArchive("data\\common-2.MPQ", true);
handler.AddArchive("data\\patch.MPQ", true);
handler.AddArchive("data\\patch-2.MPQ", true);
handler.AddArchive("data\\lichking.MPQ", true);
ModelCreator creator = new ModelCreator(handler, mgr);
model = creator.CreateModel(@"World\Expansion02\Doodads\DragonBlight\DragonBlight_Tree01.m2");
model.Effects.ScaleX *= 0.2f;
model.Effects.ScaleY *= 0.2f;
model.Effects.ScaleZ *= 0.2f;
model.RenderContext = mgr;
mgr.BeginRender();
}
private void OnRender()
{
if (model != null)
{
model.Effects.ScaleX *= 1.01f;
model.Effects.ScaleY *= 1.01f;
model.Effects.ScaleZ *= 1.01f;
model.Render();
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
mgr.EndRender();
}
private void button1_Click(object sender, EventArgs e)
{
mgr.BackgroundColor = Color.Blue;
}
}
}
Before the first release i need to implement some more threadsecurity and some more exceptions need to be thrown.
I hope that there will be more people acting in Modelediting if they get a easy library to modify and display the models!
Of course it will contain also support for ADT files so you will be able to change vertices for maps (no limit for exploitation, as it will allow every ADT in the game to be changed).
Greetings
Cromon
Quote:Hey, this is awesome, keep it up! 4x +Rep from me
Archived author: Ravenheart • Posted: 2025-11-04T11:54:14.698088
Original source
Quote:Hey, this is awesome, keep it up! 4x +Rep from me
Quote: looks interesting. cant rep to this thread
Archived author: piller • Posted: 2025-11-04T11:54:14.698088
Original source
Quote: looks interesting. cant rep to this thread
Quote:Awsomei maybe start with model editing more serious when this release =3 cant rep tho :/
Archived author: Mitron • Posted: 2025-11-04T11:54:14.698088
Original source
Quote:Awsomei maybe start with model editing more serious when this release =3 cant rep tho :/
Quote: Hmm, you got this working with m2 viewdistance and collision? (For world objects?) would be awsome
(the tools we have now are not working proberly, and to make 1 object with collision and viewdistance we need 4-5 diffrent tools :S)
but +rep for the great work so far
Archived author: Bjarke • Posted: 2025-11-04T11:54:14.698088
Original source
Quote: Hmm, you got this working with m2 viewdistance and collision? (For world objects?) would be awsome
(the tools we have now are not working proberly, and to make 1 object with collision and viewdistance we need 4-5 diffrent tools :S)
but +rep for the great work so far
Quote: Collision and viewdistance actually allready work in yiasedit if you spawn an MDX into a tile and it only intersects the spawntile. As im atm calculating the bbox of the models itll be easy to calc the appropriate MCRF for the models.
Archived author: Cromon • Posted: 2025-11-04T11:54:14.698088
Original source
Quote: Collision and viewdistance actually allready work in yiasedit if you spawn an MDX into a tile and it only intersects the spawntile. As im atm calculating the bbox of the models itll be easy to calc the appropriate MCRF for the models.
Quote: Cromon: We are not talking about the MCRF here.
Once again: Why did you make another lib if there already is one? ._. Yay.
Archived author: schlumpf • Posted: 2025-11-04T11:54:14.698088
Original source
Quote: Cromon: We are not talking about the MCRF here.
Once again: Why did you make another lib if there already is one? ._. Yay.
Quote: MCRF -> collision, no MCRF -> no collision. If you mean another collision just tell
Well, why do we make another computergame? There is already one. Why do we make another car? There is already one. Why do we make a new computer, there is already one? Why do we make new mobile phones, there is already one?
Archived author: Cromon • Posted: 2025-11-04T11:54:14.698088
Original source
Quote: MCRF -> collision, no MCRF -> no collision. If you mean another collision just tell
Well, why do we make another computergame? There is already one. Why do we make another car? There is already one. Why do we make a new computer, there is already one? Why do we make new mobile phones, there is already one?
Quote: ._. M2.Header.floats
Archived author: schlumpf • Posted: 2025-11-04T11:54:14.698088
Original source
Quote: ._. M2.Header.floats
Quote: Ah, kk, thanks, will include that.
Archived author: Cromon • Posted: 2025-11-04T11:54:14.698088
Original source
Quote: Ah, kk, thanks, will include that.