VisualParams
Class gathering parameters used by visual components and by the draw method of each component. Transmitted by visitors
`VisualParams` manages visualization parameters such as viewport dimensions, clipping planes, camera type, rendering passes, and transformation matrices for visual components in SOFA simulations.
- module
- Sofa.framework.Core
- namespace
- sofa::core::visual
- include
- sofa/core/visual/VisualParams.h
- inherits
-
- ExecParams
- description
The VisualParams class in the SOFA framework is primarily focused on managing parameters related to visualization, rather than contributing directly to the governing equations or operators typically associated with FEM simulations (such as mass matrix $M$, stiffness matrix $K$, internal force $f_{int}$, residual $R$, etc.). Instead, it provides a mechanism for storing and accessing various parameters required by visual components and draw methods during the simulation. The class does not implement any constitutive or kinematic laws related to continuum mechanics, nor does it play a role in the assembly phase of FEM, time integration schemes, nonlinear solve steps, linear solve procedures, constraint handling, mapping operations, or other core computational mechanics processes.
Key Components and Parameters:
- Viewport Dimensions: Describes the region of the screen where the visual output will be rendered. It is defined by a set of four integers representing the viewport coordinates (left, bottom, width, height).
- Clipping Planes: Defines the near and far clipping planes for perspective projection.
- Camera Type: Specifies whether the camera is using a perspective or orthographic transformation. This affects how objects are projected onto the screen plane.
- Rendering Pass Types: Describes different stages of the rendering process, such as standard pass for opaque objects, transparent pass for translucent elements, and shadow pass for generating shadows.
- Transformation Matrices: Stores the model-view and projection matrices used to transform object coordinates into camera space and screen space, respectively.
Role in the Global FEM Pipeline:
The VisualParams class does not directly participate in the core computational mechanics pipeline. Instead, it serves as a container for visualization-specific parameters that are necessary for rendering simulation results interactively or post-processing them. It is typically created and managed by visitors to transmit these visual parameters through the simulation scene graph.
Numerical Methods or Discretization Choices:
The VisualParams class does not involve any specific numerical methods or discretization choices related to FEM. Its role is purely in managing visualization settings, which are independent of the underlying mechanical simulation.
Fit into the Broader Variational / Lagrangian Mechanics Framework:
Since VisualParams is concerned with visualization parameters and not with physical modeling or numerical simulation, it does not fit directly into the variational or Lagrangian mechanics framework. Its primary function is to enable consistent and correct rendering of the simulated objects based on their current mechanical state.
Methods
const Data<typename S::VecCoord> *
readX
(const S * state)
const Data<typename S::VecDeriv> *
readV
(const S * state)
const ConstMultiVecCoordId &
x
()
const ConstMultiVecDerivId &
v
()
VisualParams &
setX
(ConstVecCoordId v)
VisualParams &
setX
(ConstMultiVecCoordId v)
VisualParams &
setX
(const StateSet & g, ConstVecCoordId v)
VisualParams &
setV
(ConstVecDerivId v)
VisualParams &
setV
(ConstMultiVecDerivId v)
VisualParams &
setV
(const StateSet & g, ConstVecDerivId v)
VisualParams *
defaultInstance
()
const Viewport &
viewport
()
const SReal &
zNear
()
const SReal &
zFar
()
const CameraType &
cameraType
()
const Pass &
pass
()
helper::visual::DrawTool *&
drawTool
()
DisplayFlags &
displayFlags
()
sofa::type::BoundingBox &
sceneBBox
()
void
setModelViewMatrix
(const double[16] m)
void
getModelViewMatrix
(double[16] m)
void
setProjectionMatrix
(const double[16] m)
void
getProjectionMatrix
(double[16] m)
bool
isSupported
(unsigned int api)
void
setSupported
(unsigned int api, bool val)
{
"name": "VisualParams",
"namespace": "sofa::core::visual",
"module": "Sofa.framework.Core",
"include": "sofa/core/visual/VisualParams.h",
"doc": "Class gathering parameters used by visual components and by the draw method of each component. Transmitted by visitors",
"inherits": [
"ExecParams"
],
"templates": [],
"data_fields": [],
"links": [],
"methods": [
{
"name": "readX",
"return_type": "const Data<typename S::VecCoord> *",
"params": [
{
"name": "state",
"type": "const S *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "readV",
"return_type": "const Data<typename S::VecDeriv> *",
"params": [
{
"name": "state",
"type": "const S *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "x",
"return_type": "const ConstMultiVecCoordId &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "v",
"return_type": "const ConstMultiVecDerivId &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setX",
"return_type": "VisualParams &",
"params": [
{
"name": "v",
"type": "ConstVecCoordId"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setX",
"return_type": "VisualParams &",
"params": [
{
"name": "v",
"type": "ConstMultiVecCoordId"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setX",
"return_type": "VisualParams &",
"params": [
{
"name": "g",
"type": "const StateSet &"
},
{
"name": "v",
"type": "ConstVecCoordId"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setV",
"return_type": "VisualParams &",
"params": [
{
"name": "v",
"type": "ConstVecDerivId"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setV",
"return_type": "VisualParams &",
"params": [
{
"name": "v",
"type": "ConstMultiVecDerivId"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setV",
"return_type": "VisualParams &",
"params": [
{
"name": "g",
"type": "const StateSet &"
},
{
"name": "v",
"type": "ConstVecDerivId"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "defaultInstance",
"return_type": "VisualParams *",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "viewport",
"return_type": "const Viewport &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "zNear",
"return_type": "const SReal &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "zFar",
"return_type": "const SReal &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "cameraType",
"return_type": "const CameraType &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "pass",
"return_type": "const Pass &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "drawTool",
"return_type": "helper::visual::DrawTool *&",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "displayFlags",
"return_type": "DisplayFlags &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "sceneBBox",
"return_type": "sofa::type::BoundingBox &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setModelViewMatrix",
"return_type": "void",
"params": [
{
"name": "m",
"type": "const double[16]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getModelViewMatrix",
"return_type": "void",
"params": [
{
"name": "m",
"type": "double[16]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setProjectionMatrix",
"return_type": "void",
"params": [
{
"name": "m",
"type": "const double[16]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getProjectionMatrix",
"return_type": "void",
"params": [
{
"name": "m",
"type": "double[16]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "isSupported",
"return_type": "bool",
"params": [
{
"name": "api",
"type": "unsigned int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setSupported",
"return_type": "void",
"params": [
{
"name": "api",
"type": "unsigned int"
},
{
"name": "val",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": "The `VisualParams` class in the SOFA framework is designed to gather and manage parameters used by visual components and draw methods across different simulation components. It inherits from `ExecParams`, providing a mechanism for setting up and accessing position (`x`) and velocity (`v`) vectors, as well as managing visualization-specific settings like viewport dimensions, near/far clipping planes, camera type (perspective or orthographic), rendering pass types, and supported graphics APIs (OpenGL, OGRE, OpenSceneGraph, OpenSG). It also includes methods for setting up transformation matrices (model-view and projection) necessary for scene drawing. `VisualParams` instances are typically created and managed by visitors to transmit visual parameters through the simulation pipeline. The class provides accessors and mutators for these settings, allowing both read and write operations.",
"maths": "The `VisualParams` class in the SOFA framework is primarily focused on managing parameters related to visualization, rather than contributing directly to the governing equations or operators typically associated with FEM simulations (such as mass matrix \\(M\\), stiffness matrix \\(K\\), internal force \\(f_{int}\\), residual \\(R\\), etc.). Instead, it provides a mechanism for storing and accessing various parameters required by visual components and draw methods during the simulation. The class does not implement any constitutive or kinematic laws related to continuum mechanics, nor does it play a role in the assembly phase of FEM, time integration schemes, nonlinear solve steps, linear solve procedures, constraint handling, mapping operations, or other core computational mechanics processes.\n\n### Key Components and Parameters:\n\n- **Viewport Dimensions**: Describes the region of the screen where the visual output will be rendered. It is defined by a set of four integers representing the viewport coordinates (left, bottom, width, height).\n\n\\[ \\text{Viewport} = [l, b, w, h] \\]\n\n- **Clipping Planes**: Defines the near and far clipping planes for perspective projection.\n\n\\[ z_{near}, \\\\[z_far} \\]\n\n- **Camera Type**: Specifies whether the camera is using a perspective or orthographic transformation. This affects how objects are projected onto the screen plane.\n\n\\[\text{CameraType} = \\begin{cases}\nPERSPECTIVE_TYPE & \\text{(perspective projection)} \\\\ ORTHOGRAPHIC_TYPE & \\text{(orthographic projection)} \\end{cases}\\]\n\n- **Rendering Pass Types**: Describes different stages of the rendering process, such as standard pass for opaque objects, transparent pass for translucent elements, and shadow pass for generating shadows.\n\n\\[\text{Pass} = \\begin{cases}\nStd & \\text{(standard pass)} \\\\ Transparent & \\text{(transparent pass)} \\\\ Shadow & \\text{(shadow pass)} \\end{cases}\\]\n\n- **Transformation Matrices**: Stores the model-view and projection matrices used to transform object coordinates into camera space and screen space, respectively.\n\n\\[ M_{MV},\nP_{proj} \\]\n\n### Role in the Global FEM Pipeline:\n\nThe `VisualParams` class does not directly participate in the core computational mechanics pipeline. Instead, it serves as a container for visualization-specific parameters that are necessary for rendering simulation results interactively or post-processing them. It is typically created and managed by visitors to transmit these visual parameters through the simulation scene graph.\n\n### Numerical Methods or Discretization Choices:\n\nThe `VisualParams` class does not involve any specific numerical methods or discretization choices related to FEM. Its role is purely in managing visualization settings, which are independent of the underlying mechanical simulation.\n\n### Fit into the Broader Variational / Lagrangian Mechanics Framework:\n\nSince `VisualParams` is concerned with visualization parameters and not with physical modeling or numerical simulation, it does not fit directly into the variational or Lagrangian mechanics framework. Its primary function is to enable consistent and correct rendering of the simulated objects based on their current mechanical state.\n",
"abstract": "`VisualParams` manages visualization parameters such as viewport dimensions, clipping planes, camera type, rendering passes, and transformation matrices for visual components in SOFA simulations.",
"sheet": "# VisualParams\n\n**Overview**\n\nThe `VisualParams` class gathers and manages parameters used by visual components and draw methods across different simulation components. It inherits from `ExecParams`, providing mechanisms to set up and access position (`x`) and velocity (`v`) vectors, as well as visualization-specific settings like viewport dimensions, near/far clipping planes, camera type (perspective or orthographic), rendering pass types, and supported graphics APIs.\n\n**Parameters and Data**\n\n- **Viewport Dimensions**: Describes the region of the screen where visual output will be rendered. It is defined by a set of four integers representing viewport coordinates \\([l, b, w, h]\\).\n\n\\[ \text{Viewport} = [l, b, w, h] \\]\n\n- **Clipping Planes**: Defines near and far clipping planes for perspective projection.\n\n\\[ z_{near}, z_{far} \\]\n\n- **Camera Type**: Specifies whether the camera uses a perspective or orthographic transformation. This affects how objects are projected onto the screen plane.\n\n\\[ \text{CameraType} = \begin{cases}\n PERSPECTIVE_TYPE & \text{(perspective projection)} \\\\\n ORTHOGRAPHIC_TYPE & \text{(orthographic projection)}\n\ndcases}\\]\n\n- **Rendering Pass Types**: Describes different stages of the rendering process, such as standard pass for opaque objects, transparent pass for translucent elements, and shadow pass for generating shadows.\n\n\\[ \text{Pass} = \\begin{cases}\n Std & \\text{(standard pass)} \\\\\n Transparent & \\text{(transparent pass)} \\\\\n Shadow & \\text{(shadow pass)}\n\\end{cases}\\]\n\n- **Transformation Matrices**: Stores the model-view and projection matrices used to transform object coordinates into camera space and screen space, respectively.\n\n\\[ M_{MV}, P_{proj} \\]"
}