VISU - PHP Game Framework

Debug3DRenderer
in package

Table of Contents

Properties

$colorBlack  : Vec3
$colorBlue  : Vec3
$colorCyan  : Vec3
$colorGreen  : Vec3
$colorMagenta  : Vec3
$colorRed  : Vec3
Color helper "constants"
$colorWhite  : Vec3
$colorYellow  : Vec3
$glstate  : GLState
$instance  : Debug3DRenderer|null
Static instance for easy access to the debugger.
$shaderProgram  : ShaderProgram
The debug 3D shader program.
$VAO  : int
GL Vertex array object id
$VBO  : int
GL Vertex buffer object id
$vertices  : FloatBuffer
Vertex data holder, this is regenerated every frame.

Methods

__construct()  : mixed
Constructor
aabb()  : void
Draws an axis aligned bounding box
aabb2D()  : void
Draws a 2D axis aligned bounding box
addAABB()  : void
Draws an axis aligned bounding box
addAABB2D()  : void
Draws a 2D axis aligned bounding box
addBezierCurve()  : void
Draws a bezier curve
addCross()  : void
Draws a cross at the given position
addFrustum()  : void
Draws a Frustum
addLine()  : void
Draws a line from the given origin to the given destination
addPlane()  : void
Draws a plane in 3D space
addRay()  : void
Adds a ray to the debug 3D render queue
attachPass()  : void
Attaches a render pass to the pipeline
bezier()  : void
Draws a 2 control point bezier curve
cross()  : void
Draws a cross at the given position
frustum()  : void
Draws a line representation of the given frustum
getGlobalInstance()  : Debug3DRenderer
Returns a global instance of the debug 3D renderer.
plane()  : void
Draws a plane in 3D space
ray()  : void
Adds a ray to the debug 3D render queue
setGlobalInstance()  : void
Sets the global instance of the debug 3D renderer.
createVAO()  : void
Creates the vertex array and buffer objects

Properties

$instance

Static instance for easy access to the debugger.

private static Debug3DRenderer|null $instance = null

This class should really not end up being used in PROD mode. So in most cases it is used to quickly debug something, which is why it needs to be easily accessible.

$vertices

Vertex data holder, this is regenerated every frame.

private FloatBuffer $vertices

Methods

aabb()

Draws an axis aligned bounding box

public static aabb(Vec3 $origin, Vec3 $min, Vec3 $max, Vec3 $color) : void
Parameters
$origin : Vec3

The origin of the box

$min : Vec3

The minimum point of the box

$max : Vec3

The maximum point of the box

$color : Vec3

The color of the box

aabb2D()

Draws a 2D axis aligned bounding box

public static aabb2D(Vec2 $origin, Vec2 $min, Vec2 $max, Vec3 $color) : void
Parameters
$origin : Vec2

The origin of the box

$min : Vec2

The minimum point of the box

$max : Vec2

The maximum point of the box

$color : Vec3

The color of the box

addAABB()

Draws an axis aligned bounding box

public addAABB(Vec3 $origin, Vec3 $min, Vec3 $max, Vec3 $color) : void
Parameters
$origin : Vec3

The origin of the box

$min : Vec3

The minimum point of the box

$max : Vec3

The maximum point of the box

$color : Vec3

The color of the box

addAABB2D()

Draws a 2D axis aligned bounding box

public addAABB2D(Vec2 $origin, Vec2 $min, Vec2 $max, Vec3 $color) : void
Parameters
$origin : Vec2

The origin of the box

$min : Vec2

The minimum point of the box

$max : Vec2

The maximum point of the box

$color : Vec3

The color of the box

addBezierCurve()

Draws a bezier curve

public addBezierCurve(Vec3 $origin, Vec3 $p0, Vec3 $destination, Vec3 $color[, int $segments = 10 ]) : void
Parameters
$origin : Vec3

The origin of the curve

$p0 : Vec3

The first control point

$destination : Vec3

The destination of the curve

$color : Vec3

The color of the curve

$segments : int = 10

The number of segments to draw

addCross()

Draws a cross at the given position

public addCross(Vec3 $origin, Vec3 $color[, float $length = 10 ]) : void
Parameters
$origin : Vec3

The origin of the cross

$color : Vec3

The color of the cross

$length : float = 10

The length of the cross

addFrustum()

Draws a Frustum

public addFrustum(Mat4 $ivp, Vec3 $color) : void
Parameters
$ivp : Mat4

The inverse view projection matrix to build the frustum from

$color : Vec3

The color of the frustum

addLine()

Draws a line from the given origin to the given destination

public addLine(Vec3 $origin, Vec3 $destination, Vec3 $color) : void
Parameters
$origin : Vec3

The origin of the line

$destination : Vec3

The destination of the line

$color : Vec3

The color of the line

addPlane()

Draws a plane in 3D space

public addPlane(Vec3 $origin, Vec3 $normal, float $size, Vec3 $color) : void
Parameters
$origin : Vec3

The origin of the plane

$normal : Vec3

The normal of the plane

$size : float

The size of the plane

$color : Vec3

The color of the plane

addRay()

Adds a ray to the debug 3D render queue

public addRay(Vec3 $origin, Vec3 $direction, float $length, Vec3 $color) : void
Parameters
$origin : Vec3

The origin of the ray

$direction : Vec3

The direction of the ray

$length : float

The length of the ray

$color : Vec3

The color of the ray

bezier()

Draws a 2 control point bezier curve

public static bezier(Vec3 $origin, Vec3 $p0, Vec3 $destination, Vec3 $color[, int $segments = 10 ]) : void
Parameters
$origin : Vec3

The origin of the curve

$p0 : Vec3

The first control point

$destination : Vec3

The destination of the curve

$color : Vec3

The color of the curve

$segments : int = 10

The number of segments to draw

cross()

Draws a cross at the given position

public static cross(Vec3 $origin, Vec3 $color[, float $length = 10 ]) : void
Parameters
$origin : Vec3

The origin of the cross

$color : Vec3

The color of the cross

$length : float = 10

The length of the cross

frustum()

Draws a line representation of the given frustum

public static frustum(Mat4 $ivp, Vec3 $color) : void
Parameters
$ivp : Mat4

The inverse view projection matrix

$color : Vec3

The color of the frustum

getGlobalInstance()

Returns a global instance of the debug 3D renderer.

public static getGlobalInstance() : Debug3DRenderer

throws an exception if the renderer has not been initialized yet.

Return values
Debug3DRenderer

plane()

Draws a plane in 3D space

public static plane(Vec3 $origin, Vec3 $normal, float $size, Vec3 $color) : void
Parameters
$origin : Vec3

The origin of the plane

$normal : Vec3

The normal of the plane

$size : float

The size of the plane

$color : Vec3

The color of the plane

ray()

Adds a ray to the debug 3D render queue

public static ray(Vec3 $origin, Vec3 $direction, Vec3 $color[, float $length = 50 ]) : void
Parameters
$origin : Vec3

The origin of the ray

$direction : Vec3

The direction of the ray

$color : Vec3

The color of the ray

$length : float = 50

The length of the ray

createVAO()

Creates the vertex array and buffer objects

private createVAO() : void

        
On this page

Search results