2013-04-11 11:04:16 +00:00
|
|
|
|
using System.Collections.Generic;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
using SlimDX;
|
|
|
|
|
using SlimDX.Direct3D9;
|
2012-05-21 23:51:32 +00:00
|
|
|
|
using CodeImp.DoomBuilder.GZBuilder.MD3;
|
2013-07-29 08:50:50 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Data;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
|
|
|
using CodeImp.DoomBuilder.IO;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Drawing.Imaging;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|
|
|
|
{
|
2013-07-29 08:50:50 +00:00
|
|
|
|
internal sealed class ModelData
|
2012-04-17 19:13:47 +00:00
|
|
|
|
{
|
2013-07-29 08:50:50 +00:00
|
|
|
|
private const float VERTICAL_STRETCH = 1 / 1.2f;
|
|
|
|
|
|
|
|
|
|
private class MD3LoadResult
|
|
|
|
|
{
|
|
|
|
|
public List<string> Skins;
|
|
|
|
|
public List<Mesh> Meshes;
|
|
|
|
|
public string Errors;
|
|
|
|
|
|
|
|
|
|
public MD3LoadResult() {
|
|
|
|
|
Skins = new List<string>();
|
|
|
|
|
Meshes = new List<Mesh>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal string ClassName;
|
2012-07-12 22:34:12 +00:00
|
|
|
|
internal List<string> ModelNames;
|
|
|
|
|
internal List<string> TextureNames;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2012-07-12 22:34:12 +00:00
|
|
|
|
internal GZModel Model;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2013-07-29 08:50:50 +00:00
|
|
|
|
private ModelLoadState loadstate;
|
|
|
|
|
public ModelLoadState LoadState { get { return loadstate; } internal set { loadstate = value; } }
|
|
|
|
|
|
2012-07-12 22:34:12 +00:00
|
|
|
|
internal Vector3 Scale;
|
|
|
|
|
internal float zOffset;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2012-07-28 20:36:28 +00:00
|
|
|
|
internal float AngleOffset; //in radians
|
|
|
|
|
internal float PitchOffset; //in radians
|
|
|
|
|
internal float RollOffset; //in radians
|
|
|
|
|
|
2013-07-29 08:50:50 +00:00
|
|
|
|
internal ModelData() {
|
2012-04-17 19:13:47 +00:00
|
|
|
|
ModelNames = new List<string>();
|
|
|
|
|
TextureNames = new List<string>();
|
|
|
|
|
}
|
2012-05-21 23:51:32 +00:00
|
|
|
|
|
2012-07-12 22:34:12 +00:00
|
|
|
|
internal void Dispose() {
|
2012-05-21 23:51:32 +00:00
|
|
|
|
if (Model != null) {
|
|
|
|
|
foreach (Mesh mesh in Model.Meshes)
|
|
|
|
|
mesh.Dispose();
|
|
|
|
|
|
|
|
|
|
foreach (Texture t in Model.Textures)
|
|
|
|
|
t.Dispose();
|
2013-07-29 08:50:50 +00:00
|
|
|
|
|
|
|
|
|
loadstate = ModelLoadState.None;
|
2012-05-21 23:51:32 +00:00
|
|
|
|
}
|
2013-07-29 08:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-17 19:13:47 +00:00
|
|
|
|
}
|