13#ifndef vtkWebGPUContextDevice2D_h
14#define vtkWebGPUContextDevice2D_h
17#include "vtkRenderingWebGPUModule.h"
21VTK_ABI_NAMESPACE_BEGIN
81 void DrawPoly(
float* points,
int n,
unsigned char* colors =
nullptr,
int nc_comps = 0)
override;
89 void DrawLines(
float* points,
int n,
unsigned char* colors =
nullptr,
int nc_comps = 0)
override;
96 void DrawPoints(
float* points,
int n,
unsigned char* colors =
nullptr,
int nc_comps = 0)
override;
107 int nc_comps = 0)
override;
109 std::uintptr_t cacheIdentifier)
override;
119 void DrawMarkers(
int shape,
bool highlight,
float* points,
int n,
unsigned char* colors =
nullptr,
120 int nc_comps = 0)
override;
122 std::uintptr_t cacheIdentifier)
override;
143 float* points,
int numPoints,
unsigned char* colors =
nullptr,
int nc_comps = 0)
override;
149 float startAngle,
float stopAngle)
override;
155 float x,
float y,
float rX,
float rY,
float startAngle,
float stopAngle)
override;
191 int scalarMode)
override;
290 void UpdateCameraUniforms();
291 void UpdatePaintUniforms(
const unsigned char color[4]);
296 WGPURenderPipeline CreatePipelineWithConstants(
float haveTCoordsVal = 0.0f,
297 float haveLinesVal = 0.0f, WGPUPrimitiveTopology topology = WGPUPrimitiveTopology_TriangleList);
302 vtkImageData* GenerateMarker(
int shape,
int width,
bool highlight);
308 void ApplyScissorRect(WGPURenderPassEncoder passEncoder);
317 float* points,
int n,
unsigned char* colors,
int nc,
const std::vector<float>& distances);
323 float* points,
int n,
unsigned char* colors,
int nc,
const std::vector<float>& distances);
2D array of ids, used for picking.
topologically and geometrically regular array of data
a simple class to control print indentation
represent and manipulate 3x3 transformation matrices
represent and manipulate 4x4 transformation matrices
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract specification for renderers
Wrapper around std::string to keep symbols short.
dynamic, self-adjusting array of unsigned char
abstract specification for Viewports
Container for vtkWebGPUContextDevice2D internal state.
vtkTransform * ProjectionMatrix
vtkTransform * ModelMatrix
void PushMatrix() override
Push the current matrix onto the stack.
void End() override
Ends the 2D rendering pass and cleans up temporary render state.
void SetMatrix(vtkMatrix3x3 *m) override
Set the model view matrix for the display.
void InitializeTexture()
Initialize Device Resources: Uniforms, BindGroups, Pipelines, and Textures.
vtkWebGPUContextDevice2D()
vtkWebGPURenderWindow * RenderWindow
virtual void SetColor(unsigned char color[3])
Set the color for the device using unsigned char of length 3, RGB.
void DrawMarkers(int shape, bool highlight, vtkDataArray *positions, vtkUnsignedCharArray *colors, std::uintptr_t cacheIdentifier) override
void DrawPointSprites(vtkImageData *sprite, float *points, int n, unsigned char *colors=nullptr, int nc_comps=0) override
Draw a series of point sprites, images centred at the points supplied.
void DrawImage(const vtkRectf &pos, vtkImageData *image) override
Render an image data object within a specified 2D rectangle.
void DrawMarkers(int shape, bool highlight, float *points, int n, unsigned char *colors=nullptr, int nc_comps=0) override
Draw markers of a specified shape at multiple 2D positions.
static vtkWebGPUContextDevice2D * New()
Creates a 2D Painter object.
void DrawEllipticArc(float x, float y, float rX, float rY, float startAngle, float stopAngle) override
Draw an open elliptical arc line segment.
void SetLineType(int type) override
Set the line type type (using anonymous enum in vtkPen).
void DrawQuad(float *points, int n) override
Draw a quad using the 4 specified points.
void SetTexture(vtkImageData *image, int properties=0) override
Set the texture for the device, it is used to fill the polygons.
void ReleaseCache(std::uintptr_t) override
Noop method.
void DrawPoints(float *points, int n, unsigned char *colors=nullptr, int nc_comps=0) override
Draw a series of points - fastest code path due to memory layout of the coordinates.
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this device.
void ComputeStringBounds(const vtkStdString &string, float bounds[4]) override
Compute the bounding box dimensions for a given text string.
bool InitializeDeviceResources()
Initialize Device Resources: Uniforms, BindGroups, Pipelines, and Textures.
void DrawPoints(vtkDataArray *positions, vtkUnsignedCharArray *colors, std::uintptr_t cacheIdentifier) override
void BufferIdModeEnd() override
Noop method.
void ComputeJustifiedStringBounds(const char *string, float bounds[4]) override
Compute justified bounding box dimensions for a C-style string.
void DrawEllipseWedge(float x, float y, float outRx, float outRy, float inRx, float inRy, float startAngle, float stopAngle) override
Draw an elliptical wedge (pie slice) defined by radii and angles.
void DrawPointSprites(vtkImageData *sprite, vtkDataArray *positions, vtkUnsignedCharArray *colors, std::uintptr_t cacheIdentifier) override
void DrawColoredPolygon(float *points, int numPoints, unsigned char *colors=nullptr, int nc_comps=0) override
Draw a filled polygon with optional per-vertex or per-polygon colors.
void DrawPolyData(float p[2], float scale, vtkPolyData *polyData, vtkUnsignedCharArray *colors, int scalarMode) override
Render a vtkPolyData geometry mesh (lines and polygons) with offset and scale.
void PopMatrix() override
Pop the current matrix off of the stack.
void SetLineWidth(float width) override
Set the line width for glyphs/sprites.
void DrawPolygon(float *points, int n) override
Draw a filled convex polygon defined by points.
void Begin(vtkViewport *viewport) override
Begins the 2D rendering pass for the given viewport.
void DrawMathTextString(float point[2], const vtkStdString &string) override
Render a math equation string (MathText format) at the given point.
void DrawString(float *point, const vtkStdString &string) override
Render a text string at the specified world coordinate point.
void SetColor4(unsigned char color[4]) override
Set the color for the device using unsigned char of length 4, RGBA.
void DrawQuadStrip(float *points, int n) override
Draw a quad strip using a sequence of points.
void MultiplyMatrix(vtkMatrix3x3 *m) override
Multiply the current model view matrix by the supplied one.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkWebGPUContextDevice2D() override
void EnableClipping(bool enable) override
Enable or disable clipping.
void GetMatrix(vtkMatrix3x3 *m) override
Set the model view matrix for the display.
void BufferIdModeBegin(vtkAbstractContextBufferId *) override
Noop method.
void SetClipping(int *x) override
Set the clipping rectangle for the 2D context.
void SetPointSize(float size) override
Set the point size for glyphs/sprites.
void DrawLines(float *points, int n, unsigned char *colors=nullptr, int nc_comps=0) override
Draw lines using the points - memory layout is as follows: l1p1,l1p2,l2p1,l2p2... The lines will be c...
void DrawPoly(float *points, int n, unsigned char *colors=nullptr, int nc_comps=0) override
Draw a poly line using the points - fastest code path due to memory layout of the coordinates.
void DrawImage(float p[2], float scale, vtkImageData *image) override
Render an image data object scaled and positioned at a given point.
void Flush()
Flushes the internal batched vertex buffer to the WebGPU rendering pipeline.
window superclass for vtkRenderWindow