mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
Fixed a problem where the DistanceCheck actor property didn't work correctly, resulting in things unexpectedly not being drawn in Visual Mode
This commit is contained in:
parent
cd7a156cd7
commit
931bd1e225
2 changed files with 27 additions and 12 deletions
|
@ -934,12 +934,17 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Update buffer if needed
|
||||
t.Update();
|
||||
|
||||
//mxd. Check 3D distance. Check against MaxValue to save doing GetLenthSq if there's not DistanceCheck defined
|
||||
if (t.Info.DistanceCheckSq < double.MaxValue && (t.Thing.Position - cameraposition).GetLengthSq() > t.Info.DistanceCheckSq)
|
||||
continue;
|
||||
//mxd. Check 3D distance. Check against MaxValue to save doing GetLenthSq if there's not DistanceCheck defined
|
||||
if (t.Info.DistanceCheckSq < double.MaxValue)
|
||||
{
|
||||
t.CalculateCameraDistance(cameraposition);
|
||||
|
||||
if (t.CameraDistance > t.Info.DistanceCheckSq)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only do this sector when a vertexbuffer is created
|
||||
if(t.GeometryBuffer != null)
|
||||
if (t.GeometryBuffer != null)
|
||||
{
|
||||
// Determine the shader pass we want to use for this object
|
||||
ShaderName wantedshaderpass = (((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass;
|
||||
|
@ -1248,9 +1253,14 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
t.Update();
|
||||
|
||||
//mxd. Check 3D distance. Check against MaxValue to save doing GetLenthSq if there's not DistanceCheck defined
|
||||
if (t.Info.DistanceCheckSq < double.MaxValue && (t.Thing.Position - cameraposition).GetLengthSq() > t.Info.DistanceCheckSq)
|
||||
continue;
|
||||
|
||||
if (t.Info.DistanceCheckSq < double.MaxValue)
|
||||
{
|
||||
t.CalculateCameraDistance(cameraposition);
|
||||
|
||||
if (t.CameraDistance > t.Info.DistanceCheckSq)
|
||||
continue;
|
||||
}
|
||||
|
||||
t.UpdateSpriteFrame(); // Set correct texture, geobuffer and triangles count
|
||||
if(t.Texture is UnknownImage) continue;
|
||||
|
||||
|
@ -1471,8 +1481,13 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
t.Update();
|
||||
|
||||
// Check 3D distance. Check against MaxValue to save doing GetLenthSq if there's not DistanceCheck defined
|
||||
if (t.Info.DistanceCheckSq < double.MaxValue && (t.Thing.Position - cameraposition).GetLengthSq() > t.Info.DistanceCheckSq)
|
||||
continue;
|
||||
if (t.Info.DistanceCheckSq < double.MaxValue)
|
||||
{
|
||||
t.CalculateCameraDistance(cameraposition);
|
||||
|
||||
if (t.CameraDistance > t.Info.DistanceCheckSq)
|
||||
continue;
|
||||
}
|
||||
|
||||
Color4 vertexcolor = new Color4(t.VertexColor);
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
// Rendering
|
||||
private RenderPass renderpass;
|
||||
private Matrix position;
|
||||
private int cameradistance;
|
||||
private double cameradistance;
|
||||
private Color4 cagecolor;
|
||||
protected bool sizeless; //mxd. Used to render visual things with 0 width and height
|
||||
protected float fogfactor; //mxd
|
||||
|
@ -125,7 +125,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
|
||||
//mxd
|
||||
internal int VertexColor { get { return vertices.Length > 0 && vertices[0].Length > 0 ? vertices[0][0].c : 0; } }
|
||||
public int CameraDistance { get { return cameradistance; } }
|
||||
public double CameraDistance { get { return cameradistance; } }
|
||||
public float FogFactor { get { return fogfactor; } }
|
||||
public Vector3f Center
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
//mxd
|
||||
internal void CalculateCameraDistance(Vector3D campos)
|
||||
{
|
||||
cameradistance = (int)((CenterV3D - campos).GetLengthSq());
|
||||
cameradistance = (CenterV3D - campos).GetLengthSq();
|
||||
}
|
||||
|
||||
// This is called before a device is reset (when resized or display adapter was changed)
|
||||
|
|
Loading…
Reference in a new issue