|
@@ -32,7 +32,7 @@ namespace EQ2ModelViewer
|
|
|
|
|
|
public bool Initialize(Device device, string modelFileName, string[] textureFileName)
|
|
public bool Initialize(Device device, string modelFileName, string[] textureFileName)
|
|
{
|
|
{
|
|
- if (!LoadModel(modelFileName))
|
|
|
|
|
|
+ if (!LoadModel(modelFileName, null))
|
|
{
|
|
{
|
|
Console.WriteLine("Model: Failed to load the model");
|
|
Console.WriteLine("Model: Failed to load the model");
|
|
return false;
|
|
return false;
|
|
@@ -61,6 +61,23 @@ namespace EQ2ModelViewer
|
|
|
|
|
|
public bool Initialize(Device device, VeMeshGeometryNode item, String baseDir)
|
|
public bool Initialize(Device device, VeMeshGeometryNode item, String baseDir)
|
|
{
|
|
{
|
|
|
|
+ if (item.collisionMeshName == null || item.collisionMeshName.Length < 1)
|
|
|
|
+ {
|
|
|
|
+ Console.WriteLine("No collision mesh for MeshGeometryNode");
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ VeCollisionMesh collision = null;
|
|
|
|
+
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ Eq2Reader reader2 = new Eq2Reader(new System.IO.FileStream(frmMain.DirName + item.collisionMeshName, System.IO.FileMode.Open, System.IO.FileAccess.Read));
|
|
|
|
+ collision = (VeCollisionMesh)reader2.ReadObject();
|
|
|
|
+ reader2.Dispose();
|
|
|
|
+ }catch(Exception ex)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
ArrayList textures = new ArrayList();
|
|
ArrayList textures = new ArrayList();
|
|
|
|
|
|
string[][] meshes = ((VeMeshGeometryNode)item).renderMeshNames;
|
|
string[][] meshes = ((VeMeshGeometryNode)item).renderMeshNames;
|
|
@@ -103,7 +120,7 @@ namespace EQ2ModelViewer
|
|
{
|
|
{
|
|
textures.Add(pickedTexture);
|
|
textures.Add(pickedTexture);
|
|
|
|
|
|
- if (!LoadModel(path))
|
|
|
|
|
|
+ if (!LoadModel(path, collision))
|
|
{
|
|
{
|
|
Console.WriteLine("Model: Failed to load the model " + path);
|
|
Console.WriteLine("Model: Failed to load the model " + path);
|
|
return false;
|
|
return false;
|
|
@@ -211,7 +228,7 @@ namespace EQ2ModelViewer
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
- private bool LoadModel(string modelFileName)
|
|
|
|
|
|
+ private bool LoadModel(string modelFileName, VeCollisionMesh collision)
|
|
{
|
|
{
|
|
frmMain.AppendLoadFile("LoadModel: " + modelFileName);
|
|
frmMain.AppendLoadFile("LoadModel: " + modelFileName);
|
|
Eq2Reader reader = new Eq2Reader(File.OpenRead(modelFileName));
|
|
Eq2Reader reader = new Eq2Reader(File.OpenRead(modelFileName));
|
|
@@ -233,6 +250,7 @@ namespace EQ2ModelViewer
|
|
int indicesIdx = model.indices[index];
|
|
int indicesIdx = model.indices[index];
|
|
if (indicesIdx < 0 || indicesIdx >= model.vertices.Length)
|
|
if (indicesIdx < 0 || indicesIdx >= model.vertices.Length)
|
|
break;
|
|
break;
|
|
|
|
+
|
|
float x = model.vertices[model.indices[index]].X;
|
|
float x = model.vertices[model.indices[index]].X;
|
|
float y = model.vertices[model.indices[index]].Y;
|
|
float y = model.vertices[model.indices[index]].Y;
|
|
float z = model.vertices[model.indices[index]].Z;
|
|
float z = model.vertices[model.indices[index]].Z;
|