Merged in GZDB r2496.

This commit is contained in:
MascaraSnake 2016-04-07 16:27:49 +02:00
parent 7a82022239
commit 264a883e47
6 changed files with 80 additions and 62 deletions

View File

@ -2682,6 +2682,8 @@ namespace CodeImp.DoomBuilder.Data
// Set render settings... // Set render settings...
device.SetRenderState(RenderState.ZEnable, false); device.SetRenderState(RenderState.ZEnable, false);
device.SetRenderState(RenderState.CullMode, Cull.None); device.SetRenderState(RenderState.CullMode, Cull.None);
device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp);
device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp);
// Setup matrices // Setup matrices
Vector3 offset = new Vector3(0f, 0f, -1.8f); // Sphere size is 10 mu Vector3 offset = new Vector3(0f, 0f, -1.8f); // Sphere size is 10 mu
@ -3026,14 +3028,17 @@ namespace CodeImp.DoomBuilder.Data
private static Texture TextureFromBitmap(Device device, Image image) private static Texture TextureFromBitmap(Device device, Image image)
{ {
MemoryStream ms = new MemoryStream(); using (MemoryStream ms = new MemoryStream())
image.Save(ms, ImageFormat.Png); {
ms.Seek(0, SeekOrigin.Begin); image.Save(ms, ImageFormat.Png);
Texture result = Texture.FromStream(device, ms); ms.Seek(0, SeekOrigin.Begin);
ms.Close();
ms.Dispose();
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 #endregion

View File

@ -421,9 +421,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? // Add to the collection?
if (!skip) lightsbyname[lightname] = light; if (!skip) lightsbyname[lightname] = light;

View File

@ -145,7 +145,7 @@ namespace CodeImp.DoomBuilder.Rendering
device.SetRenderState(RenderState.CullMode, Cull.None); device.SetRenderState(RenderState.CullMode, Cull.None);
device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha); device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
device.SetRenderState(RenderState.DiffuseMaterialSource, ColorSource.Color1); 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.FillMode, FillMode.Solid);
device.SetRenderState(RenderState.FogEnable, false); device.SetRenderState(RenderState.FogEnable, false);
device.SetRenderState(RenderState.FogTableMode, FogMode.Linear); device.SetRenderState(RenderState.FogTableMode, FogMode.Linear);
@ -154,7 +154,8 @@ namespace CodeImp.DoomBuilder.Rendering
device.SetRenderState(RenderState.NormalizeNormals, false); device.SetRenderState(RenderState.NormalizeNormals, false);
device.SetRenderState(RenderState.PointSpriteEnable, false); device.SetRenderState(RenderState.PointSpriteEnable, false);
device.SetRenderState(RenderState.RangeFogEnable, false); device.SetRenderState(RenderState.RangeFogEnable, false);
device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha); device.SetRenderState(RenderState.ShadeMode, ShadeMode.Flat); //mxd
device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
device.SetRenderState(RenderState.SpecularEnable, false); device.SetRenderState(RenderState.SpecularEnable, false);
device.SetRenderState(RenderState.StencilEnable, false); device.SetRenderState(RenderState.StencilEnable, false);
device.SetRenderState(RenderState.TextureFactor, -1); device.SetRenderState(RenderState.TextureFactor, -1);

View File

@ -237,7 +237,7 @@ float4 ps_vertex_color(PixelData pd) : COLOR
float4 ps_lightpass(LitPixelData pd) : COLOR float4 ps_lightpass(LitPixelData pd) : COLOR
{ {
//is face facing away from light source? //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); clip(-1);
//is pixel in light range? //is pixel in light range?

View File

@ -54,7 +54,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private readonly Vector2D dragstartmappos; private readonly Vector2D dragstartmappos;
//mxd. Offset from nearest grid intersection to 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 // Item used as reference for snapping to the grid
private readonly Thing dragitem; private readonly Thing dragitem;
@ -63,8 +63,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
// List of old thing positions // List of old thing positions
private readonly List<Vector2D> oldpositions; private readonly List<Vector2D> oldpositions;
//mxd //mxd
private class AlignData private bool makeundo;
//mxd
private class AlignData
{ {
public readonly int InitialAngle; public readonly int InitialAngle;
public int CurrentAngle; public int CurrentAngle;
@ -105,19 +108,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Just keep the base mode button checked // Just keep the base mode button checked
public override string EditModeButtonName { get { return basemode.GetType().Name; } } public override string EditModeButtonName { get { return basemode.GetType().Name; } }
#endregion
#region ================== Constructor / Disposer #endregion
// Constructor to start dragging immediately #region ================== Constructor / Disposer
public DragThingsMode(EditMode basemode, Vector2D dragstartmappos)
{ // Constructor to start dragging immediately
public DragThingsMode(EditMode basemode, Vector2D dragstartmappos, bool makeundo)
{
// Initialize // Initialize
this.dragstartmappos = dragstartmappos; this.dragstartmappos = dragstartmappos;
this.basemode = basemode; this.basemode = basemode;
this.makeundo = makeundo; //mxd
Cursor.Current = Cursors.AppStarting; Cursor.Current = Cursors.AppStarting;
// Mark what we are dragging // Mark what we are dragging
General.Map.Map.ClearAllMarks(false); General.Map.Map.ClearAllMarks(false);
@ -371,11 +375,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
dragitem.Move(dragitem.Position.x, dragitem.Position.y, aligndata.InitialHeight); dragitem.Move(dragitem.Position.x, dragitem.Position.y, aligndata.InitialHeight);
} }
// Make undo for the dragging if (makeundo) //mxd
General.Map.UndoRedo.CreateUndo((selectedthings.Count == 1 ? "Drag thing" : "Drag " + selectedthings.Count + " things")); General.Map.UndoRedo.CreateUndo((selectedthings.Count == 1 ? "Drag thing" : "Drag " + selectedthings.Count + " things"));
// Move selected geometry to final position // Move selected geometry to final position
if(aligndata != null && aligndata.Active) //mxd. Apply aligning if (aligndata != null && aligndata.Active) //mxd. Apply aligning
{ {
if(!aligndata.Position.IsEmpty) if(!aligndata.Position.IsEmpty)
dragitem.Move(aligndata.Position.X, aligndata.Position.Y, aligndata.CurrentHeight); dragitem.Move(aligndata.Position.X, aligndata.Position.Y, aligndata.CurrentHeight);

View File

@ -596,47 +596,58 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Start dragging the selection // Start dragging the selection
if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag()) //mxd if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag()) //mxd
{ {
// Shift pressed? Clone things! // Shift pressed? Clone things!
if(General.Interface.ShiftState) bool thingscloned = false;
{ if (General.Interface.ShiftState)
ICollection<Thing> selection = General.Map.Map.GetSelectedThings(true); {
foreach(Thing t in selection) ICollection<Thing> selection = General.Map.Map.GetSelectedThings(true);
{ 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 // Clone things
ThingTypeInfo info = General.Map.Data.GetThingInfo(t.SRB2Type); foreach (Thing t in selection)
int nextpointtagargnum = -1; {
Thing clone = InsertThing(t.Position);
t.CopyPropertiesTo(clone);
// Thing type can be changed in MAPINFO DoomEdNums block... // If the cloned item is an interpolation point or patrol point, then insert the point in the path
switch(info.ClassName.ToLowerInvariant()) ThingTypeInfo info = General.Map.Data.GetThingInfo(t.SRB2Type);
{ int nextpointtagargnum = -1;
case "interpolationpoint":
nextpointtagargnum = 3;
break;
case "patrolpoint": // Thing type can be changed in MAPINFO DoomEdNums block...
nextpointtagargnum = 0; switch (info.ClassName.ToLowerInvariant())
break; {
} case "interpolationpoint":
nextpointtagargnum = 3;
break;
// Apply changes? case "patrolpoint":
if(nextpointtagargnum != -1) nextpointtagargnum = 0;
{ break;
if(t.Tag == 0) t.Tag = General.Map.Map.GetNewTag(); }
t.Args[nextpointtagargnum] = clone.Tag = General.Map.Map.GetNewTag();
}
t.Selected = false; // Apply changes?
clone.Selected = true; if (nextpointtagargnum != -1)
} {
} if (t.Tag == 0) t.Tag = General.Map.Map.GetNewTag();
t.Args[nextpointtagargnum] = clone.Tag = General.Map.Map.GetNewTag();
}
General.Editing.ChangeMode(new DragThingsMode(new ThingsMode(), mousedownmappos)); 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, !thingscloned));
}
}
} }
} }