ThreePipe
    Preparing search index...

    Class WidgetIcon

    The icon of a light or a camera widget: a quad at the object's position that always faces the camera, is drawn on top of the scene and keeps its size in pixels (size), set before each render for the camera of the render (updateScale). An unlit mesh, not a Sprite: the GBuffer material can draw it, so it writes its GBuffer flags and is not tone mapped. The colour and the icon of its WidgetKind come from widgetKinds; lights also have a small dot in their own colour (dot).

    Its texture is drawn at the size of the icon on screen, about one texel per device pixel (updateTexture), so it is sharp at any icon size and render scale. It is drawn again only when the size or the render scale changes.

    It is made by AHelperWidget for the objects that have a kind, when the icon mode of the widget is sprite. A click on it selects the object of its widget (through the PickingPlugin, like the lines of the widget).

    Hierarchy

    Index

    The dot in the object's own colour (lights only): a quad over the icon, its texture tinted with the colour

    size: number = widgetIconLayout.diameter

    The diameter of the round icon in CSS pixels

    textureSize: number = 0

    The width and height of the current texture in texels, 0 when there is none (no 2D canvas)

    • An optional callback that is executed immediately before a 3D object is rendered.

      Parameters

      Returns void

      This function is called with the following parameters: renderer, scene, camera, geometry, material, group. Please notice that this callback is only executed for renderable 3D objects. Meaning 3D objects which define their visual appearance with geometries and materials like instances of Mesh, Line, Points or Sprite. Instances of Object3D, Group or Bone are not renderable and thus this callback is not executed for such objects.

    • Turns the quad to face the camera and sets its scale so that the round icon is size pixels wide on a canvas heightPx CSS pixels high, at its distance from the camera. The size in pixels depends on the projection (field of view or zoom, projectionMatrix[5]), the canvas height and, for a perspective camera, the distance along the view axis. The world matrix is made first and then taken into the space of the parent, so a rotation or a non-uniform scale of the parent (the widget has the transform of its object) does not skew or stretch the icon. Called before each render, with the camera of the render.

      Parameters

      • camera: Camera
      • heightPx: number

      Returns void

    • Draws the textures of the icon and the dot at the size of the icon on a canvas with pixelRatio (the render scale of the viewer): getWidgetIconTextureSize texels square. Does nothing when that size is the same as now. Called before each render with the pixel ratio of the renderer.

      Parameters

      • pixelRatio: number

      Returns void