mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Fixed, Things mode: Undo for things cloning by Shift-dragging them was created incorrectly (cloned things were moved to their initial position, but not removed).
Fixed, Visual mode: fixed Classic sky texture generation artifact when Bilinear filtering was enabled in Visual mode. Fixed, Visual mode: fixed Classic sky texture generation artifact when non-power-of-2 Sky textures were used. Fixed, Visual mode: dynamic lights flickering on surfaces nearly-perpendicular to lights centers should be much harder to trigger now.
This commit is contained in:
parent
acdcd81913
commit
839bb52cb9
6 changed files with 59 additions and 40 deletions
|
@ -2559,6 +2559,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Set render settings...
|
||||
device.SetRenderState(RenderState.ZEnable, false);
|
||||
device.SetRenderState(RenderState.CullMode, Cull.None);
|
||||
device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp);
|
||||
device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp);
|
||||
|
||||
// Setup matrices
|
||||
Vector3 offset = new Vector3(0f, 0f, -1.8f); // Sphere size is 10 mu
|
||||
|
@ -2903,14 +2905,17 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
private static Texture TextureFromBitmap(Device device, Image image)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
image.Save(ms, ImageFormat.Png);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
Texture result = Texture.FromStream(device, ms);
|
||||
ms.Close();
|
||||
ms.Dispose();
|
||||
using(MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
image.Save(ms, ImageFormat.Png);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
return result;
|
||||
// Classic skies textures can be NPo2 (and D3D Texture is resized to Po2 by default),
|
||||
// so we need to explicitly specify the size
|
||||
return Texture.FromStream(device, ms, (int) ms.Length,
|
||||
image.Size.Width, image.Size.Height, 0, Usage.None, Format.Unknown,
|
||||
Pool.Managed, Filter.None, Filter.None, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -418,9 +418,6 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
}
|
||||
}
|
||||
|
||||
// Offset it slightly to avoid shading glitches
|
||||
if(light.Offset.Z == 0.0f) light.Offset.Z = 0.1f;
|
||||
|
||||
// Add to the collection?
|
||||
if(!skip) lightsbyname[lightname] = light;
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
device.SetRenderState(RenderState.CullMode, Cull.None);
|
||||
device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
|
||||
device.SetRenderState(RenderState.DiffuseMaterialSource, ColorSource.Color1);
|
||||
device.SetRenderState(RenderState.DitherEnable, true);
|
||||
//device.SetRenderState(RenderState.DitherEnable, true);
|
||||
device.SetRenderState(RenderState.FillMode, FillMode.Solid);
|
||||
device.SetRenderState(RenderState.FogEnable, false);
|
||||
device.SetRenderState(RenderState.FogTableMode, FogMode.Linear);
|
||||
|
@ -154,6 +154,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
device.SetRenderState(RenderState.NormalizeNormals, false);
|
||||
device.SetRenderState(RenderState.PointSpriteEnable, false);
|
||||
device.SetRenderState(RenderState.RangeFogEnable, false);
|
||||
device.SetRenderState(RenderState.ShadeMode, ShadeMode.Flat); //mxd
|
||||
device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||
device.SetRenderState(RenderState.SpecularEnable, false);
|
||||
device.SetRenderState(RenderState.StencilEnable, false);
|
||||
|
|
|
@ -237,7 +237,7 @@ float4 ps_vertex_color(PixelData pd) : COLOR
|
|||
float4 ps_lightpass(LitPixelData pd) : COLOR
|
||||
{
|
||||
//is face facing away from light source?
|
||||
if(dot(pd.normal, (lightPosAndRadius.xyz - pd.pos_w)) < -0.1f) // (lightPosAndRadius.xyz - pd.pos_w) == direction from light to current pixel
|
||||
if(dot(pd.normal, normalize(lightPosAndRadius.xyz - pd.pos_w)) < -0.1f) // (lightPosAndRadius.xyz - pd.pos_w) == direction from light to current pixel
|
||||
clip(-1);
|
||||
|
||||
//is pixel in light range?
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private readonly Vector2D dragstartmappos;
|
||||
|
||||
//mxd. Offset from nearest grid intersection to dragstartmappos
|
||||
private Vector2D dragstartoffset;
|
||||
private readonly Vector2D dragstartoffset;
|
||||
|
||||
// Item used as reference for snapping to the grid
|
||||
private readonly Thing dragitem;
|
||||
|
@ -63,6 +63,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// List of old thing positions
|
||||
private readonly List<Vector2D> oldpositions;
|
||||
|
||||
//mxd
|
||||
private bool makeundo;
|
||||
|
||||
//mxd
|
||||
private class AlignData
|
||||
{
|
||||
|
@ -111,11 +114,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor to start dragging immediately
|
||||
public DragThingsMode(EditMode basemode, Vector2D dragstartmappos)
|
||||
public DragThingsMode(EditMode basemode, Vector2D dragstartmappos, bool makeundo)
|
||||
{
|
||||
// Initialize
|
||||
this.dragstartmappos = dragstartmappos;
|
||||
this.basemode = basemode;
|
||||
this.makeundo = makeundo; //mxd
|
||||
|
||||
Cursor.Current = Cursors.AppStarting;
|
||||
|
||||
|
@ -371,7 +375,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Make undo for the dragging
|
||||
General.Map.UndoRedo.CreateUndo((selectedthings.Count == 1 ? "Drag thing" : "Drag " + selectedthings.Count + " things"));
|
||||
if(makeundo) //mxd
|
||||
General.Map.UndoRedo.CreateUndo((selectedthings.Count == 1 ? "Drag thing" : "Drag " + selectedthings.Count + " things"));
|
||||
|
||||
// Move selected geometry to final position
|
||||
if(aligndata != null && aligndata.Active) //mxd. Apply aligning
|
||||
|
|
|
@ -597,43 +597,54 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag()) //mxd
|
||||
{
|
||||
// Shift pressed? Clone things!
|
||||
bool thingscloned = false;
|
||||
if(General.Interface.ShiftState)
|
||||
{
|
||||
ICollection<Thing> selection = General.Map.Map.GetSelectedThings(true);
|
||||
foreach(Thing t in selection)
|
||||
if(selection.Count > 0)
|
||||
{
|
||||
Thing clone = InsertThing(t.Position);
|
||||
t.CopyPropertiesTo(clone);
|
||||
// Make undo
|
||||
General.Map.UndoRedo.CreateUndo((selection.Count == 1 ? "Clone-drag thing" : "Clone-drag " + selection.Count + " things"));
|
||||
|
||||
// If the cloned item is an interpolation point or patrol point, then insert the point in the path
|
||||
ThingTypeInfo info = General.Map.Data.GetThingInfo(t.Type);
|
||||
int nextpointtagargnum = -1;
|
||||
|
||||
// Thing type can be changed in MAPINFO DoomEdNums block...
|
||||
switch(info.ClassName.ToLowerInvariant())
|
||||
// Clone things
|
||||
foreach(Thing t in selection)
|
||||
{
|
||||
case "interpolationpoint":
|
||||
nextpointtagargnum = 3;
|
||||
break;
|
||||
Thing clone = InsertThing(t.Position);
|
||||
t.CopyPropertiesTo(clone);
|
||||
|
||||
case "patrolpoint":
|
||||
nextpointtagargnum = 0;
|
||||
break;
|
||||
// If the cloned item is an interpolation point or patrol point, then insert the point in the path
|
||||
ThingTypeInfo info = General.Map.Data.GetThingInfo(t.Type);
|
||||
int nextpointtagargnum = -1;
|
||||
|
||||
// Thing type can be changed in MAPINFO DoomEdNums block...
|
||||
switch(info.ClassName.ToLowerInvariant())
|
||||
{
|
||||
case "interpolationpoint":
|
||||
nextpointtagargnum = 3;
|
||||
break;
|
||||
|
||||
case "patrolpoint":
|
||||
nextpointtagargnum = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// Apply changes?
|
||||
if(nextpointtagargnum != -1)
|
||||
{
|
||||
if(t.Tag == 0) t.Tag = General.Map.Map.GetNewTag();
|
||||
t.Args[nextpointtagargnum] = clone.Tag = General.Map.Map.GetNewTag();
|
||||
}
|
||||
|
||||
t.Selected = false;
|
||||
clone.Selected = true;
|
||||
}
|
||||
|
||||
// Apply changes?
|
||||
if(nextpointtagargnum != -1)
|
||||
{
|
||||
if(t.Tag == 0) t.Tag = General.Map.Map.GetNewTag();
|
||||
t.Args[nextpointtagargnum] = clone.Tag = General.Map.Map.GetNewTag();
|
||||
}
|
||||
|
||||
t.Selected = false;
|
||||
clone.Selected = true;
|
||||
// We'll want to skip creating additional Undo in DragThingsMode
|
||||
thingscloned = true;
|
||||
}
|
||||
}
|
||||
|
||||
General.Editing.ChangeMode(new DragThingsMode(new ThingsMode(), mousedownmappos));
|
||||
General.Editing.ChangeMode(new DragThingsMode(new ThingsMode(), mousedownmappos, !thingscloned));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue