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.
StatictexStatictexStatictexStatictexSee EventTarget.addEventListener for reference. Works with EventListenerUnified and EventUnified
Optional_options: boolean | AddEventListenerOptionsBefore 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.
See EventTarget.dispatchEvent for reference. Works with with EventUnified
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.
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.
See EventTarget.removeEventListener for reference. Works with EventListenerUnified and EventUnified
Optional_options: boolean | AddEventListenerOptionsReceive 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.
StaticaddStaticadjustAdjusts the size of the different texture attachments (render targets) to the canvas size.
⚠️ CAUTION: Expensive operation, use only when canvas size changed.
StaticassertStaticbindStaticclearStaticcreateStaticdispatchDispatch an event on targetStatic.
StaticdrawDraw a mesh buffer using the given infos and the complete projection matrix
StaticgetReturn a reference to the offscreen-canvas.
StaticgetReturns a reference to the rectangle describing the size of the offscreen-canvas. x,y are 0 at all times.
Do not modify the rectangle directly, use setCanvasSize instead.
StaticgetReturn a reference to the rendering context
StaticgetRetrieve the area on the offscreen-canvas the camera image gets rendered to.
Do not modify the rectangle directly, use setRenderRectangle instead.
StaticinitializeInitializes offscreen-canvas, renderingcontext and hardware viewport. Call once before creating any resources like meshes or shaders
Optional_antialias: booleanOptional_alpha: booleanStaticinitializeInitializes different framebuffers aswell as texture attachments to use as render targets
StaticpickUsed with a Picker-camera, this method renders one pixel with picking information for each node in the line of sight and return that as an unsorted Pick-array
StaticpointStaticremoveStaticresetReset the framebuffer to the main color buffer.
StaticsetStaticsetSet the size of the offscreen-canvas.
⚠️ CAUTION: If size changes invokes adjustAttachments which is an expensive operation.
StaticsetSet which color components to enable or to disable when rendering to a color buffer.
StaticsetSet the comparison operation used to test fragment depths against current depth buffer values.
StaticsetEnable / Disable WebGLs depth test.
StaticsetSet the final framebuffer to render to. If null, the canvas default framebuffer is used. Used by XR to render to the XRWebGLLayer framebuffer.
StaticsetSet the area on the offscreen-canvas to render the camera image to.
StaticsetEnable / Disable WebGLs scissor test.
Optional_x: numberOptional_y: numberOptional_width: numberOptional_height: numberStaticsetSet WebGLs viewport.
StaticuseOptional_id: number
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