OsgSceneryRepresentation.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_GRAPHICS_OSGSCENERYREPRESENTATION_H
17 #define SURGSIM_GRAPHICS_OSGSCENERYREPRESENTATION_H
18 
21 
22 #include <osg/Node>
23 
24 #if defined(_MSC_VER)
25 #pragma warning(push)
26 #pragma warning(disable:4250)
27 #endif
28 
29 namespace SurgSim
30 {
31 namespace Framework
32 {
33 class Asset;
34 }
35 namespace Graphics
36 {
37 class Model;
38 
39 SURGSIM_STATIC_REGISTRATION(OsgSceneryRepresentation);
40 
43 {
44 public:
45  friend class OsgSceneryRepresentationTest;
46 
49  explicit OsgSceneryRepresentation(const std::string& name);
50 
52 
53  void loadModel(const std::string& fileName) override;
54 
55  void setModel(std::shared_ptr<SurgSim::Framework::Asset> model) override;
56 
57  std::shared_ptr<Model> getModel() const override;
58 
60  osg::ref_ptr<osg::Node> getModelNode() const;
61 
62  void setGenerateTangents(bool value) override;
63 
64 private:
65  bool doInitialize() override;
67  osg::ref_ptr<osg::Node> m_osgNode;
68 
69  std::shared_ptr<Model> m_model;
70 
72  std::string m_fileName;
73 };
74 
75 }; // namespace Graphics
76 
77 }; // namespace SurgSim
78 
79 #if defined(_MSC_VER)
80 #pragma warning(pop)
81 #endif
82 
83 #endif // SURGSIM_GRAPHICS_OSGSCENERYREPRESENTATION_H
Definition: CompoundShapeToGraphics.cpp:29
std::shared_ptr< Model > m_model
Definition: OsgSceneryRepresentation.h:69
std::string m_fileName
Name of the object file to be loaded.
Definition: OsgSceneryRepresentation.h:72
Model
The models of LabJack devices. Numbers come from LabJackUD.h.
Definition: LabJackDevice.h:117
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
Base class defining the interface for a Graphics Scenery Object.
Definition: SceneryRepresentation.h:36
A OsgSceneryRepresentation is used to load osg object/node from file.
Definition: OsgSceneryRepresentation.h:42
osg::ref_ptr< osg::Node > m_osgNode
A osg::Node to hold the objet loaded from file.
Definition: OsgSceneryRepresentation.h:67
Base OSG implementation of a graphics representation.
Definition: OsgRepresentation.h:55