OsgTextureCubeMap.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_OSGTEXTURECUBEMAP_H
17 #define SURGSIM_GRAPHICS_OSGTEXTURECUBEMAP_H
18 
20 
21 #include <osg/TextureCubeMap>
22 
23 #if defined(_MSC_VER)
24 #pragma warning(push)
25 #pragma warning(disable:4250)
26 #endif
27 
28 namespace SurgSim
29 {
30 
31 namespace Graphics
32 {
33 
38 {
39 public:
43 
48  virtual void setSize(int width, int height);
49 
53  virtual void getSize(int* width, int* height) const;
54 
68  virtual bool loadImage(const std::string& filePath);
69 
78  virtual bool loadImageFaces(const std::string& negativeX, const std::string& positiveX,
79  const std::string& negativeY, const std::string& positiveY,
80  const std::string& negativeZ, const std::string& positiveZ);
81 
83  osg::ref_ptr<osg::TextureCubeMap> getOsgTextureCubeMap() const
84  {
85  return static_cast<osg::TextureCubeMap*>(getOsgTexture().get());
86  }
87 
88 protected:
96  osg::ref_ptr<osg::Image> copyImageBlock(const osg::Image& source, int column, int row, int width, int height);
97 };
98 
99 }; // namespace Graphics
100 
101 }; // namespace SurgSim
102 
103 #if defined(_MSC_VER)
104 #pragma warning(pop)
105 #endif
106 
107 #endif // SURGSIM_GRAPHICS_OSGTEXTURECUBEMAP_H
Definition: DriveElementFromInputBehavior.cpp:27
OSG implementation of a Cube Map Texture.
Definition: OsgTextureCubeMap.h:37
osg::ref_ptr< osg::Texture > getOsgTexture() const
Returns the osg::Texture1D.
Definition: OsgTexture.h:44
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
osg::ref_ptr< osg::TextureCubeMap > getOsgTextureCubeMap() const
Returns the osg::TextureCubeMap.
Definition: OsgTextureCubeMap.h:83
virtual void setSize(int width, int height)
Sets the size of the texture.
Definition: OsgTextureCubeMap.cpp:26
OsgTextureCubeMap()
Constructor.
Definition: OsgTextureCubeMap.cpp:22
Base class for OSG implementations of Graphics Textures.
Definition: OsgTexture.h:32
osg::ref_ptr< osg::Image > copyImageBlock(const osg::Image &source, int column, int row, int width, int height)
Makes a copy of an image block.
Definition: OsgTextureCubeMap.cpp:113
virtual bool loadImage(const std::string &filePath)
Loads an image into the texture from a file.
Definition: OsgTextureCubeMap.cpp:45
virtual bool loadImageFaces(const std::string &negativeX, const std::string &positiveX, const std::string &negativeY, const std::string &positiveY, const std::string &negativeZ, const std::string &positiveZ)
Loads images from files into the faces of the cube map.
Definition: OsgTextureCubeMap.cpp:85
virtual void getSize(int *width, int *height) const
Gets the size of the texture.
Definition: OsgTextureCubeMap.cpp:31