RendererInterface
Namespace:
namespace Lenga\Engine\Interfaces;
interface RendererInterface extends ComponentInterface
Marker interface shared by all renderer components (MeshRenderer, SpriteRenderer, ModelRenderer, etc.). Extending ComponentInterface, it allows engine systems and scripts to operate on any renderer without coupling to a specific implementation.
Type-hint against RendererInterface when you need to accept any renderer component generically.
Visual Defaults
For material-backed 3D renderers, setColor changes the renderer's base color.
If no material asset is assigned, that base color is what Lenga uses in both the
Scene view and Play mode. Assigning a material asset makes the material's base
color and textures take over.
Example
use Lenga\Engine\Core\Behaviour;
use Lenga\Engine\Interfaces\RendererInterface;
/**
* Toggles visibility for any renderer component.
*/
function setVisible(RendererInterface $renderer, bool $visible): void
{
$renderer->setEnabled($visible);
}
class FlashEffect extends Behaviour
{
public function flash(): void
{
$renderer = $this->getComponent(RendererInterface::class);
if ($renderer !== null) {
setVisible($renderer, false);
}
}
}