GZDoom Builder 1.12a:

AngleOffset, PitchOffset and RollOffset MODELDEF properties are now supported.
Fixed a crash when editor tries to display a model for an actor without a valid sprite in Visual mode.
Fixed a possible crash when MODELDEF is reloaded from 2d-mode.
Fixed several things in Doom2_things.cfg.
UDMF Controls plugin:
Fixed several bugs in plugin's sliders logic.
This commit is contained in:
MaxED 2012-07-28 20:36:28 +00:00
parent 122e5d8e1b
commit 2006cdc7bb
24 changed files with 252 additions and 157 deletions

View file

@ -207,7 +207,7 @@ decoration
sort = 1;
height = 16;
hangs = 0;
blocking = 1;
blocking = 0;
79
{
@ -236,6 +236,7 @@ decoration
sprite = "HDB1A0";
height = 88;
hangs = 1;
blocking = 1;
class = "HangNoGuts";
}
@ -245,6 +246,7 @@ decoration
sprite = "HDB2A0";
height = 88;
hangs = 1;
blocking = 1;
class = "HangBNoBrain";
}
@ -254,6 +256,7 @@ decoration
sprite = "HDB3A0";
height = 64;
hangs = 1;
blocking = 1;
class = "HangTLookingDown";
}

View file

@ -23,6 +23,9 @@ keywords
Rotation-Vector = "Rotation-Vector <float x> <float y> <float z>";
Rotation-Center = "Rotation-Center <float x> <float y> <float z>";
ZOffset = "ZOffset <float>";
AngleOffset = "AngleOffset <float>";
PitchOffset = "PitchOffset <float>";
RollOffset = "RollOffset <float>";
}
constants
@ -32,4 +35,6 @@ constants
INTERPOLATEDOUBLEDFRAMES;
ROTATING;
NOINTERPOLATION;
INHERITACTORPITCH;
INHERITACTORROLL;
}

View file

@ -7,13 +7,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderModes", "..\Plugins\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GZDoomEditing", "..\Plugins\GZDoomEditing\GZDoomEditing.csproj", "{760A9BC7-CB73-4C36-858B-994C14996FCD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TagExplorer", "..\Plugins\TagExplorer\TagExplorer.csproj", "{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UDMFControls", "..\Plugins\UMDFControls\UDMFControls.csproj", "{2D11C828-295C-463A-8545-CA1AD6D51518}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorPicker", "..\Plugins\ColorPicker\ColorPicker.csproj", "{A4761900-0EA3-4FE4-A919-847FD5080EFC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisplaneExplorer", "..\Plugins\VisplaneExplorer\VisplaneExplorer.csproj", "{CF670175-7099-4090-A330-EE25C7230139}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TagExplorer", "..\Plugins\TagExplorer\TagExplorer.csproj", "{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -55,46 +51,28 @@ Global
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|Mixed Platforms.Build.0 = Release|x86
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.ActiveCfg = Release|x86
{760A9BC7-CB73-4C36-858B-994C14996FCD}.Release|x86.Build.0 = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Mixed Platforms.Build.0 = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x86.ActiveCfg = Debug|Any CPU
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Any CPU.Build.0 = Release|Any CPU
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Mixed Platforms.ActiveCfg = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Mixed Platforms.Build.0 = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x86.ActiveCfg = Release|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|Mixed Platforms.Build.0 = Debug|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|x86.ActiveCfg = Debug|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|x86.ActiveCfg = Debug|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Debug|x86.Build.0 = Debug|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Any CPU.Build.0 = Release|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Mixed Platforms.ActiveCfg = Release|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Mixed Platforms.Build.0 = Release|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|x86.ActiveCfg = Release|Any CPU
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Any CPU.ActiveCfg = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Mixed Platforms.Build.0 = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.ActiveCfg = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.Build.0 = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Any CPU.ActiveCfg = Release|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Mixed Platforms.ActiveCfg = Release|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Mixed Platforms.Build.0 = Release|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.ActiveCfg = Release|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.Build.0 = Release|x86
{CF670175-7099-4090-A330-EE25C7230139}.Debug|Any CPU.ActiveCfg = Debug|x86
{CF670175-7099-4090-A330-EE25C7230139}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{CF670175-7099-4090-A330-EE25C7230139}.Debug|Mixed Platforms.Build.0 = Debug|x86
{CF670175-7099-4090-A330-EE25C7230139}.Debug|x86.ActiveCfg = Debug|x86
{CF670175-7099-4090-A330-EE25C7230139}.Debug|x86.Build.0 = Debug|x86
{CF670175-7099-4090-A330-EE25C7230139}.Release|Any CPU.ActiveCfg = Release|x86
{CF670175-7099-4090-A330-EE25C7230139}.Release|Mixed Platforms.ActiveCfg = Release|x86
{CF670175-7099-4090-A330-EE25C7230139}.Release|Mixed Platforms.Build.0 = Release|x86
{CF670175-7099-4090-A330-EE25C7230139}.Release|x86.ActiveCfg = Release|x86
{CF670175-7099-4090-A330-EE25C7230139}.Release|x86.Build.0 = Release|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|x86.ActiveCfg = Release|x86
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|x86.Build.0 = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Any CPU.ActiveCfg = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|Mixed Platforms.Build.0 = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x86.ActiveCfg = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Debug|x86.Build.0 = Debug|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Any CPU.ActiveCfg = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Mixed Platforms.ActiveCfg = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|Mixed Platforms.Build.0 = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x86.ActiveCfg = Release|x86
{BE7917F3-E6FE-4D5B-8FA9-B8E7668AC731}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -284,7 +284,11 @@ namespace CodeImp.DoomBuilder.Config
// Set sprite
string suitablesprite = actor.FindSuitableSprite();
if(!string.IsNullOrEmpty(suitablesprite)) sprite = suitablesprite;
if(!string.IsNullOrEmpty(suitablesprite))
sprite = suitablesprite;
else//mxd
sprite = DataManager.INTERNAL_PREFIX + "unknownthing";
if(this.sprite.Length <= 8)
this.spritelongname = Lump.MakeLongName(this.sprite);

View file

@ -45,7 +45,7 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Variables
private Bitmap bmp;
private bool ispressed;
//private bool ispressed;
private bool ismouseinside;
private MouseButtons button;
protected bool allowclear;
@ -97,7 +97,7 @@ namespace CodeImp.DoomBuilder.Controls
// Image clicked
private void preview_Click(object sender, EventArgs e)
{
ispressed = false;
//ispressed = false;
preview.BackColor = SystemColors.Highlight;
ShowPreview(FindImage(name.Text));
if(button == MouseButtons.Right)
@ -123,7 +123,7 @@ namespace CodeImp.DoomBuilder.Controls
button = e.Button;
if((button == MouseButtons.Left) || ((button == MouseButtons.Right) && allowclear))
{
ispressed = true;
//ispressed = true;
preview.BackColor = AdjustedColor(SystemColors.Highlight, 0.2f);
ShowPreview(FindImage(name.Text));
}
@ -132,14 +132,14 @@ namespace CodeImp.DoomBuilder.Controls
// Mouse released
private void preview_MouseUp(object sender, MouseEventArgs e)
{
ispressed = false;
//ispressed = false;
ShowPreview(FindImage(name.Text));
}
// Mouse leaves
private void preview_MouseLeave(object sender, EventArgs e)
{
ispressed = false;
//ispressed = false;
ismouseinside = false;
preview.BackColor = SystemColors.AppWorkspace;
}

View file

@ -108,8 +108,8 @@ namespace CodeImp.DoomBuilder.Controls
public event MarginClickHandler MarginClick;
public event NeedShownHandler NeedShown;
public event PaintedHandler Painted;
public event UserListSelectionHandler UserListSelection;
public event URIDroppedHandler URIDropped;
//public event UserListSelectionHandler UserListSelection;
//public event URIDroppedHandler URIDropped;
public event DwellStartHandler DwellStart;
public event DwellEndHandler DwellEnd;
public event ZoomHandler Zoom;

View file

@ -52,7 +52,7 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Variables
private ICollection<Thing> things;
//private ICollection<Thing> things;
private List<TreeNode> nodes;
private ThingTypeInfo thinginfo;
private bool doupdatenode;

View file

@ -1458,6 +1458,7 @@ namespace CodeImp.DoomBuilder.Data
}
General.MainWindow.DisplayStatus(StatusType.Busy, "Reloading model definitions...");
loadModeldefs(createActorsByClassList());
LoadModels();
//rebuild geometry if in Visual mode
if (General.Editing.Mode != null && General.Editing.Mode.GetType().Name == "BaseVisualMode") {

View file

@ -47,7 +47,7 @@ namespace CodeImp.DoomBuilder.Editing
private volatile bool storeondisk;
private volatile bool isondisk;
private bool isdisposed;
private Dictionary<string, MemoryStream> customdata;
//private Dictionary<string, MemoryStream> customdata;
#endregion

View file

@ -22,6 +22,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
internal Vector3 Scale;
internal float zOffset;
internal float AngleOffset; //in radians
internal float PitchOffset; //in radians
internal float RollOffset; //in radians
internal ModeldefEntry() {
ModelNames = new List<string>();
TextureNames = new List<string>();

View file

@ -19,6 +19,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
string path = "";
Vector3 scale = new Vector3(1, 1, 1);
float zOffset = 0;
float angleOffset = 0;
float pitchOffset = 0;
float rollOffset = 0;
string token;
bool gotErrors = false;
@ -28,7 +32,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
if (!string.IsNullOrEmpty(token)) {
token = parser.StripTokenQuotes(token).ToLowerInvariant(); //ANYTHING can be quoted...
//path
//path
if (token == "path") {
parser.SkipWhitespace(true);
path = parser.StripTokenQuotes(parser.ReadToken()).Replace("/", "\\");
@ -38,7 +42,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
gotErrors = true;
break;
}
//model
//model
} else if (token == "model") {
parser.SkipWhitespace(true);
@ -57,7 +61,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
break;
}
//model path
//model path
token = parser.StripTokenQuotes(parser.ReadToken()).ToLowerInvariant();
if (string.IsNullOrEmpty(token)) {
GZBuilder.GZGeneral.LogAndTraceWarning("Error in " + parser.Source + " at line " + parser.GetCurrentLineNumber() + ": expected model name, but got '" + token + "'");
@ -76,7 +80,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
//GZDoom allows models with identical modelIndex, it uses the last one encountered
modelNames[modelIndex] = token;
}
//skin
//skin
} else if (token == "skin") {
parser.SkipWhitespace(true);
@ -95,7 +99,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
break;
}
//skin path
//skin path
token = parser.StripTokenQuotes(parser.ReadToken()).ToLowerInvariant();
if (string.IsNullOrEmpty(token)) {
GZBuilder.GZGeneral.LogAndTraceWarning("Error in " + parser.Source + " at line " + parser.GetCurrentLineNumber() + ": expected skin name, but got '" + token + "'");
@ -111,7 +115,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
//GZDoom allows skins with identical modelIndex, it uses the last one encountered
textureNames[skinIndex] = token;
}
//scale
//scale
} else if (token == "scale") {
parser.SkipWhitespace(true);
@ -142,7 +146,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
gotErrors = true;
break;
}
//zoffset
//zoffset
} else if (token == "zoffset") {
parser.SkipWhitespace(true);
@ -153,7 +157,40 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
gotErrors = true;
break;
}
//frameindex
//angleoffset
} else if (token == "angleoffset") {
parser.SkipWhitespace(true);
token = parser.StripTokenQuotes(parser.ReadToken());
if (!parser.ReadSignedFloat(token, ref angleOffset)) {
// Not numeric!
GZBuilder.GZGeneral.LogAndTraceWarning("Error in " + parser.Source + " at line " + parser.GetCurrentLineNumber() + ": expected AngleOffset value, but got '" + token + "'");
gotErrors = true;
break;
}
//pitchoffset
} else if (token == "pitchoffset") {
parser.SkipWhitespace(true);
token = parser.StripTokenQuotes(parser.ReadToken());
if (!parser.ReadSignedFloat(token, ref pitchOffset)) {
// Not numeric!
GZBuilder.GZGeneral.LogAndTraceWarning("Error in " + parser.Source + " at line " + parser.GetCurrentLineNumber() + ": expected PitchOffset value, but got '" + token + "'");
gotErrors = true;
break;
}
//rolloffset
} else if (token == "rolloffset") {
parser.SkipWhitespace(true);
token = parser.StripTokenQuotes(parser.ReadToken());
if (!parser.ReadSignedFloat(token, ref rollOffset)) {
// Not numeric!
GZBuilder.GZGeneral.LogAndTraceWarning("Error in " + parser.Source + " at line " + parser.GetCurrentLineNumber() + ": expected RollOffset value, but got '" + token + "'");
gotErrors = true;
break;
}
//frameindex
} else if (token == "frameindex") {
//parsed all required fields. if got more than one model - find which one(s) should be displayed
int len = modelNames.GetLength(0);
@ -262,14 +299,16 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
break;
}
if (gotErrors)
return null;
if (gotErrors) return null;
//classname is set in ModeldefParser
ModeldefEntry mde = new ModeldefEntry();
mde.Path = path;
mde.Scale = scale;
mde.zOffset = zOffset;
mde.AngleOffset = angleOffset * (float)Math.PI / 180.0f;
mde.RollOffset = rollOffset * (float)Math.PI / 180.0f;
mde.PitchOffset = pitchOffset * (float)Math.PI / 180.0f;
for (int i = 0; i < textureNames.Length; i++) {
if (textureNames[i] != null && modelNames[i] != null) {

View file

@ -33,7 +33,7 @@ namespace CodeImp.DoomBuilder.GZBuilder
//version
public const float Version = 1.12f;
public const char Revision = ' ';
public const char Revision = 'a';
//debug console
#if DEBUG

View file

@ -6,16 +6,15 @@ using CodeImp.DoomBuilder.Geometry;
namespace CodeImp.DoomBuilder.GZBuilder.MD3
{
public class GZModel {
public List<Mesh> Meshes;
public List<Texture> Textures;
public byte NUM_MESHES; //can't be greater than 255, can it?
public Vector3[] BoundingBox;
public List<IndexBuffer> Indeces2D;
public List<short> NumIndeces2D;
public float Angle = 0; //crappy way to set rotation to md2 models...
internal class GZModel {
internal List<Mesh> Meshes;
internal List<Texture> Textures;
internal byte NUM_MESHES; //can't be greater than 255, can it?
internal Vector3[] BoundingBox;
internal List<IndexBuffer> Indeces2D;
internal List<short> NumIndeces2D;
public GZModel() {
internal GZModel() {
Meshes = new List<Mesh>();
Textures = new List<Texture>();
Indeces2D = new List<IndexBuffer>();

View file

@ -195,12 +195,49 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
if (start + ofsNormal != br.BaseStream.Position)
br.BaseStream.Position = start + ofsNormal;
//rotation angles
float angleOfsetCos = (float)Math.Cos(mde.AngleOffset);
float angleOfsetSin = (float)Math.Sin(mde.AngleOffset);
float pitchOfsetCos = (float)Math.Cos(-mde.PitchOffset);
float pitchOfsetSin = (float)Math.Sin(-mde.PitchOffset);
float rollOfsetCos = (float)Math.Cos(mde.RollOffset);
float rollOfsetSin = (float)Math.Sin(mde.RollOffset);
for (int i = vertexOffset; i < vertexOffset + numVerts; i++) {
WorldVertex v = vertList[i];
v.y = -(float)br.ReadInt16() / 64 * mde.Scale.X;
v.x = (float)br.ReadInt16() / 64 * mde.Scale.Y;
v.z = (float)br.ReadInt16() / 64 * mde.Scale.Z + mde.zOffset;
//read vertex
v.y = -(float)br.ReadInt16() / 64;
v.x = (float)br.ReadInt16() / 64;
v.z = (float)br.ReadInt16() / 64;
//rotate it
if (mde.AngleOffset != 0) {
float rx = angleOfsetCos * v.x - angleOfsetSin * v.y;
float ry = angleOfsetSin * v.x + angleOfsetCos * v.y;
v.y = ry;
v.x = rx;
}
if (mde.PitchOffset != 0) {
float ry = pitchOfsetCos * v.y - pitchOfsetSin * v.z;
float rz = pitchOfsetSin * v.y + pitchOfsetCos * v.z;
v.z = rz;
v.y = ry;
}
if (mde.RollOffset != 0) {
float rx = rollOfsetCos * v.x - rollOfsetSin * v.z;
float rz = rollOfsetSin * v.x + rollOfsetCos * v.z;
v.z = rz;
v.x = rx;
}
//scale it
v.y *= mde.Scale.X;
v.x *= mde.Scale.Y;
v.z *= mde.Scale.Z;
//add zOffset
v.z += mde.zOffset;
//bounding box
BoundingBoxTools.UpdateBoundingBoxSizes(ref bbs, v);
@ -286,14 +323,49 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
s.Position += 16; //frame name
//rotation angles
float angle = mde.AngleOffset - 0.5f * (float)Math.PI; //subtract 90 degrees to get correct rotation
float angleOfsetCos = (float)Math.Cos(angle);
float angleOfsetSin = (float)Math.Sin(angle);
float pitchOfsetCos = (float)Math.Cos(-mde.PitchOffset);
float pitchOfsetSin = (float)Math.Sin(-mde.PitchOffset);
float rollOfsetCos = (float)Math.Cos(mde.RollOffset);
float rollOfsetSin = (float)Math.Sin(mde.RollOffset);
//verts
for (int i = 0; i < num_verts; i++) {
//pos
WorldVertex v = new WorldVertex();
v.x = ((float)br.ReadByte() * scale.X + translate.X) * mde.Scale.X;
v.y = ((float)br.ReadByte() * scale.Y + translate.Y) * mde.Scale.Y;
v.z = ((float)br.ReadByte() * scale.Z + translate.Z) * mde.Scale.Z + mde.zOffset;
v.x = ((float)br.ReadByte() * scale.X + translate.X);
v.y = ((float)br.ReadByte() * scale.Y + translate.Y);
v.z = ((float)br.ReadByte() * scale.Z + translate.Z);
//rotate it
float rx = angleOfsetCos * v.x - angleOfsetSin * v.y;
float ry = angleOfsetSin * v.x + angleOfsetCos * v.y;
v.y = ry;
v.x = rx;
if (mde.PitchOffset != 0) {
ry = pitchOfsetCos * v.y - pitchOfsetSin * v.z;
float rz = pitchOfsetSin * v.y + pitchOfsetCos * v.z;
v.z = rz;
v.y = ry;
}
if (mde.RollOffset != 0) {
rx = rollOfsetCos * v.x - rollOfsetSin * v.z;
float rz = rollOfsetSin * v.x + rollOfsetCos * v.z;
v.z = rz;
v.x = rx;
}
//scale it
v.x *= mde.Scale.X;
v.y *= mde.Scale.Y;
v.z *= mde.Scale.Z;
//add zOffset
v.z += mde.zOffset;
vertList.Add(v);
@ -340,7 +412,6 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
mde.Model.Indeces2D.Add(indeces2d);
mde.Model.NumIndeces2D.Add((short)polyIndecesList.Count);
mde.Model.Angle = -90.0f * (float)Math.PI / 180.0f;
}
return "";
}

View file

@ -1132,10 +1132,23 @@ namespace CodeImp.DoomBuilder.Rendering
foreach(KeyValuePair<Vector2D, Thing> group in thingsWithModel){
ModeldefEntry mde = General.Map.Data.ModeldefEntries[group.Value.Type];
if (mde.Model != null)
RenderModel(mde.Model, group.Key, group.Value.Angle + mde.Model.Angle, group.Value.Selected);
else
if (mde.Model != null) {//render model
//wire color
graphics.Shaders.Things2D.FillColor = group.Value.Selected ? General.Colors.Selection.ToColorValue() : General.Colors.ModelWireframe.ToColorValue();
for (int i = 0; i < mde.Model.NUM_MESHES; i++) {
graphics.Shaders.Things2D.SetTransformSettings(group.Key, group.Value.Angle, scale);
graphics.Shaders.Things2D.ApplySettings();
// Draw
graphics.Device.SetStreamSource(0, mde.Model.Meshes[i].VertexBuffer, 0, WorldVertex.Stride);
graphics.Device.Indices = mde.Model.Indeces2D[i];
graphics.Device.DrawIndexedPrimitives(PrimitiveType.LineList, 0, 0, mde.Model.Meshes[i].VertexCount, 0, mde.Model.NumIndeces2D[i]);
}
} else {
group.Value.IsModel = General.Map.Data.LoadModelForThing(group.Value);
}
}
graphics.Shaders.Things2D.EndPass();
}
@ -1157,22 +1170,6 @@ namespace CodeImp.DoomBuilder.Rendering
{
RenderThingsBatch(things, alpha, false, new PixelColor());
}
//mxd
public void RenderModel(GZModel model, Vector2D modelPos, float modelAngle, bool selected) {
//wire color
graphics.Shaders.Things2D.FillColor = selected ? General.Colors.Selection.ToColorValue() : General.Colors.ModelWireframe.ToColorValue();
for (int i = 0; i < model.NUM_MESHES; i++) {
graphics.Shaders.Things2D.SetTransformSettings(modelPos, modelAngle, scale);
graphics.Shaders.Things2D.ApplySettings();
// Draw
graphics.Device.SetStreamSource(0, model.Meshes[i].VertexBuffer, 0, WorldVertex.Stride);
graphics.Device.Indices = model.Indeces2D[i];
graphics.Device.DrawIndexedPrimitives(PrimitiveType.LineList, 0, 0, model.Meshes[i].VertexCount, 0, model.NumIndeces2D[i]);
}
}
#endregion

View file

@ -1031,7 +1031,7 @@ namespace CodeImp.DoomBuilder.Rendering
}
// Create the matrix for positioning / rotation
world = Matrix.Multiply(t.Orientation, Matrix.RotationZ(t.Thing.Angle + group.Key.Model.Angle));
world = Matrix.Multiply(t.Orientation, Matrix.RotationZ(t.Thing.Angle));
world = Matrix.Multiply(world, t.Position);
ApplyMatrices3D();

View file

@ -38,7 +38,7 @@ namespace CodeImp.DoomBuilder.Windows
{
#region ================== Variables
private bool setup;
//private bool setup;
private int value;
#endregion
@ -86,10 +86,10 @@ namespace CodeImp.DoomBuilder.Windows
// Setup from EnumList
public void Setup(int value)
{
setup = true;
//setup = true;
this.value = value;
angle.Value = value;
setup = false;
//setup = false;
}
// This shows the dialog

View file

@ -29,7 +29,7 @@ namespace CodeImp.DoomBuilder.Windows
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.copyselected = new System.Windows.Forms.Button();
this.clearlist = new System.Windows.Forms.Button();
this.close = new System.Windows.Forms.Button();
@ -44,6 +44,7 @@ namespace CodeImp.DoomBuilder.Windows
// copyselected
//
this.copyselected.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.copyselected.Enabled = false;
this.copyselected.Location = new System.Drawing.Point(12, 416);
this.copyselected.Name = "copyselected";
this.copyselected.Size = new System.Drawing.Size(122, 25);
@ -116,9 +117,9 @@ namespace CodeImp.DoomBuilder.Windows
this.grid.Name = "grid";
this.grid.ReadOnly = true;
this.grid.RowHeadersVisible = false;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopLeft;
dataGridViewCellStyle1.Padding = new System.Windows.Forms.Padding(2, 4, 2, 5);
this.grid.RowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopLeft;
dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(2, 4, 2, 5);
this.grid.RowsDefaultCellStyle = dataGridViewCellStyle2;
this.grid.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.grid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.grid.ShowCellErrors = false;
@ -128,6 +129,7 @@ namespace CodeImp.DoomBuilder.Windows
this.grid.Size = new System.Drawing.Size(732, 395);
this.grid.StandardTab = true;
this.grid.TabIndex = 5;
this.grid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellContentClick);
//
// iconcolumn
//

View file

@ -146,5 +146,9 @@ namespace CodeImp.DoomBuilder.Windows
grid.Rows[0].Selected = false;
}
private void grid_CellContentClick(object sender, DataGridViewCellEventArgs e) {
copyselected.Enabled = true;
}
}
}

View file

@ -17,8 +17,11 @@ namespace CodeImp.DoomBuilder.UDMFControls
public override string Name { get { return "UDMF Controls"; } }
private UDMFControlsForm form;
//settings
private int scaleReange;
public int ScaleReange { get { return scaleReange; } }
private UDMFControlsForm form;
private Point formLocation; //used to keep form's location constant
public override void OnInitialize() {
@ -31,27 +34,12 @@ namespace CodeImp.DoomBuilder.UDMFControls
me = this;
General.Actions.BindMethods(this);
}
/*public override void OnEditKeyDown(KeyEventArgs e) {
//dbg
GZBuilder.GZGeneral.Trace("OnEditKeyDown");
base.OnEditKeyDown(e);
if(form != null){
form.FineMovement = General.Interface.ShiftState;
form.FastMovement = General.Interface.CtrlState;
}
scaleReange = General.Settings.ReadPluginSetting("scalerange", 2);
if (scaleReange < 1) scaleReange = 2;
General.Settings.WritePluginSetting("scalerange", scaleReange); //not working when called from Dispose()...
}
public override void OnEditKeyUp(KeyEventArgs e) {
base.OnEditKeyUp(e);
if (form != null) {
form.FineMovement = General.Interface.ShiftState;
form.FastMovement = General.Interface.CtrlState;
}
}*/
public override void Dispose() {
base.Dispose();
General.Actions.UnbindMethods(this);

View file

@ -17,7 +17,7 @@ namespace CodeImp.DoomBuilder.UDMFControls
public float Value {
get {
return (float)trackBar1.Value / 10f;
return (float)Math.Round(numericUpDown1.Value, 1);
}
set {
blockEvents = true;
@ -28,9 +28,9 @@ namespace CodeImp.DoomBuilder.UDMFControls
}
}
private int previousValue;
private int delta;
public float Delta { get { return (float)delta / 10f; } }
private float previousValue;
private float delta;
public float Delta { get { return delta; } }
private bool showLabels = true;
public bool ShowLabels {
@ -43,14 +43,14 @@ namespace CodeImp.DoomBuilder.UDMFControls
labelMax.Visible = showLabels;
}
}
public FloatSlider() {
InitializeComponent();
ShowLabels = showLabels;
numericUpDown1.DecimalPlaces = 1;
}
public void SetLimits(float min, float max, bool doubledLimits) {
public void SetLimits(float min, float max, bool extendedLimits) {
blockEvents = true;
trackBar1.Value = General.Clamp(trackBar1.Value, (int)(min * 10), (int)(max * 10));
@ -62,9 +62,9 @@ namespace CodeImp.DoomBuilder.UDMFControls
numericUpDown1.Value = (decimal)General.Clamp((float)numericUpDown1.Value, min, max);
if (doubledLimits) {
numericUpDown1.Minimum = (decimal)(min * 10);
numericUpDown1.Maximum = (decimal)(max * 10);
if (extendedLimits) {
numericUpDown1.Minimum = (decimal)(min * 32);
numericUpDown1.Maximum = (decimal)(max * 32);
} else {
numericUpDown1.Minimum = (decimal)min;
numericUpDown1.Maximum = (decimal)max;
@ -75,21 +75,19 @@ namespace CodeImp.DoomBuilder.UDMFControls
//events
private void trackBar1_ValueChanged(object sender, EventArgs e) {
int value = ((TrackBar)sender).Value;
delta = value - previousValue;
previousValue = value;
numericUpDown1.Value = Math.Round((decimal)(value / 10.0), 1);
if (!blockEvents) numericUpDown1.Value = Math.Round((decimal)(trackBar1.Value / 10.0), 1);
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e) {
float val = (float)((NumericUpDown)sender).Value;
float value = (float)Math.Round(numericUpDown1.Value, 1);
delta = (float)Math.Round(value - previousValue, 1);
previousValue = value;
if (!blockEvents && OnValueChanged != null)
OnValueChanged(this, EventArgs.Empty);
blockEvents = true;
trackBar1.Value = General.Clamp((int)(val * 10), trackBar1.Minimum, trackBar1.Maximum);
trackBar1.Value = General.Clamp((int)(value * 10), trackBar1.Minimum, trackBar1.Maximum);
blockEvents = false;
}
}

View file

@ -10,19 +10,18 @@ using System.Globalization;
namespace CodeImp.DoomBuilder.UDMFControls
{
public partial class IntSlider : UserControl {
public partial class IntSlider : UserControl
{
private bool blockEvents;
public event EventHandler OnValueChanged;
private int previousValue;
public int Value {
get
{
return (int)numericUpDown1.Value;
public int Value {
get {
return (int)numericUpDown1.Value;
}
set
{
set {
blockEvents = true;
previousValue = General.Clamp(value, (int)numericUpDown1.Minimum, (int)numericUpDown1.Maximum);
@ -31,7 +30,8 @@ namespace CodeImp.DoomBuilder.UDMFControls
}
}
public int Delta { get { return trackBar1.Value - previousValue; }}
private int delta;
public int Delta { get { return delta; } }
private bool showLabels;
public bool ShowLabels {
@ -44,13 +44,12 @@ namespace CodeImp.DoomBuilder.UDMFControls
labelMax.Visible = showLabels;
}
}
public IntSlider() {
InitializeComponent();
}
public void SetLimits(int min, int max) {
//bool blockEventsStatus = blockEvents;
blockEvents = true;
trackBar1.Value = General.Clamp(trackBar1.Value, min, max);
@ -64,24 +63,24 @@ namespace CodeImp.DoomBuilder.UDMFControls
numericUpDown1.Minimum = min;
numericUpDown1.Maximum = max;
//blockEvents = blockEventsStatus;
blockEvents = false;
}
//events
//events
private void trackBar1_ValueChanged(object sender, EventArgs e) {
numericUpDown1.Value = ((TrackBar)sender).Value;
if (!blockEvents) numericUpDown1.Value = ((TrackBar)sender).Value;
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e) {
int val = (int)((NumericUpDown)sender).Value;
int value = (int)((NumericUpDown)sender).Value;
delta = value - previousValue;
previousValue = value;
if (!blockEvents && OnValueChanged != null)
OnValueChanged(this, EventArgs.Empty);
previousValue = trackBar1.Value;
blockEvents = true;
trackBar1.Value = General.Clamp(val, trackBar1.Minimum, trackBar1.Maximum); //clamp it!
trackBar1.Value = General.Clamp(value, trackBar1.Minimum, trackBar1.Maximum);
blockEvents = false;
}
}

View file

@ -62,9 +62,10 @@ namespace CodeImp.DoomBuilder.UDMFControls
floatSlider2.Value = val;
}
if (OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
delta.x = (float)Math.Round(val - prevValues.x, 1);
prevValues.x = val;
if (OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
}
private void floatSlider2_OnValueChanged(object sender, EventArgs e) {
@ -76,9 +77,10 @@ namespace CodeImp.DoomBuilder.UDMFControls
floatSlider1.Value = val;
}
if (OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
delta.y = (float)Math.Round(val - prevValues.y, 1);
prevValues.y = val;
if (OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
}
private void button1_Click(object sender, EventArgs e) {

View file

@ -142,7 +142,8 @@ namespace CodeImp.DoomBuilder.UDMFControls
//set sliders limits
sliderDesaturation.SetLimits(0f, 1f, false);
sliderAlpha.SetLimits(0f, 1f, false);
scaleControl.SetLimits(-2f, 2f);
float scaleRange = BuilderPlug.Me.ScaleReange;
scaleControl.SetLimits(-scaleRange, scaleRange);
cbRenderStyle.Items.AddRange(new object[] { "Translucent", "Add" });
cbRenderStyle.SelectedIndex = 0;