Skip to content

ICamera.IsVisible Method

Definition

Namespace: Brine2D.Rendering

Overloads
IsVisible\(Rectangle\) Checks if a rectangle is visible by the camera \(frustum culling\).
IsVisible\(Vector2\) Checks if a world position is visible by the camera.

ICamera.IsVisible\(Rectangle\) Method

Checks if a rectangle is visible by the camera \(frustum culling\).

C#
bool IsVisible(Brine2D.Core.Rectangle worldBounds);

Parameters

worldBounds Rectangle

Rectangle in world space.

Returns

System.Boolean
True if the rectangle intersects with the camera's view frustum.

Example

C#
var spriteBounds = new Rectangle(sprite.X, sprite.Y, sprite.Width, sprite.Height);
if (camera.IsVisible(spriteBounds))
{
    renderer.DrawTexture(sprite.Texture, ...);
}

ICamera.IsVisible\(Vector2\) Method

Checks if a world position is visible by the camera.

C#
bool IsVisible(System.Numerics.Vector2 worldPosition);

Parameters

worldPosition System.Numerics.Vector2

Position in world space.

Returns

System.Boolean
True if the position is within the camera's view frustum.