Go to the documentation of this file.
16 #ifndef SURGSIM_GRAPHICS_OSGCAMERA_H
17 #define SURGSIM_GRAPHICS_OSGCAMERA_H
19 #include <unordered_map>
33 #pragma warning(disable:4250)
48 SURGSIM_STATIC_REGISTRATION(OsgCamera);
68 bool setRenderGroups(
const std::vector<std::shared_ptr<Group>>& groups)
override;
82 void update(
double dt)
override;
90 bool setRenderTarget(std::shared_ptr<RenderTarget> renderTarget)
override;
94 bool setMaterial(std::shared_ptr<SurgSim::Framework::Component> material)
override;
96 std::shared_ptr<Material>
getMaterial()
const override;
111 double left,
double right,
112 double bottom,
double top,
113 double near,
double far)
override;
116 void setViewport(
int x,
int y,
int width,
int height)
override;
118 void getViewport(
int* x,
int* y,
int* width,
int* height)
const override;
164 #if defined(_MSC_VER)
168 #endif // SURGSIM_GRAPHICS_OSGCAMERA_H
void setGenerateTangents(bool value) override
Enable or disable the generation of tangents.
Definition: OsgCamera.cpp:510
void attachRenderTargetTexture(osg::Camera::BufferComponent buffer, std::shared_ptr< Texture > texture)
Attach a specific texture to a specific BufferComponent, works for Depth and all the Colors.
Definition: OsgCamera.cpp:458
SurgSim::Math::Vector4d m_ambientColor
Value for ambient color.
Definition: OsgCamera.h:156
void setOrthogonalProjection(double left, double right, double bottom, double top, double near, double far) override
Set the projection matrix with the appropriate orthogonal projection parameters.
Definition: OsgCamera.cpp:452
virtual SurgSim::Math::Matrix44d getInverseViewMatrix() const
Gets the inverse view matrix of the camera.
Definition: OsgCamera.cpp:494
bool setRenderGroup(std::shared_ptr< Group > group) override
Sets the group of representations that will be seen by this camera.
Definition: OsgCamera.cpp:190
std::shared_ptr< RenderTarget > getRenderTarget() const override
Gets RenderTarget that is currently being used by the camera.
Definition: OsgCamera.cpp:318
bool setMaterial(std::shared_ptr< SurgSim::Framework::Component > material) override
Sets the material that defines the visual appearance of the representation.
Definition: OsgCamera.cpp:324
Base graphics camera class, which defines the basic interface for all graphics cameras.
Definition: Camera.h:52
std::array< double, 2 > getViewportSize() const override
Gets the dimensions of the viewport.
Definition: OsgCamera.cpp:400
SurgSim::Math::Vector4d getAmbientColor() override
Definition: OsgCamera.cpp:505
std::unordered_map< int, std::shared_ptr< Texture > > m_textureMap
Definition: OsgCamera.h:135
std::shared_ptr< OsgUniform< SurgSim::Math::Matrix44f > > m_viewMatrixUniform
Uniform to carry the view matrix.
Definition: OsgCamera.h:147
void setLocalActive(bool val) override
Set the component's active state.
Definition: OsgCamera.cpp:229
void setPerspectiveProjection(double fovy, double aspect, double near, double far) override
Set the projection matrix with the appropriate perspective projection parameters.
Definition: OsgCamera.cpp:445
void setMainCamera(bool val) override
Marks the camera as a main view camera, this means that view dependent passes should follow this came...
Definition: OsgCamera.cpp:411
Definition: CompoundShapeToGraphics.cpp:30
void update(double dt) override
Updates the representation.
Definition: OsgCamera.cpp:256
std::shared_ptr< RenderTarget > m_renderTarget
Definition: OsgCamera.h:136
osg::ref_ptr< osg::Camera > m_camera
Definition: OsgCamera.h:130
void setAmbientColor(const SurgSim::Math::Vector4d &color) override
Sets a value for the ambient lighting term, this can add light to the scene when there is no lighting...
Definition: OsgCamera.cpp:499
virtual SurgSim::Math::Matrix44d getViewMatrix() const
Gets the view matrix of the camera.
Definition: OsgCamera.cpp:235
void clearMaterial() override
Removes the material from the representation.
Definition: OsgCamera.cpp:342
Eigen::Matrix< double, 4, 4, Eigen::RowMajor > Matrix44d
A 4x4 matrix of doubles.
Definition: Matrix.h:55
OsgCamera(const std::string &name)
Constructor.
Definition: OsgCamera.cpp:147
std::array< int, 4 > getViewport() const
Definition: Camera.cpp:170
Eigen::Matrix< double, 4, 1 > Vector4d
A 4D vector of doubles.
Definition: Vector.h:61
osg::ref_ptr< osg::Node > getOsgNode() const
Definition: OsgCamera.cpp:489
osg::ref_ptr< osg::Camera > getOsgCamera() const
Definition: OsgCamera.cpp:484
std::shared_ptr< OsgUniform< SurgSim::Math::Vector4f > > m_ambientColorUniform
Uniform to carry the ambient color.
Definition: OsgCamera.h:153
void setRenderOrder(RenderOrder order, int value) override
Determine when this camera will render.
Definition: OsgCamera.cpp:476
const SurgSim::Math::Matrix44d & getProjectionMatrix() const override
Gets the projection matrix of the camera.
Definition: OsgCamera.cpp:246
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgCamera)
RenderOrder
Definition: Camera.h:56
void setProjectionMatrix(const SurgSim::Math::Matrix44d &matrix) override
Sets the projection matrix of the camera.
Definition: OsgCamera.cpp:240
OSG implementation of a graphics camera.
Definition: OsgCamera.h:55
bool setRenderTarget(std::shared_ptr< RenderTarget > renderTarget) override
Sets RenderTarget for the current camera, enables the camera to render to off-screen textures.
Definition: OsgCamera.cpp:276
bool setRenderGroups(const std::vector< std::shared_ptr< Group >> &groups) override
Sets the representation groups that will be seen by this camera.
Definition: OsgCamera.cpp:196
bool isMainCamera() override
Definition: OsgCamera.cpp:440
std::shared_ptr< OsgUniform< SurgSim::Math::Matrix44f > > m_inverseViewMatrixUniform
Uniform to carry the inverse view matrix.
Definition: OsgCamera.h:150
void setViewportSize(std::array< double, 2 > dimensions) override
Sets the width and height of the viewport.
Definition: OsgCamera.cpp:383
std::shared_ptr< Material > getMaterial() const override
Gets the material that defines the visual appearance of the representation.
Definition: OsgCamera.cpp:337
SurgSim::Math::Matrix44d m_projectionMatrix
Projection matrix of the camera.
Definition: OsgCamera.h:133
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
void setViewport(int x, int y, int width, int height) override
Sets the viewport size for this camera.
Definition: OsgCamera.cpp:363
SurgSim::Math::Matrix44d getInverseProjectionMatrix() const override
Gets the inverse projection matrix of the camera.
Definition: OsgCamera.cpp:251
void detachCurrentRenderTarget()
Detach the current render target from the camera.
Definition: OsgCamera.cpp:347
bool m_isMainCamera
Definition: OsgCamera.h:158
Base OSG implementation of a graphics representation.
Definition: OsgRepresentation.h:56