2014-12-11 12:55:35 +00:00
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using CodeImp.DoomBuilder.GZBuilder.MD3;
|
2014-12-22 21:36:49 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
using SlimDX;
|
|
|
|
|
using SlimDX.Direct3D9;
|
2014-12-11 12:55:35 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
internal sealed class ModelData
|
|
|
|
|
{
|
2014-12-11 12:55:35 +00:00
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
|
|
|
|
private ModelLoadState loadstate;
|
2014-12-22 21:36:49 +00:00
|
|
|
|
private Vector3 scale;
|
|
|
|
|
private Matrix transform;
|
|
|
|
|
private Matrix transformstretched;
|
2014-12-11 12:55:35 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
internal List<string> ModelNames;
|
|
|
|
|
internal List<string> TextureNames;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
internal GZModel Model;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2014-12-22 21:36:49 +00:00
|
|
|
|
internal Vector3 Scale { get { return scale; } }
|
|
|
|
|
internal Matrix Transform { get { return (General.Settings.GZStretchView ? transformstretched : transform); } }
|
|
|
|
|
internal bool OverridePalette; //used for voxel models only
|
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
|
|
|
|
internal bool InheritActorPitch;
|
|
|
|
|
internal bool InheritActorRoll;
|
2012-07-28 20:36:28 +00:00
|
|
|
|
|
2014-12-11 12:55:35 +00:00
|
|
|
|
internal bool IsVoxel;
|
|
|
|
|
|
|
|
|
|
public ModelLoadState LoadState { get { return loadstate; } internal set { loadstate = value; } }
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
internal ModelData()
|
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
ModelNames = new List<string>();
|
|
|
|
|
TextureNames = new List<string>();
|
2014-12-22 21:36:49 +00:00
|
|
|
|
transform = Matrix.Identity;
|
|
|
|
|
transformstretched = Matrix.Identity;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2012-05-21 23:51:32 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
internal void Dispose()
|
|
|
|
|
{
|
|
|
|
|
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;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2013-07-29 08:50:50 +00:00
|
|
|
|
}
|
2014-12-11 12:55:35 +00:00
|
|
|
|
|
2014-12-22 21:36:49 +00:00
|
|
|
|
internal void SetTransform(Matrix rotation, Matrix offset, Vector3 scale)
|
|
|
|
|
{
|
|
|
|
|
this.scale = scale;
|
|
|
|
|
this.transform = Matrix.Scaling(scale) * rotation * offset;
|
|
|
|
|
this.transformstretched = Matrix.Scaling(scale.X, scale.Y, scale.Z * Renderer3D.GZDOOM_INVERTED_VERTICAL_VIEW_STRETCH) * rotation * offset;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-11 12:55:35 +00:00
|
|
|
|
#endregion
|
2013-07-29 08:50:50 +00:00
|
|
|
|
}
|
2012-04-17 19:13:47 +00:00
|
|
|
|
}
|