MeshLazy
Experimental
Interfaces
| Interface | Description |
|---|---|
| ClipUniforms | Clip box uniforms shared by the primitive's shader and injected three.js materials. |
| MeshColorInputs | Inputs of writeColors. |
Variables
| Variable | Description |
|---|---|
| DEFAULT_FACE_NORMALS_EPSILON | Plotly's lighting.facenormalsepsilon default. |
| DEFAULT_LIGHTING | The rig used for three.js material types when a figure has no scene.lighting: Plotly's default light (lightposition (1e5, 1e5, 0), moving with the view) with Plotly's default ambient and diffuse strengths. |
| DEFAULT_MESH_COLOR | Plotly's mesh3d default color (#444… is the line color; the surface default is this gray). |
| DEFAULT_VERTEX_NORMALS_EPSILON | Plotly's lighting.vertexnormalsepsilon default. |
| HIDDEN_INTENSITY | Intensities that are not finite are written as this and discarded by the shader. |
| MESH_FRAGMENT_SHADER | - |
| MESH_SORT_LIMIT | Above this many triangles, sortTriangles: 'auto' leaves a translucent mesh unsorted. |
| MESH_VERTEX_SHADER | - |
| PLOTLY_LIGHTING | - |
| PLOTLY_LIGHTPOSITION | Plotly's lightposition default (clip space). |
Functions
| Function | Description |
|---|---|
| applyMaterialParams | Set a spec's parameters on the material's matching properties (see the module comment). |
| clipToView | Un-project a Plotly lightposition (clip space) into view space through the camera's inverse projection (column-major), as gl-mesh3d does. Writes [x, y, z, 1], or a direction [x, y, z, 0] when the point is at infinity. |
| computeFaceNormals | Plotly's face normals, one per triangle (3 * triangleCount floats), in data space. See the module comment for epsilon and scale. |
| computeVertexNormals | Plotly's angle-weighted vertex normals, one per vertex (positions.length floats), in data space. See the module comment for epsilon and scale. |
| computeViewLights | The lights of spec in view space for the Plotly shader, scaled by the trace's lighting: ambient and hemisphere light by ambient; directional lights keep their color (the shader multiplies diffuse and specular). Without a spec: Plotly's single white light at lightposition and a white ambient light. |
| cornerVertex | Vertex of corner k (triangle floor(k / 3)). |
| createLightRig | Create a LightRig (default: DEFAULT_LIGHTING). |
| createMeshPrimitive | Create a MeshPrimitive. object: an existing (placeholder) mesh to draw into. |
| createThreeMaterial | Create the three.js material of spec (a three.js type), seeded from Plotly's lighting, with the clip box injected. The caller disposes it and material.userData.gradient (toon). |
| createToonGradient | A toon gradient of steps bands (nearest-filtered, so the shading steps). |
| createViewLights | - |
| defaultNormalScale | Default normal scale: each axis' finite extent mapped to 2 (Plotly's scene cube), 1 for flat or empty axes. |
| gatherVertices | Copy per-vertex values (size floats per vertex) to drawn items, e.g. positions or normals of expanded geometry. |
| hasTranslucency | Whether any drawn color is translucent (alpha < 1). |
| injectClip | Discard fragments outside the clip box in a three.js material (HC_CLIP define). |
| intensityOrigin | Center of the finite range of values (0 when none): the intensity origin. |
| isThreeMaterialType | Whether a material type is drawn with a three.js material (not the primitive's shader). |
| isValidTriangle | Whether all three vertices of triangle t are valid. |
| isValidVertex | Whether vertex v has finite, visible coordinates (and exists). |
| itemVertex | Input vertex of drawn item i. |
| lightViewPosition | View-space direction or position of a directional light (see DirectionalLightSpec). |
| meshColorSource | - |
| meshTriangleCount | Number of triangles: indices.length / 3, or vertexCount / 3 without indices. |
| needsColorAttribute | Whether the drawn items need a per-item color attribute: always for per-vertex / per-face colors and for intensity mapped on the CPU (three.js materials); for one color, or intensity in the shader, only to carry per-vertex alpha. |
| orderTranslucent | Give the translucent meshes among objects (searched recursively) render orders base, base + step, … from the farthest to the nearest (view depth of their world bounding box center), for scenes where three.js' own depth sort doesn't apply. Returns the next free order. |
| reorderTriangles | Write index reordered by triangle order into out. |
| resolveMeshLighting | Plotly's defaults for missing or non-finite values, clamped to Plotly's attribute ranges. |
| shininessFromRoughness | Phong shininess with the highlight width of a Beckmann roughness (2 / r² - 2). |
| sortTrianglesByDepth | Triangle draw order, farthest first. centroids holds 3 floats per triangle in the mesh's local space (NaN: invalid, drawn first); modelView is the column-major model-view matrix (only its third row, the view-space z, is read). Returns order (triangle indices). |
| srgbToLinear | sRGB → linear (three.js materials expect linear vertex colors). |
| triangleCentroids | Centroids (3 floats per triangle) of drawn triangles; NaN for invalid triangles. |
| writeColors | Per-item RGBA colors (straight alpha, per-vertex alpha multiplied in). In the Plotly shader's intensity mode the RGB is unused (white) and only alpha is carried. |
| writeIntensity | Per-item intensity relative to origin (float32 keeps precision for values with a large common offset): per vertex, or per triangle ('cell', expanded layouts). Non-finite and missing values become HIDDEN_INTENSITY. |
References
DirectionalLightSpec
Re-exports DirectionalLightSpec
LightingSpec
Re-exports LightingSpec
LightRig
Re-exports LightRig
LightSpace
Re-exports LightSpace
MeshColorSource
Re-exports MeshColorSource
MeshData
Re-exports MeshData
MeshIndexArray
Re-exports MeshIndexArray
MeshInput
Re-exports MeshInput
MeshLayout
Re-exports MeshLayout
MeshLighting
Re-exports MeshLighting
MeshMaterialSpec
Re-exports MeshMaterialSpec
MeshMaterialType
Re-exports MeshMaterialType
MeshPrimitive
Re-exports MeshPrimitive
MeshShaderHooks
Re-exports MeshShaderHooks
ViewLights
Re-exports ViewLights