Files
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

50 lines
900 B
C#

using Sandbox.UI;
using System;
using System.Runtime.InteropServices;
/// <summary>
/// Generally used to describe the size of textures
/// </summary>
[StructLayout( LayoutKind.Sequential )]
internal struct Rect3D
{
public int x, y, z;
public int width, height, depth;
public Rect3D( int x, int y, int z, int width, int height, int depth )
{
this.x = x;
this.y = y;
this.z = z;
this.width = width;
this.height = height;
this.depth = depth;
}
void Clear()
{
x = 0;
y = 0;
z = 0;
width = 0;
height = 0;
depth = 0;
}
int Size()
{
return width * height * depth;
}
bool Intersects( Rect3D other )
{
if ( (x + width <= other.x) || (other.x + other.width <= x) ) return false;
if ( (y + height <= other.y) || (other.y + other.height <= y) ) return false;
if ( (z + depth <= other.z) || (other.z + other.depth <= z) ) return false;
return true;
}
}