UltimateZoneBuilder/Source/Core/GZBuilder/Data/ModelData.cs
MaxED 8af084187e Fixed, Models, Classic and Visual mode: MODELDEF scale and rotation transforms were applied in incorrect order.
Changed, Visual mode: things with "NOINTERACTION" DECORATE flag can now be rendered above ceiling / below floor.
2015-03-26 21:31:46 +00:00

72 lines
1.9 KiB
C#

#region ================== Namespaces
using System.Collections.Generic;
using CodeImp.DoomBuilder.GZBuilder.MD3;
using CodeImp.DoomBuilder.Rendering;
using SlimDX;
using SlimDX.Direct3D9;
#endregion
namespace CodeImp.DoomBuilder.GZBuilder.Data
{
internal sealed class ModelData
{
#region ================== Variables
private ModelLoadState loadstate;
private Vector3 scale;
private Matrix transform;
private Matrix transformstretched;
#endregion
#region ================== Properties
internal List<string> ModelNames;
internal List<string> TextureNames;
internal GZModel Model;
internal Vector3 Scale { get { return scale; } }
internal Matrix Transform { get { return (General.Settings.GZStretchView ? transformstretched : transform); } }
internal bool OverridePalette; //used for voxel models only
internal bool InheritActorPitch;
internal bool InheritActorRoll;
internal bool IsVoxel;
public ModelLoadState LoadState { get { return loadstate; } internal set { loadstate = value; } }
#endregion
#region ================== Constructor / Disposer
internal ModelData()
{
ModelNames = new List<string>();
TextureNames = new List<string>();
transform = Matrix.Identity;
transformstretched = Matrix.Identity;
}
internal void Dispose()
{
if (Model != null)
{
foreach (Mesh mesh in Model.Meshes) mesh.Dispose();
foreach (Texture t in Model.Textures) t.Dispose();
loadstate = ModelLoadState.None;
}
}
internal void SetTransform(Matrix rotation, Matrix offset, Vector3 scale)
{
this.scale = scale;
this.transform = rotation * Matrix.Scaling(scale) * offset;
this.transformstretched = rotation * Matrix.Scaling(scale.X, scale.Y, scale.Z * Renderer3D.GZDOOM_INVERTED_VERTICAL_VIEW_STRETCH) * offset;
}
#endregion
}
}