module charge.gfx.target
Graphics

Source file for Target(s), that is FBOs and DefaultTarget.

Code Map

//! Source file for Target(s), that is FBOs and DefaultTarget.
module charge.gfx.target;


//! Base target class, allows you to bind and unbind targets.
class Target : sys.Resource
{
public:
	enum uri;


public:
	fbo: GLuint;
	width: u32;
	height: u32;


public:
	fn bind(old: Target) { }
	fn unbind() { }
	fn bindAndCopyFrom(src: Target) { }
	fn setMatrixToOrtho(mat: math.Matrix4x4d) { }
	fn setMatrixToOrtho(mat: math.Matrix4x4d, width: f32, height: f32) { }


protected:
	mCopyFilter: GLuint;
}

//! The default fbo in OpenGL, glBindFramebuffer(GL_FRAMEBUFFER, 0).
class DefaultTarget : Target
{
public:
	fn bindDefault() { }


public:
	static fn opCall() DefaultTarget { }
	static fn close() { }
}

//! Target for a FBO made outside of charge, takes ownership of the fbo.
class ExtTarget : Target
{
public:
	static fn make(name: string, fbo: GLuint, width: u32, height: u32) ExtTarget { }
}

//! A simple color + depth framebuffer.
class Framebuffer : Target
{
public:
	color: Texture;
	depth: Texture;


public:
	static fn make(name: string, width: u32, height: u32) Framebuffer { }
}

//! A simple color + depth framebuffer, with MSAA textures.
class FramebufferMSAA : Framebuffer
{
public:
	fn bind(old: Target) { }
	fn unbind() { }


public:
	static fn make(name: string, width: u32, height: u32, samples: u32) FramebufferMSAA { }
}

//! Information about a single view to be rendered, passed alongside a
//! Target.
struct ViewInfo
{
public:
	//! A fov to be used on the given target.
	fov: math.Fovf;
	//! Used in XR mode, gives the position of the view.
	position: math.Point3f;
	//! Used in XR mode, gives the rotation of the view.
	rotation: math.Quatf;
	//! Should the fov be used or can it be filled in.
	validFov: bool;
	//! Are position and @rotation valid and should be used.
	validLocation: bool;
	//! Is this view suitable for orthogonal rendering, that is it displayed on
	//! monitor like thing or is it a XR view.
	suitableForOrtho: bool;


public:
	fn ensureValidFov(fovy: f64, t: Target) { }
}

//! Dereference and reference helper function.
fn reference(dec: Target, inc: Target) { }
//! Dereference and reference helper function.
fn reference(dec: DefaultTarget, inc: DefaultTarget) { }
//! Dereference and reference helper function.
fn reference(dec: ExtTarget, inc: ExtTarget) { }
//! Dereference and reference helper function.
fn reference(dec: Framebuffer, inc: Framebuffer) { }
//! Dereference and reference helper function.
fn reference(dec: FramebufferMSAA, inc: FramebufferMSAA) { }
fn reference(dec: Target, inc: Target)

Dereference and reference helper function.

Parameters

dec

Object to dereference passed by reference, set to inc.

inc

Object to reference.

struct ViewInfo

Information about a single view to be rendered, passed alongside a Target.

fov: math.Fovf

A fov to be used on the given target.

position: math.Point3f

Used in XR mode, gives the position of the view.

rotation: math.Quatf

Used in XR mode, gives the rotation of the view.

validFov: bool

Should the fov be used or can it be filled in.

validLocation: bool

Are position and @rotation valid and should be used.

suitableForOrtho: bool

Is this view suitable for orthogonal rendering, that is it displayed on monitor like thing or is it a XR view.

class Target : sys.Resource

Base target class, allows you to bind and unbind targets.

class DefaultTarget : Target

The default fbo in OpenGL, glBindFramebuffer(GL_FRAMEBUFFER, 0).

class ExtTarget : Target

Target for a FBO made outside of charge, takes ownership of the fbo.

class Framebuffer : Target

A simple color + depth framebuffer.

class FramebufferMSAA : Framebuffer

A simple color + depth framebuffer, with MSAA textures.