2015-10-02 14:47:34 +00:00
|
|
|
|
/*#region ================== Namespaces
|
2014-09-17 12:46:47 +00:00
|
|
|
|
|
|
|
|
|
using System;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
using SlimDX.Direct3D9;
|
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
|
|
2014-09-17 12:46:47 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.GZBuilder.Rendering
|
2012-04-17 19:13:47 +00:00
|
|
|
|
{
|
2014-09-17 12:46:47 +00:00
|
|
|
|
sealed class ThingBoundingBox : IDisposable, ID3DResource
|
2013-09-11 09:47:53 +00:00
|
|
|
|
{
|
2014-09-17 12:46:47 +00:00
|
|
|
|
|
|
|
|
|
#region ================== Variables
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
private VertexBuffer cage;
|
|
|
|
|
private VertexBuffer arrow;
|
2014-09-17 12:46:47 +00:00
|
|
|
|
private bool isdisposed;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
|
|
public VertexBuffer Cage { get { return cage; } }
|
|
|
|
|
public VertexBuffer Arrow { get { return arrow; } }
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
|
|
public ThingBoundingBox()
|
|
|
|
|
{
|
|
|
|
|
// Create geometry
|
|
|
|
|
ReloadResource();
|
|
|
|
|
|
|
|
|
|
// Register as resource
|
|
|
|
|
General.Map.Graphics.RegisterResource(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
// Not already disposed?
|
|
|
|
|
if (!isdisposed)
|
|
|
|
|
{
|
|
|
|
|
if (arrow != null) arrow.Dispose();
|
|
|
|
|
if (cage != null) cage.Dispose();
|
|
|
|
|
|
|
|
|
|
// Unregister resource
|
|
|
|
|
General.Map.Graphics.UnregisterResource(this);
|
|
|
|
|
|
|
|
|
|
// Done
|
|
|
|
|
isdisposed = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
|
|
// This is called resets when the device is reset
|
|
|
|
|
// (when resized or display adapter was changed)
|
|
|
|
|
public void ReloadResource()
|
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
WorldVertex v0 = new WorldVertex(-1.0f, -1.0f, 0.0f);
|
|
|
|
|
WorldVertex v1 = new WorldVertex(-1.0f, 1.0f, 0.0f);
|
|
|
|
|
WorldVertex v2 = new WorldVertex(1.0f, 1.0f, 0.0f);
|
|
|
|
|
WorldVertex v3 = new WorldVertex(1.0f, -1.0f, 0.0f);
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
WorldVertex v4 = new WorldVertex(-1.0f, -1.0f, 1.0f);
|
|
|
|
|
WorldVertex v5 = new WorldVertex(-1.0f, 1.0f, 1.0f);
|
|
|
|
|
WorldVertex v6 = new WorldVertex(1.0f, 1.0f, 1.0f);
|
|
|
|
|
WorldVertex v7 = new WorldVertex(1.0f, -1.0f, 1.0f);
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
//cage
|
|
|
|
|
WorldVertex[] cageVerts = new WorldVertex[] { v0, v1,
|
|
|
|
|
v1, v2,
|
|
|
|
|
v2, v3,
|
|
|
|
|
v3, v0,
|
|
|
|
|
v4, v5,
|
|
|
|
|
v5, v6,
|
|
|
|
|
v6, v7,
|
|
|
|
|
v7, v4,
|
|
|
|
|
v0, v4,
|
|
|
|
|
v1, v5,
|
|
|
|
|
v2, v6,
|
|
|
|
|
v3, v7 };
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2014-09-17 12:46:47 +00:00
|
|
|
|
cage = new VertexBuffer(General.Map.Graphics.Device, WorldVertex.Stride * cageVerts.Length, Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
|
|
|
|
|
cage.Lock(0, WorldVertex.Stride * cageVerts.Length, LockFlags.None).WriteRange(cageVerts);
|
2013-09-11 09:47:53 +00:00
|
|
|
|
cage.Unlock();
|
2014-09-17 12:46:47 +00:00
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
//arrow
|
|
|
|
|
WorldVertex a0 = new WorldVertex(); //start
|
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
|
|
|
|
WorldVertex a1 = new WorldVertex( 0.0f, -1.5f, 0.0f); //end
|
|
|
|
|
WorldVertex a2 = new WorldVertex( 0.2f, -1.1f, 0.2f);
|
|
|
|
|
WorldVertex a3 = new WorldVertex(-0.2f, -1.1f, 0.2f);
|
|
|
|
|
WorldVertex a4 = new WorldVertex( 0.2f, -1.1f, -0.2f);
|
|
|
|
|
WorldVertex a5 = new WorldVertex(-0.2f, -1.1f, -0.2f);
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
WorldVertex[] arrowVerts = new WorldVertex[] {a0, a1,
|
|
|
|
|
a1, a2,
|
|
|
|
|
a1, a3,
|
|
|
|
|
a1, a4,
|
|
|
|
|
a1, a5};
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2014-09-17 12:46:47 +00:00
|
|
|
|
arrow = new VertexBuffer(General.Map.Graphics.Device, WorldVertex.Stride * arrowVerts.Length, Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
|
|
|
|
|
arrow.Lock(0, WorldVertex.Stride * arrowVerts.Length, LockFlags.None).WriteRange(arrowVerts);
|
2013-09-11 09:47:53 +00:00
|
|
|
|
arrow.Unlock();
|
|
|
|
|
}
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2014-09-17 12:46:47 +00:00
|
|
|
|
// This is called before a device is reset
|
|
|
|
|
// (when resized or display adapter was changed)
|
|
|
|
|
public void UnloadResource()
|
|
|
|
|
{
|
|
|
|
|
// Trash geometry buffers
|
|
|
|
|
if(cage != null) cage.Dispose();
|
|
|
|
|
if(arrow != null) arrow.Dispose();
|
|
|
|
|
cage = null;
|
|
|
|
|
arrow = null;
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2014-09-17 12:46:47 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2015-10-02 14:47:34 +00:00
|
|
|
|
}*/
|