DECORATE Scale actor property is now taken into account when rendering models.

Fixed several bugs in Engine selector dialog ("Game configurations -> Testing").
This commit is contained in:
MaxED 2013-06-14 11:40:18 +00:00
parent 640b874bd3
commit f419db1518
8 changed files with 23 additions and 5 deletions

View file

@ -143,6 +143,8 @@ namespace CodeImp.DoomBuilder.Config
info.TestSkill = General.Settings.ReadSetting(path + ".testskill", 3);
testEngines.Add(info);
}
if(currentEngineIndex >= testEngines.Count) currentEngineIndex = 0;
}
//mxd. read custom linedef colors

View file

@ -28,9 +28,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data {
public void CheckProgramName(bool forced) {
if ((forced || TestProgramName == DEFAULT_ENGINE_NAME) && !String.IsNullOrEmpty(TestProgram)) {
//get engine name from folder name
string n = Path.GetDirectoryName(TestProgram);
int pos = n.LastIndexOf(Path.DirectorySeparatorChar);
TestProgramName = n.Substring(pos + 1, n.Length - pos - 1);
TestProgramName = Path.GetFileNameWithoutExtension(TestProgram);
}
}
}

View file

@ -56,6 +56,7 @@ namespace CodeImp.DoomBuilder.Map
private int tag;
private int action;
private int[] args;
protected float scale; //mxd. Used in model rendering
// Configuration
private float size;
@ -70,6 +71,7 @@ namespace CodeImp.DoomBuilder.Map
public MapSet Map { get { return map; } }
public int Type { get { return type; } set { BeforePropsChange(); type = value; } }
public Vector3D Position { get { return pos; } }
public float Scale { get { return scale; } } //mxd
public float Angle { get { return anglerad; } }
public int AngleDoom { get { return angledoom; } }
internal Dictionary<string, bool> Flags { get { return flags; } }
@ -96,6 +98,7 @@ namespace CodeImp.DoomBuilder.Map
this.listindex = listindex;
this.flags = new Dictionary<string, bool>();
this.args = new int[NUM_ARGS];
this.scale = 1.0f; //mxd
if(map == General.Map.Map)
General.Map.UndoRedo.RecAddThing(this);
@ -415,6 +418,7 @@ namespace CodeImp.DoomBuilder.Map
// Apply size
size = ti.Radius;
fixedsize = ti.FixedSize;
scale = ti.SpriteScale.Width; //mxd
// Color valid?
if((ti.Color >= 0) && (ti.Color < ColorCollection.NUM_THING_COLORS))

View file

@ -1160,7 +1160,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Shaders.Things2D.FillColor = group.Value.Selected ? General.Colors.Selection.ToColorValue() : General.Colors.ModelWireframe.ToColorValue();
for (int i = 0; i < mde.Model.Meshes.Count; i++) {
graphics.Shaders.Things2D.SetTransformSettings(group.Key, group.Value.Angle, scale);
graphics.Shaders.Things2D.SetTransformSettings(group.Key, group.Value.Angle, scale * group.Value.Scale);
graphics.Shaders.Things2D.ApplySettings();
// Draw

View file

@ -1066,6 +1066,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Create the matrix for positioning / rotation
world = Matrix.Multiply(t.Orientation, Matrix.RotationZ(t.Thing.Angle));
world = Matrix.Multiply(world, t.Scale);
world = Matrix.Multiply(world, t.Position);
ApplyMatrices3D();

View file

@ -72,6 +72,7 @@ namespace CodeImp.DoomBuilder.VisualModes
//mxd
private int cameraDistance3D;
private int thingHeight;
protected Matrix scale; //mxd. Used in model rendering
//mxd. light properties
private int lightType;
@ -103,6 +104,7 @@ namespace CodeImp.DoomBuilder.VisualModes
//mxd
internal int VertexColor { get { return vertices.Length > 0 ? vertices[0].c : 0;} }
internal Matrix Scale { get { return scale; } }
public int CameraDistance3D { get { return cameraDistance3D; } }
public bool Sizeless { get { return sizeless; } }
public Vector3 Center {
@ -166,6 +168,7 @@ namespace CodeImp.DoomBuilder.VisualModes
this.orientation = Matrix.Identity;
this.position = Matrix.Identity;
this.cagescales = Matrix.Identity;
this.scale = Matrix.Identity; //mxd
//mxd
lightType = -1;
@ -286,6 +289,11 @@ namespace CodeImp.DoomBuilder.VisualModes
triangles = vertices.Length / 3;
updategeo = true;
}
//mxd
protected void SetScale(float scaleX, float scaleY) {
scale = Matrix.Scaling(scaleX, scaleX, scaleY);
}
// This updates the visual thing
public virtual void Update()

View file

@ -624,6 +624,7 @@ namespace CodeImp.DoomBuilder.Windows
private void btnRemoveEngine_Click(object sender, EventArgs e) {
//remove params
int index = cbEngineSelector.SelectedIndex;
cbEngineSelector.SelectedIndex = -1;
configinfo.TestEngines.RemoveAt(index);
//refresh engines list
@ -642,7 +643,9 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
private void cbEngineSelector_SelectedIndexChanged(object sender, EventArgs e) {
//set new values
if(cbEngineSelector.SelectedIndex == -1) return;
//set new values
configinfo.CurrentEngineIndex = cbEngineSelector.SelectedIndex;
cbEngineSelector.Tag = cbEngineSelector.SelectedIndex; //store for later use

View file

@ -25,6 +25,7 @@ using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.VisualModes;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Data;
using System.Drawing.Drawing2D;
#endregion
@ -259,6 +260,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
SetPosition(pos);
SetCageSize(infoRadius, infoHeight);
SetCageColor(Thing.Color);
SetScale(info.SpriteScale.Width, info.SpriteScale.Height); //mxd
// Keep info for object picking
cageradius2 = infoRadius * Angle2D.SQRT2;