template<UnsignedInt dimensions>
Magnum::DebugTools::ForceRenderer class

Force renderer.

Visualizes force pushing on object by an arrow of the same direction and size. See Debug renderers for more information.

Basic usage

Example code:

DebugTools::ResourceManager::instance().set("my", DebugTools::ForceRendererOptions()
    .setScale(5.0f)
    .setColor(Color3::fromHSV(120.0_degf, 1.0f, 0.7f));

// Create debug renderer for given object, use "my" options for it
Object3D* object;
Vector3 force;
new DebugTools::ForceRenderer2D(object, {0.3f, 1.5f, -0.7f}, &force, "my", debugDrawables);

Base classes

template<UnsignedInt dimensions, class T>
class Magnum::SceneGraph::Drawable
Drawable.

Constructors, destructors, conversion operators

ForceRenderer(SceneGraph::AbstractObject<dimensions, Float>& object, const VectorTypeFor<dimensions, Float>& forcePosition, const VectorTypeFor<dimensions, Float>& force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* drawables = nullptr) explicit
Constructor.
ForceRenderer(SceneGraph::AbstractObject<dimensions, Float>&, const VectorTypeFor<dimensions, Float>&, VectorTypeFor<dimensions, Float>&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* = nullptr) deleted

Private functions

void draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::Camera<dimensions, Float>& camera) override virtual
Draw the object using given camera.

Function documentation

template<UnsignedInt dimensions>
Magnum::DebugTools::ForceRenderer<dimensions>::ForceRenderer(SceneGraph::AbstractObject<dimensions, Float>& object, const VectorTypeFor<dimensions, Float>& forcePosition, const VectorTypeFor<dimensions, Float>& force, ResourceKey options = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* drawables = nullptr) explicit

Constructor.

Parameters
object Object for which to create debug renderer
forcePosition Where to render the force, relative to object
force Force vector
options Options resource key. See class documentation for more information.
drawables Drawable group

The renderer is automatically added to object's features, force is saved as reference to original vector and thus it must be available for the whole lifetime of the renderer.

template<UnsignedInt dimensions>
Magnum::DebugTools::ForceRenderer<dimensions>::ForceRenderer(SceneGraph::AbstractObject<dimensions, Float>&, const VectorTypeFor<dimensions, Float>&, VectorTypeFor<dimensions, Float>&&, ResourceKey = ResourceKey(), SceneGraph::DrawableGroup<dimensions, Float>* = nullptr) deleted

You have to pass reference to existing force instance, as the renderer uses the current value when rendering.

template<UnsignedInt dimensions>
void Magnum::DebugTools::ForceRenderer<dimensions>::draw(const MatrixTypeFor<dimensions, Float>& transformationMatrix, SceneGraph::Camera<dimensions, Float>& camera) override virtual private

Draw the object using given camera.

Parameters
transformationMatrix Object transformation relative to camera
camera Camera

Projection matrix can be retrieved from Camera::projectionMatrix().