VTK  9.3.20240916
vtkDGRenderResponder.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
13#ifndef vtkDGRenderResponder_h
14#define vtkDGRenderResponder_h
15
17
18#include "vtkCellGridResponder.h" // For API.
19#include "vtkDGCell.h" // For API.
20#include "vtkDrawTexturedElements.h" // For CacheEntry.
21#include "vtkInformation.h" // For CacheEntry.
23#include "vtkRenderingCellGridModule.h" // For Export macro
24
25#include <string>
26#include <vector>
27
28VTK_ABI_NAMESPACE_BEGIN
29
30class vtkCellMetadata;
31class vtkDGCell;
32class vtkDGRenderResponders;
34
35class VTKRENDERINGCELLGRID_EXPORT vtkDGRenderResponder
36 : public vtkCellGridResponder<vtkCellGridRenderRequest>
37{
38public:
41
43 vtkCellGridResponders* caches) override;
44
45 void AddMod(const std::string& className);
46 void AddMods(const std::vector<std::string>& classNames);
47 void RemoveMod(const std::string& className);
49
52
58 {
59 NONE,
60 R,
61 S,
62 T,
63 L2_NORM_R_S,
64 L2_NORM_S_T,
65 L2_NORM_T_R,
66 };
67
69 {
70 ScalarVisualizationOverride = type;
71 }
72
73 static void SetVisualizeTessellation(bool value) { VisualizeTessellation = value; }
74
75protected:
77 ~vtkDGRenderResponder() override = default;
78
81
83 const vtkDGCell::Source& cellSource, int cellTypeIdx, std::size_t specIdx);
84 // std::pair<GLenum, std::vector<GLubyte>> ShapeToPrimitiveInfo(int shapeId);
85
88 {
103
109 mutable std::unique_ptr<vtkDrawTexturedElements> RenderHelper;
133
137 std::vector<std::string> ModNames;
138
142 bool IsUpToDate(vtkRenderer* renderer, vtkActor* actor, vtkMapper* mapper,
143 vtkDGRenderResponder* responder) const;
144
146 void PrepareHelper(vtkRenderer* renderer, vtkActor* actor, vtkMapper* mapper) const;
147
149 bool operator<(const CacheEntry& other) const;
150 };
151
152 std::set<CacheEntry> Helpers;
155
156 std::vector<std::string> ModNames;
157 std::set<std::string> ModNamesUnique;
158 static std::vector<std::string> DefaultModNames;
159
163
166
167private:
169 void operator=(const vtkDGRenderResponder&) = delete;
170};
171
172VTK_ABI_NAMESPACE_END
173#endif // vtkDGRenderResponder_h
174// VTK-HeaderTest-Exclude: vtkDGRenderResponder.h
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
Provide information about a cell attribute's basis functions on one cell type.
State used by vtkCellGridMapper during rendering.
Respond to a query on one particular type of cell.
A container that holds objects able to respond to queries specialized for particular vtkCellMetadata ...
Metadata for a particular type of cell (finite element).
Base class for a discontinuous Galerkin cells of all shapes.
Definition vtkDGCell.h:44
Shape
All possible shapes for DG cells.
Definition vtkDGCell.h:71
Rendering simple DG cells (i.e., those with a fixed reference shape).
static vtkDGRenderResponder * New()
bool DrawCells(vtkCellGridRenderRequest *request, vtkCellMetadata *metadata)
static vtkDrawTexturedElements::PatchShape PatchPrimitiveFromShape(vtkDGCell::Shape shape)
std::set< std::string > ModNamesUnique
static vtkDrawTexturedElements::ElementShape PrimitiveFromShape(vtkDGCell::Shape shape)
void AddMods(const std::vector< std::string > &classNames)
~vtkDGRenderResponder() override=default
bool ReleaseResources(vtkCellGridRenderRequest *request, vtkCellMetadata *metadata)
bool DrawShapes(vtkCellGridRenderRequest *request, vtkDGCell *metadata, const vtkDGCell::Source &cellSource, int cellTypeIdx, std::size_t specIdx)
bool Query(vtkCellGridRenderRequest *request, vtkCellMetadata *metadata, vtkCellGridResponders *caches) override
static void SetVisualizeTessellation(bool value)
static std::vector< std::string > DefaultModNames
std::vector< std::string > ModNames
ScalarVisualizationOverrideType
These properties are useful to debug/show-off/understand the parameter space and basis functions.
void ResetModsToDefault()
If you removed all mods, call this to go back to default setting.
void RemoveMod(const std::string &className)
static ScalarVisualizationOverrideType ScalarVisualizationOverride
Default is None.
std::set< CacheEntry > Helpers
static void SetScalarVisualizationOverrideType(ScalarVisualizationOverrideType type)
void AddMod(const std::string &className)
static bool VisualizeTessellation
These properties are useful to debug/show-off/understand dynamic distance-based tessellation.
PatchShape
The type of primitive that abstract patches are tessellated into.
ElementShape
The type of primitive to output.
abstract class specifies interface to map data to graphics primitives
Definition vtkMapper.h:137
Allocate and hold a VTK object.
Definition vtkNew.h:167
abstract specification for renderers
Hold a reference to a vtkObjectBase instance.
Records describing the source arrays for cells or cell-sides.
Definition vtkDGCell.h:90
Entries for a cache of render-helpers.
std::vector< std::string > ModNames
Determine whether to remove this cache entry because renderer, actor, or mapper have changed since it...
const vtkDGCell::Source * CellSource
The cell- or side-source within the cell-type to be rendered.
bool operator<(const CacheEntry &other) const
Used sort cache entries for inclusion in a std::set<>.
vtkSmartPointer< vtkCellAttribute > Shape
The vector-valued attribute used to move from reference coordinates to world coordinates.
vtkMTimeType RenderPassStageTime
The MTime of the render passes combined at the time RenderHelper was configured.
vtkSmartPointer< vtkCellAttribute > Color
The attribute used to color the geometry (or null).
vtkMTimeType ShapeTime
The MTime of the shape cell-attribute at the time RenderHelper was configured.
void PrepareHelper(vtkRenderer *renderer, vtkActor *actor, vtkMapper *mapper) const
Allocate a RenderHelper as needed and configure it.
vtkSmartPointer< vtkDGCell > CellType
The cell- or side-source within the cell-type to be rendered.
bool UsesTessellationShaders
Tessellation shaders are employed for higher order elements and quadrilaterals.
bool IsUpToDate(vtkRenderer *renderer, vtkActor *actor, vtkMapper *mapper, vtkDGRenderResponder *responder) const
Determine whether to remove this cache entry because renderer, actor, or mapper have changed since it...
bool UsesGeometryShaders
Geometry shader is used to debug distance-based tessellation.
vtkMTimeType MapperTime
The MTime of the mapper at the time RenderHelper was configured.
vtkMTimeType ColorTime
The MTime of the color cell-attribute at the time RenderHelper was configured.
vtkMTimeType GridTime
The MTime of the cell-grid which owns CellType at the time RenderHelper was configured.
std::unique_ptr< vtkDrawTexturedElements > RenderHelper
The MTime of the shape cell-attribute at the time RenderHelper was configured.
vtkNew< vtkInformation > LastRenderPassInfo
The last render pass information is cached when RenderHelper is configured.
vtkMTimeType PropertyTime
The MTime of the property at the time RenderHelper was configured.
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270