Frustum

Frustum — A 3D field of view

Functions

Types and Values

Includes

#include <graphene.h>

Description

A graphene_frustum_t represents a volume of space delimited by planes. It is usually employed to represent the field of view of a camera, and can be used to determine whether an object falls within that view, to efficiently remove invisible objects from the render process.

Functions

graphene_frustum_alloc ()

graphene_frustum_t *
graphene_frustum_alloc (void);

Allocates a new graphene_frustum_t structure.

The contents of the returned structure are undefined.

[constructor]

Returns

the newly allocated graphene_frustum_t structure. Use graphene_frustum_free() to free the resources allocated by this function.

[transfer full]

Since: 1.2


graphene_frustum_free ()

void
graphene_frustum_free (graphene_frustum_t *f);

Frees the resources allocated by graphene_frustum_alloc().

Parameters

Since: 1.2


graphene_frustum_init ()

graphene_frustum_t *
graphene_frustum_init (graphene_frustum_t *f,
                       const graphene_plane_t *p0,
                       const graphene_plane_t *p1,
                       const graphene_plane_t *p2,
                       const graphene_plane_t *p3,
                       const graphene_plane_t *p4,
                       const graphene_plane_t *p5);

Initializes the given graphene_frustum_t using the provided clipping planes.

Parameters

f

the graphene_frustum_t to initialize

 

p0

a clipping plane

 

p1

a clipping plane

 

p2

a clipping plane

 

p3

a clipping plane

 

p4

a clipping plane

 

p5

a clipping plane

 

Returns

the initialized frustum.

[transfer none]

Since: 1.2


graphene_frustum_init_from_frustum ()

graphene_frustum_t *
graphene_frustum_init_from_frustum (graphene_frustum_t *f,
                                    const graphene_frustum_t *src);

Initializes the given graphene_frustum_t using the clipping planes of another graphene_frustum_t.

Parameters

f

the graphene_frustum_t to initialize

 

src

a graphene_frustum_t

 

Returns

the initialized frustum.

[transfer none]

Since: 1.2


graphene_frustum_init_from_matrix ()

graphene_frustum_t *
graphene_frustum_init_from_matrix (graphene_frustum_t *f,
                                   const graphene_matrix_t *matrix);

Initializes a graphene_frustum_t using the given matrix .

Parameters

Returns

the initialized frustum.

[transfer none]

Since: 1.2


graphene_frustum_get_planes ()

void
graphene_frustum_get_planes (const graphene_frustum_t *f,
                             graphene_plane_t planes[]);

Retrieves the planes that define the given graphene_frustum_t.

Parameters

f

a graphene_frustum_t

 

planes

return location for an array of 6 graphene_plane_t.

[out][array fixed-size=6]

Since: 1.2


graphene_frustum_contains_point ()

bool
graphene_frustum_contains_point (const graphene_frustum_t *f,
                                 const graphene_point3d_t *point);

Checks whether a point is inside the volume defined by the given graphene_frustum_t.

Parameters

Returns

true if the point is inside the frustum

Since: 1.2


graphene_frustum_intersects_sphere ()

bool
graphene_frustum_intersects_sphere (const graphene_frustum_t *f,
                                    const graphene_sphere_t *sphere);

Checks whether the given sphere intersects a plane of a graphene_frustum_t.

Parameters

Returns

true if the sphere intersects the frustum

Since: 1.2


graphene_frustum_intersects_box ()

bool
graphene_frustum_intersects_box (const graphene_frustum_t *f,
                                 const graphene_box_t *box);

Checks whether the given box intersects a plane of a graphene_frustum_t.

Parameters

Returns

true if the box intersects the frustum

Since: 1.2


graphene_frustum_equal ()

bool
graphene_frustum_equal (const graphene_frustum_t *a,
                        const graphene_frustum_t *b);

Checks whether the two given graphene_frustum_t are equal.

Parameters

Returns

true if the given frustums are equal

Since: 1.6

Types and Values

graphene_frustum_t

typedef struct {
} graphene_frustum_t;

A 3D volume delimited by 2D clip planes.

The contents of the graphene_frustum_t are private, and should not be modified directly.

Since: 1.2