Gamp v0.0.7-54-gccdc599
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
gamp::dag::Shape Class Reference

#include <Shape.hpp>

Collaboration diagram for gamp::dag::Shape:

Public Types

typedef jau::function< bool(Shape &s, render::gl::GL &gl, RenderState &rs)> DrawCallback
 Shape draw listener action returning a boolean value
 
typedef jau::function< void(Shape &s, const Vec3f &origin, const Vec3f &dest, const PointerEvent &e)> MoveEventCallback
 Shape move listener
 
typedef jau::function< void(Shape &s, const Vec3f &pos, const PointerEvent &e)> PointerEventCallback
 Shape pointer listener, e.g.
 
typedef jau::function< void(Shape &s)> ShapeEventCallback
 General Shape listener action.
 
typedef jau::function< bool(Shape &s)> Visitor1Func
 Visitor1 method.
 
typedef jau::function< bool(Shape &s, PMVMat4f &pmv)> Visitor2Func
 Visitor2 method.
 

Public Member Functions

 Shape ()=default
 
void applyMatToMv (PMVMat4f &pmvMat) noexcept
 Applies the internal Matrix4f to the given modelview matrix, i.e.
 
void draw (render::gl::GL &gl, RenderState &rs) noexcept
 Renders the shape.
 
virtual bool hasColorChannel () const noexcept
 Returns true if implementation uses an extra color channel or texture which will be modulated with the passed rgba color drawImpl0(GL2ES2, RenderState, float[]).
 
bool isPressed () const noexcept
 
bool isToggleable () const noexcept
 Returns true if this shape is toggable, i.e.
 
void markShapeDirty () noexcept
 Marks the shape dirty, causing next draw() to recreate the Graph shape and reset the region.
 
void markStateDirty () noexcept
 Marks the rendering state dirty, causing next draw() to notify the Graph region to reselect shader and repaint potentially used FBOs.
 
void onDrawOneShot (DrawCallback l)
 Set a user one-shot initializer callback or custom draw(GL2ES2, RegionRenderer) hook.
 
constexpr const Vec3fposition () const noexcept
 
constexpr Vec3fposition () noexcept
 
constexpr const Quat4frotation () const noexcept
 
constexpr Quat4frotation () noexcept
 
constexpr const Vec3frotationPivot () const noexcept
 
constexpr Vec3frotationPivot () noexcept
 
constexpr const Vec3fscale () const noexcept
 
constexpr Vec3fscale () noexcept
 
ShapesetPressed (bool b) noexcept
 
ShapesetToggleable (bool toggleable) noexcept
 Set this shape toggleable, default is off.
 
final Shape validate (final GL2ES2 gl, final GLProfile glp)
 Validate the shape via validate(GL2ES2) if gl is not null, otherwise uses validate(GLProfile).
 
Shapevalidate (render::gl::GL &gl) noexcept
 Validates the shape's underlying GLRegion.
 
Shapevalidate (render::gl::GLProfile &glp)
 Validates the shape's underlying GLRegion w/o a current GL2ES2 object.
 
constexpr const float & zOffset () const noexcept
 
constexpr float & zOffset () noexcept
 

Static Public Attributes

static constexpr const uint32_t DIRTY_SHAPE = 1_u32 << 0
 
static constexpr const uint32_t DIRTY_STATE = 1_u32 << 1
 

Protected Member Functions

virtual void clearImpl0 (render::gl::GL &gl, RenderState &rs)
 Custom clear(GL2ES2, RenderState) task, called 1st.
 
virtual void destroyImpl0 (render::gl::GL &gl, RenderState &rs)
 Custom destroy(GL2ES2, RenderState) task, called 1st.
 
virtual void drawImpl0 (render::gl::GL &gl, RenderState &rs) noexcept
 Actual draw implementation, called by draw(GL2ES2, RenderState).
 
std::string_view getDirtyString () const noexcept
 
bool isShapeDirty () const noexcept
 Returns the shape's dirty state, see markShapeDirty().
 
bool isStateDirty () const noexcept
 Returns the rendering dirty state, see markStateDirty().
 
virtual void validateImpl (const render::gl::GLProfile &glp) noexcept
 
virtual void validateImpl (render::gl::GL &gl) noexcept
 

Protected Attributes

jau::math::geom::AABBox3f m_box
 

Detailed Description

Definition at line 86 of file Shape.hpp.

Member Typedef Documentation

◆ Visitor1Func

Visitor1 method.

Parameters
sthe Shape to process
Returns
true to signal operation complete and to stop traversal, otherwise false

Definition at line 93 of file Shape.hpp.

◆ Visitor2Func

Visitor2 method.

Parameters
sthe Shape to process
pmvthe PMVMatrix4f setup from the Scene down to the Shape
Returns
true to signal operation complete and to stop traversal, otherwise false

Definition at line 101 of file Shape.hpp.

◆ MoveEventCallback

typedef jau::function<void(Shape& s, const Vec3f& origin, const Vec3f& dest, const PointerEvent& e)> gamp::dag::Shape::MoveEventCallback

Shape move listener

Parameters
sthe moved shape
originoriginal position, relative object coordinates to the associated Shape
destnew position, relative object coordinates to the associated Shape
eoriginal Newt MouseEvent

Definition at line 110 of file Shape.hpp.

◆ PointerEventCallback

Shape pointer listener, e.g.

for Shape#onClicked(PointerListener)

Parameters
sthe associated Shape for this event
posrelative object coordinates to the associated Shape
eoriginal Newt MouseEvent

Definition at line 118 of file Shape.hpp.

◆ ShapeEventCallback

General Shape listener action.

Definition at line 123 of file Shape.hpp.

◆ DrawCallback

Shape draw listener action returning a boolean value

If run(Shape, GL2ES2, RenderState) returns true, the listener will be removed at Shape#draw(GL2ES2, RenderState) otherwise kept calling.

Return true to remove this DrawListener at Shape#draw(GL2ES2, RenderState), otherwise it is being kept and called.

Parameters
shapeThe shape
glthe current GL2ES2 object
rsthe RenderState

Definition at line 139 of file Shape.hpp.

Constructor & Destructor Documentation

◆ Shape()

gamp::dag::Shape::Shape ( )
default
Here is the caller graph for this function:

Member Function Documentation

◆ validateImpl() [1/2]

virtual void gamp::dag::Shape::validateImpl ( render::gl::GL & gl)
protectedvirtualnoexcept
Here is the caller graph for this function:

◆ validateImpl() [2/2]

virtual void gamp::dag::Shape::validateImpl ( const render::gl::GLProfile & glp)
protectedvirtualnoexcept

◆ drawImpl0()

virtual void gamp::dag::Shape::drawImpl0 ( render::gl::GL & gl,
RenderState & rs )
protectedvirtualnoexcept

Actual draw implementation, called by draw(GL2ES2, RenderState).

Parameters
gl
rs
rgba
Here is the caller graph for this function:

◆ clearImpl0()

virtual void gamp::dag::Shape::clearImpl0 ( render::gl::GL & gl,
RenderState & rs )
protectedvirtual

Custom clear(GL2ES2, RenderState) task, called 1st.

◆ destroyImpl0()

virtual void gamp::dag::Shape::destroyImpl0 ( render::gl::GL & gl,
RenderState & rs )
protectedvirtual

Custom destroy(GL2ES2, RenderState) task, called 1st.

◆ onDrawOneShot()

void gamp::dag::Shape::onDrawOneShot ( DrawCallback l)
inline

Set a user one-shot initializer callback or custom draw(GL2ES2, RegionRenderer) hook.

run(Shape, GL2ES2, RegionRenderer) is called at Shape#draw(GL2ES2, RegionRenderer) and if returning true, the listener will be removed. Otherwise kept calling.

This instrument allows the user either to be signaled when initialization of this Shape is completed, or just too hook-up custom draw(GL2ES2, RegionRenderer) actions.

Parameters
lcallback, which shall return true to be removed, i.e. user initialization is done.

Definition at line 211 of file Shape.hpp.

◆ hasColorChannel()

virtual bool gamp::dag::Shape::hasColorChannel ( ) const
virtualnoexcept

Returns true if implementation uses an extra color channel or texture which will be modulated with the passed rgba color drawImpl0(GL2ES2, RenderState, float[]).

Otherwise the base color will be modulated and passed to drawImpl0(GL2ES2, RenderState, float[]).

◆ position() [1/2]

const Vec3f & gamp::dag::Shape::position ( ) const
inlineconstexprnoexcept

Definition at line 221 of file Shape.hpp.

Here is the caller graph for this function:

◆ position() [2/2]

Vec3f & gamp::dag::Shape::position ( )
inlineconstexprnoexcept

Definition at line 222 of file Shape.hpp.

◆ zOffset() [1/2]

const float & gamp::dag::Shape::zOffset ( ) const
inlineconstexprnoexcept

Definition at line 224 of file Shape.hpp.

◆ zOffset() [2/2]

float & gamp::dag::Shape::zOffset ( )
inlineconstexprnoexcept

Definition at line 225 of file Shape.hpp.

◆ rotation() [1/2]

const Quat4f & gamp::dag::Shape::rotation ( ) const
inlineconstexprnoexcept

Definition at line 227 of file Shape.hpp.

◆ rotation() [2/2]

Quat4f & gamp::dag::Shape::rotation ( )
inlineconstexprnoexcept

Definition at line 228 of file Shape.hpp.

◆ rotationPivot() [1/2]

const Vec3f & gamp::dag::Shape::rotationPivot ( ) const
inlineconstexprnoexcept

Definition at line 230 of file Shape.hpp.

◆ rotationPivot() [2/2]

Vec3f & gamp::dag::Shape::rotationPivot ( )
inlineconstexprnoexcept

Definition at line 231 of file Shape.hpp.

◆ scale() [1/2]

const Vec3f & gamp::dag::Shape::scale ( ) const
inlineconstexprnoexcept

Definition at line 233 of file Shape.hpp.

◆ scale() [2/2]

Vec3f & gamp::dag::Shape::scale ( )
inlineconstexprnoexcept

Definition at line 234 of file Shape.hpp.

◆ markShapeDirty()

void gamp::dag::Shape::markShapeDirty ( )
inlinenoexcept

Marks the shape dirty, causing next draw() to recreate the Graph shape and reset the region.

Definition at line 240 of file Shape.hpp.

◆ markStateDirty()

void gamp::dag::Shape::markStateDirty ( )
inlinenoexcept

Marks the rendering state dirty, causing next draw() to notify the Graph region to reselect shader and repaint potentially used FBOs.

Definition at line 248 of file Shape.hpp.

Here is the caller graph for this function:

◆ isShapeDirty()

bool gamp::dag::Shape::isShapeDirty ( ) const
inlineprotectednoexcept

Returns the shape's dirty state, see markShapeDirty().

Definition at line 255 of file Shape.hpp.

Here is the caller graph for this function:

◆ isStateDirty()

bool gamp::dag::Shape::isStateDirty ( ) const
inlineprotectednoexcept

Returns the rendering dirty state, see markStateDirty().

Definition at line 259 of file Shape.hpp.

Here is the caller graph for this function:

◆ getDirtyString()

std::string_view gamp::dag::Shape::getDirtyString ( ) const
inlineprotectednoexcept

Definition at line 263 of file Shape.hpp.

◆ setPressed()

Shape & gamp::dag::Shape::setPressed ( bool b)
inlinenoexcept

Definition at line 280 of file Shape.hpp.

◆ isPressed()

bool gamp::dag::Shape::isPressed ( ) const
inlinenoexcept

Definition at line 285 of file Shape.hpp.

◆ setToggleable()

Shape & gamp::dag::Shape::setToggleable ( bool toggleable)
inlinenoexcept

Set this shape toggleable, default is off.

Parameters
toggleable
See also
#isInteractive()

Definition at line 292 of file Shape.hpp.

◆ isToggleable()

bool gamp::dag::Shape::isToggleable ( ) const
inlinenoexcept

Returns true if this shape is toggable, i.e.

rendered w/ setToggleOnColorMod(float, float, float, float) or setToggleOffColorMod(float, float, float, float).

See also
#isInteractive()

Definition at line 302 of file Shape.hpp.

◆ draw()

void gamp::dag::Shape::draw ( render::gl::GL & gl,
RenderState & rs )
inlinenoexcept

Renders the shape.

applyMatToMv(PMVMatrix4f) is expected to be completed beforehand.

Parameters
glthe current GL object
rendererRenderState which might be used for Graph Curve Rendering, also source of RenderState#getMatrix() and RenderState#getViewport().

Definition at line 312 of file Shape.hpp.

◆ validate() [1/3]

Shape & gamp::dag::Shape::validate ( render::gl::GL & gl)
inlinenoexcept

Validates the shape's underlying GLRegion.

If the region is dirty, it gets cleared and is reused.

Parameters
glcurrent GL2ES2 object
See also
#validate(GLProfile)

Definition at line 333 of file Shape.hpp.

Here is the caller graph for this function:

◆ validate() [2/3]

Shape & gamp::dag::Shape::validate ( render::gl::GLProfile & glp)
inline

Validates the shape's underlying GLRegion w/o a current GL2ES2 object.

If the region is dirty a new region is created and the old one gets pushed to a dirty-list to get disposed when a GL context is available.

See also
#validate(GL2ES2)

Definition at line 353 of file Shape.hpp.

◆ validate() [3/3]

final Shape gamp::dag::Shape::validate ( final GL2ES2 gl,
final GLProfile glp )
inline

Validate the shape via validate(GL2ES2) if gl is not null, otherwise uses validate(GLProfile).

See also
#validate(GL2ES2)
#validate(GLProfile)

Definition at line 371 of file Shape.hpp.

◆ applyMatToMv()

void gamp::dag::Shape::applyMatToMv ( PMVMat4f & pmvMat)
inlinenoexcept

Applies the internal Matrix4f to the given modelview matrix, i.e.

pmv.mulMv( getMat() ).

Calls updateMat() if dirty.

In case isMatIdentity() is true, implementation is a no-operation.

Parameters
pmvthe matrix
See also
#isMatIdentity()
updateMat()
#getMat()
PMVMatrix4f#mulMv(Matrix4f)

Definition at line 393 of file Shape.hpp.

Member Data Documentation

◆ DIRTY_SHAPE

const uint32_t gamp::dag::Shape::DIRTY_SHAPE = 1_u32 << 0
staticconstexpr

Definition at line 141 of file Shape.hpp.

◆ DIRTY_STATE

const uint32_t gamp::dag::Shape::DIRTY_STATE = 1_u32 << 1
staticconstexpr

Definition at line 142 of file Shape.hpp.

◆ m_box

jau::math::geom::AABBox3f gamp::dag::Shape::m_box
protected

Definition at line 145 of file Shape.hpp.


The documentation for this class was generated from the following file: