Internal Class used to draw debugInformations about the physics simulation onto the renderContext. No user interaction needed.

Author

Marko Fehrenbach, HFU 2020 //Based on OimoPhysics Haxe DebugDrawDemo

Hierarchy (view full)

Constructors

  • Creating the debug for physics in FUDGE. Tell it to draw only wireframe objects, since FUDGE is handling rendering of the objects besides physics. Override OimoPhysics Functions with own rendering. Initialize buffers and connect them with the context for later use.

    Returns PhysicsDebugDraw

Properties

gl: WebGL2RenderingContext
lineData: number[]
lineIboData: number[]
numLineData: number
numPointData: number
numTriData: number
oimoDebugDraw: DebugDraw
pointData: number[]
pointIboData: number[]
program: WebGLProgram
style: DebugDrawStyle
triData: number[]
triIboData: number[]
uboLights: WebGLBuffer
uboLightsVariableOffsets: {
    [_name: string]: number;
}

Type declaration

  • [_name: string]: number

Methods

  • Before OimoPhysics.world is filling the debug. Make sure the buffers are reset. Also receiving the debugMode from settings and updating the current projection for the vertexShader.

    Returns void

  • Drawing the ray into the debugDraw Call. By using the overwritten line rendering functions and drawing a point (pointSize defined in the shader) at the end of the ray.

    Parameters

    Returns void

  • After OimoPhysics.world filled the debug. Rendering calls. Setting this program to be used by the FUDGE rendering context. And draw each updated buffer and resetting them.

    Returns void

  • Creating the empty render buffers. Defining the attributes used in shaders. Needs to create empty buffers to already have them ready to draw later on, linking is only possible with existing buffers.

    Returns void

  • Receive the current DebugMode from the physics settings and set the OimoPhysics.DebugDraw booleans to show only certain informations. Needed since some debug informations exclude others, and can't be drawn at the same time, by OimoPhysics. And for users it provides more readability to debug only what they need and is commonly debugged.

    Parameters

    Returns void

  • Checks the first parameter and throws an exception with the WebGL-errorcode if the value is null

    Type Parameters

    • T

    Parameters

    • _value: T

      value to check against null

    • _message: string = ""

      optional, additional message for the exception

    Returns T

  • Initializes offscreen-canvas, renderingcontext and hardware viewport. Call once before creating any resources like meshes or shaders

    Parameters

    • Optional _antialias: boolean
    • Optional _alpha: boolean

    Returns WebGL2RenderingContext