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 — note that the force is saved as a reference to the original vector (so when you update it, the renderer updates itself as well), and thus it must be available for the whole lifetime of the renderer. The renderer is automatically added to object's features so you don't need to keep a reference to it.

DebugTools::ResourceManager::instance().set("my",
    DebugTools::ForceRendererOptions{}
        .setSize(5.0f)
        .setColor(Color3::fromHsv({120.0_degf, 1.0f, 0.7f})));

Vector3 force; // taken as a reference, has to be kept in scope

// Create debug renderer for given force, use "my" options for it
new DebugTools::ForceRenderer3D(*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

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

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.