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

#include <Shape.hpp>

Collaboration diagram for gamp::graph::ui::Shape:

Public Types

typedef jau::function< void(ShapeRef &s, const Vec3f &origin, const Vec3f &dest, const PointerEvent &e)> MoveEventCallback
 Shape move listener
 
typedef jau::function< void(ShapeRef &s, const Vec3f &pos, const PointerEvent &e)> PointerEventCallback
 Shape pointer listener, e.g.
 
typedef jau::function< void(ShapeRef &s)> ShapeEventCallback
 General Shape listener action.
 
typedef jau::function< bool(ShapeRef &s)> Visitor1Func
 Visitor1 method.
 
typedef jau::function< bool(ShapeRef &s, PMVMat4f &pmv)> Visitor2Func
 Visitor2 method.
 

Public Member Functions

 Shape ()
 
void applyMatToMv (PMVMat4f &pmvMat) noexcept
 Applies the internal Matrix4f to the given modelview matrix, i.e.
 
virtual ContainerasContainer () const noexcept
 
constexpr const Vec4fcolor () const noexcept
 
void draw (render::gl::GL &gl, RegionRenderer &renderer) 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, RegionRenderer, float[]).
 
bool isPressed () const noexcept
 
bool isToggleable () const noexcept
 Returns true if this shape is toggable, i.e.
 
constexpr const OutlineShapeoutlines () const noexcept
 
constexpr OutlineShapeoutlines () noexcept
 
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
 
constexpr void setColor (const Vec4f &c) noexcept
 
ShapesetPressed (bool b) noexcept
 
ShapesetToggleable (bool toggleable) noexcept
 Set this shape toggleable, default is off.
 
final Shape validate (final GL2ES2 gl)
 Validates the shape's underlying GLRegion.
 
final Shape validate (final GL2ES2 gl, final GLProfile glp)
 Validate the shape via validate(GL2ES2) if gl is not null, otherwise uses validate(GLProfile).
 
final Shape validate (final 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
 Shape draw listener action returning a boolean value
 
static constexpr const uint32_t DIRTY_STATE = 1_u32 << 1
 

Protected Member Functions

virtual void clearImpl0 (const render::gl::GL &gl, RegionRenderer &renderer)
 Custom clear(GL2ES2, RegionRenderer) task, called 1st.
 
virtual void destroyImpl0 (const render::gl::GL &gl, RegionRenderer &renderer)
 Custom destroy(GL2ES2, RegionRenderer) task, called 1st.
 
virtual void drawImpl0 (const render::gl::GL &gl, RegionRenderer &renderer, const Vec4f &rgba) noexcept
 Actual draw implementation, called by draw(GL2ES2, RegionRenderer).
 
virtual void drawToSelectImpl0 (const render::gl::GL &gl, RegionRenderer &renderer)
 Actual draw implementation, called by drawToSelect(GL2ES2, RegionRenderer).
 
virtual void validateImpl (const render::gl::GL &gl, const render::gl::GLProfile &glp) noexcept
 

Protected Attributes

bool activeRGBAModulateOn = false
 
jau::math::geom::AABBox3f box
 

Static Protected Attributes

static constexpr Vec4f activeRGBAModulate = Vec4f(0.25f, 0.25f, 0.25f, 1.0f)
 Default active color-factor (dark), modulates base-color.
 
static constexpr Vec4f cWhite = Vec4f(1, 1, 1, 1)
 
static constexpr Vec4f pressedRGBAModulate = Vec4f(0.70f, 0.70f, 0.70f, 0.8f)
 Default pressed color-factor (darker and slightly transparent), modulates base-color.
 
static constexpr Vec4f rgbaColor = Vec4f(0.60f, 0.60f, 0.60f, 1.0f)
 Default base-color w/o color channel, will be modulated w/ pressed- and toggle color.
 
static constexpr Vec4f toggleOffRGBAModulate = Vec4f(1.00f, 1.00f, 1.00f, 1.0f)
 Default toggle color-factor (original), modulates base-color.
 
static constexpr Vec4f toggleOnRGBAModulate = Vec4f(0.83f, 0.83f, 0.83f, 1.0f)
 Default toggle color-factor (darker), modulates base-color.
 

Detailed Description

Definition at line 82 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 89 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 97 of file Shape.hpp.

◆ MoveEventCallback

typedef jau::function<void(ShapeRef& s, const Vec3f& origin, const Vec3f& dest, const PointerEvent& e)> gamp::graph::ui::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 106 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 114 of file Shape.hpp.

◆ ShapeEventCallback

General Shape listener action.

Definition at line 119 of file Shape.hpp.

Constructor & Destructor Documentation

◆ Shape()

gamp::graph::ui::Shape::Shape ( )
inline

Definition at line 222 of file Shape.hpp.

Here is the caller graph for this function:

Member Function Documentation

◆ validateImpl()

virtual void gamp::graph::ui::Shape::validateImpl ( const render::gl::GL & gl,
const render::gl::GLProfile & glp )
protectedvirtualnoexcept
Here is the caller graph for this function:

◆ drawImpl0()

virtual void gamp::graph::ui::Shape::drawImpl0 ( const render::gl::GL & gl,
RegionRenderer & renderer,
const Vec4f & rgba )
protectedvirtualnoexcept

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

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

◆ drawToSelectImpl0()

virtual void gamp::graph::ui::Shape::drawToSelectImpl0 ( const render::gl::GL & gl,
RegionRenderer & renderer )
protectedvirtual

Actual draw implementation, called by drawToSelect(GL2ES2, RegionRenderer).

Parameters
gl
renderer

◆ clearImpl0()

virtual void gamp::graph::ui::Shape::clearImpl0 ( const render::gl::GL & gl,
RegionRenderer & renderer )
protectedvirtual

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

◆ destroyImpl0()

virtual void gamp::graph::ui::Shape::destroyImpl0 ( const render::gl::GL & gl,
RegionRenderer & renderer )
protectedvirtual

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

◆ hasColorChannel()

virtual bool gamp::graph::ui::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, RegionRenderer, float[]).

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

Here is the caller graph for this function:

◆ asContainer()

virtual Container * gamp::graph::ui::Shape::asContainer ( ) const
inlinevirtualnoexcept

Definition at line 226 of file Shape.hpp.

◆ position() [1/2]

const Vec3f & gamp::graph::ui::Shape::position ( ) const
inlineconstexprnoexcept

Definition at line 228 of file Shape.hpp.

◆ position() [2/2]

Vec3f & gamp::graph::ui::Shape::position ( )
inlineconstexprnoexcept

Definition at line 229 of file Shape.hpp.

◆ zOffset() [1/2]

const float & gamp::graph::ui::Shape::zOffset ( ) const
inlineconstexprnoexcept

Definition at line 231 of file Shape.hpp.

◆ zOffset() [2/2]

float & gamp::graph::ui::Shape::zOffset ( )
inlineconstexprnoexcept

Definition at line 232 of file Shape.hpp.

◆ rotation() [1/2]

const Quat4f & gamp::graph::ui::Shape::rotation ( ) const
inlineconstexprnoexcept

Definition at line 234 of file Shape.hpp.

◆ rotation() [2/2]

Quat4f & gamp::graph::ui::Shape::rotation ( )
inlineconstexprnoexcept

Definition at line 235 of file Shape.hpp.

◆ rotationPivot() [1/2]

const Vec3f & gamp::graph::ui::Shape::rotationPivot ( ) const
inlineconstexprnoexcept

Definition at line 237 of file Shape.hpp.

◆ rotationPivot() [2/2]

Vec3f & gamp::graph::ui::Shape::rotationPivot ( )
inlineconstexprnoexcept

Definition at line 238 of file Shape.hpp.

◆ scale() [1/2]

const Vec3f & gamp::graph::ui::Shape::scale ( ) const
inlineconstexprnoexcept

Definition at line 240 of file Shape.hpp.

◆ scale() [2/2]

Vec3f & gamp::graph::ui::Shape::scale ( )
inlineconstexprnoexcept

Definition at line 241 of file Shape.hpp.

◆ outlines() [1/2]

const OutlineShape & gamp::graph::ui::Shape::outlines ( ) const
inlineconstexprnoexcept

Definition at line 243 of file Shape.hpp.

◆ outlines() [2/2]

OutlineShape & gamp::graph::ui::Shape::outlines ( )
inlineconstexprnoexcept

Definition at line 244 of file Shape.hpp.

◆ color()

const Vec4f & gamp::graph::ui::Shape::color ( ) const
inlineconstexprnoexcept

Definition at line 246 of file Shape.hpp.

◆ setColor()

void gamp::graph::ui::Shape::setColor ( const Vec4f & c)
inlineconstexprnoexcept

Definition at line 247 of file Shape.hpp.

◆ setPressed()

Shape & gamp::graph::ui::Shape::setPressed ( bool b)
inlinenoexcept

Definition at line 253 of file Shape.hpp.

◆ isPressed()

bool gamp::graph::ui::Shape::isPressed ( ) const
inlinenoexcept

Definition at line 258 of file Shape.hpp.

Here is the caller graph for this function:

◆ setToggleable()

Shape & gamp::graph::ui::Shape::setToggleable ( bool toggleable)
inlinenoexcept

Set this shape toggleable, default is off.

Parameters
toggleable
See also
#isInteractive()

Definition at line 265 of file Shape.hpp.

◆ isToggleable()

bool gamp::graph::ui::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 275 of file Shape.hpp.

Here is the caller graph for this function:

◆ draw()

void gamp::graph::ui::Shape::draw ( render::gl::GL & gl,
RegionRenderer & renderer )
inlinenoexcept

Renders the shape.

applyMatToMv(PMVMatrix4f) is expected to be completed beforehand.

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

Definition at line 285 of file Shape.hpp.

◆ validate() [1/3]

final Shape gamp::graph::ui::Shape::validate ( final GL2ES2 gl)
inline

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 337 of file Shape.hpp.

Here is the caller graph for this function:

◆ validate() [2/3]

final Shape gamp::graph::ui::Shape::validate ( final 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 356 of file Shape.hpp.

◆ validate() [3/3]

final Shape gamp::graph::ui::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 373 of file Shape.hpp.

◆ applyMatToMv()

void gamp::graph::ui::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 395 of file Shape.hpp.

Member Data Documentation

◆ DIRTY_SHAPE

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

Shape draw listener action returning a boolean value

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

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

Parameters
shapeThe shape
glthe current GL2ES2 object
rendererthe RegionRenderer

Definition at line 137 of file Shape.hpp.

◆ DIRTY_STATE

const uint32_t gamp::graph::ui::Shape::DIRTY_STATE = 1_u32 << 1
staticconstexpr

Definition at line 138 of file Shape.hpp.

◆ box

jau::math::geom::AABBox3f gamp::graph::ui::Shape::box
protected

Definition at line 141 of file Shape.hpp.

◆ rgbaColor

Vec4f gamp::graph::ui::Shape::rgbaColor = Vec4f(0.60f, 0.60f, 0.60f, 1.0f)
staticconstexprprotected

Default base-color w/o color channel, will be modulated w/ pressed- and toggle color.

Definition at line 144 of file Shape.hpp.

◆ pressedRGBAModulate

Vec4f gamp::graph::ui::Shape::pressedRGBAModulate = Vec4f(0.70f, 0.70f, 0.70f, 0.8f)
staticconstexprprotected

Default pressed color-factor (darker and slightly transparent), modulates base-color.

~0.65 (due to alpha)

Definition at line 146 of file Shape.hpp.

◆ toggleOnRGBAModulate

Vec4f gamp::graph::ui::Shape::toggleOnRGBAModulate = Vec4f(0.83f, 0.83f, 0.83f, 1.0f)
staticconstexprprotected

Default toggle color-factor (darker), modulates base-color.

0.60 * 0.83 ~= 0.50

Definition at line 148 of file Shape.hpp.

◆ toggleOffRGBAModulate

Vec4f gamp::graph::ui::Shape::toggleOffRGBAModulate = Vec4f(1.00f, 1.00f, 1.00f, 1.0f)
staticconstexprprotected

Default toggle color-factor (original), modulates base-color.

0.60 * 1.00 ~= 0.60

Definition at line 150 of file Shape.hpp.

◆ activeRGBAModulate

Vec4f gamp::graph::ui::Shape::activeRGBAModulate = Vec4f(0.25f, 0.25f, 0.25f, 1.0f)
staticconstexprprotected

Default active color-factor (dark), modulates base-color.

0.60 * 0.25 ~= 0.15

Definition at line 152 of file Shape.hpp.

◆ cWhite

Vec4f gamp::graph::ui::Shape::cWhite = Vec4f(1, 1, 1, 1)
staticconstexprprotected

Definition at line 153 of file Shape.hpp.

◆ activeRGBAModulateOn

bool gamp::graph::ui::Shape::activeRGBAModulateOn = false
protected

Definition at line 155 of file Shape.hpp.


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