2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
2014-11-25 11:52:01 +00:00
|
|
|
using System.IO;
|
2009-04-19 18:07:22 +00:00
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
2013-03-18 13:52:27 +00:00
|
|
|
using CodeImp.DoomBuilder.ZDoom;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Data
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
public enum TexturePathRenderStyle
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
Copy,
|
|
|
|
Blend,
|
|
|
|
Add,
|
|
|
|
Subtract,
|
|
|
|
ReverseSubtract,
|
|
|
|
Modulate,
|
2013-03-18 13:52:27 +00:00
|
|
|
CopyAlpha,
|
|
|
|
CopyNewAlpha, //mxd
|
|
|
|
Overlay, //mxd
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum TexturePathBlendStyle //mxd
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
Blend,
|
|
|
|
Tint
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
internal struct TexturePatch
|
|
|
|
{
|
2014-11-25 11:52:01 +00:00
|
|
|
public readonly string lumpname;
|
|
|
|
public readonly int x;
|
|
|
|
public readonly int y;
|
|
|
|
public readonly bool flipx;
|
|
|
|
public readonly bool flipy;
|
|
|
|
public readonly bool haslongname; //mxd
|
|
|
|
public readonly int rotate;
|
2009-04-19 18:07:22 +00:00
|
|
|
public PixelColor blend;
|
2014-11-25 11:52:01 +00:00
|
|
|
public readonly float alpha;
|
|
|
|
public readonly TexturePathRenderStyle style;
|
|
|
|
public readonly TexturePathBlendStyle blendstyle; //mxd
|
|
|
|
public readonly float tintammount;//mxd
|
2016-02-15 14:06:46 +00:00
|
|
|
public readonly bool skip; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Constructor for simple patches
|
|
|
|
public TexturePatch(string lumpname, int x, int y)
|
|
|
|
{
|
|
|
|
// Initialize
|
|
|
|
this.lumpname = lumpname;
|
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
this.flipx = false;
|
|
|
|
this.flipy = false;
|
|
|
|
this.rotate = 0;
|
|
|
|
this.blend = new PixelColor(0, 0, 0, 0);
|
|
|
|
this.alpha = 1.0f;
|
|
|
|
this.style = TexturePathRenderStyle.Copy;
|
2013-03-18 13:52:27 +00:00
|
|
|
this.blendstyle = TexturePathBlendStyle.None;//mxd
|
|
|
|
this.tintammount = 0; //mxd
|
2014-11-25 11:52:01 +00:00
|
|
|
this.haslongname = false; //mxd
|
2016-02-15 14:06:46 +00:00
|
|
|
this.skip = false; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
//mxd. Constructor for hires patches
|
2014-12-03 23:15:26 +00:00
|
|
|
public TexturePatch(PatchStructure patch)
|
|
|
|
{
|
2009-04-19 18:07:22 +00:00
|
|
|
// Initialize
|
2013-03-18 13:52:27 +00:00
|
|
|
this.lumpname = patch.Name.ToUpperInvariant();
|
|
|
|
this.x = patch.OffsetX;
|
|
|
|
this.y = patch.OffsetY;
|
|
|
|
this.flipx = patch.FlipX;
|
|
|
|
this.flipy = patch.FlipY;
|
|
|
|
this.rotate = patch.Rotation;
|
|
|
|
this.blend = patch.BlendColor;
|
|
|
|
this.alpha = patch.Alpha;
|
|
|
|
this.style = patch.RenderStyle;
|
|
|
|
this.blendstyle = patch.BlendStyle;
|
|
|
|
this.tintammount = patch.TintAmmount;
|
2014-11-25 11:52:01 +00:00
|
|
|
this.haslongname = (Path.GetFileNameWithoutExtension(this.lumpname) != this.lumpname);
|
2016-02-15 14:06:46 +00:00
|
|
|
this.skip = patch.Skip;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
//mxd. Check data so we don't perform unneeded operations later on
|
2014-11-25 11:52:01 +00:00
|
|
|
if(this.alpha == 1.0f)
|
|
|
|
{
|
2015-12-04 12:29:22 +00:00
|
|
|
switch(this.style)
|
|
|
|
{
|
|
|
|
case TexturePathRenderStyle.Blend:
|
|
|
|
case TexturePathRenderStyle.CopyAlpha:
|
|
|
|
case TexturePathRenderStyle.CopyNewAlpha:
|
|
|
|
case TexturePathRenderStyle.Overlay:
|
|
|
|
this.style = TexturePathRenderStyle.Copy;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. and get rid of render styles we don't support
|
2014-12-03 23:15:26 +00:00
|
|
|
if(this.style == TexturePathRenderStyle.Overlay) this.style = TexturePathRenderStyle.Copy;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|