CBackground.h
Go to the documentation of this file.
1 //==============================================================================
2 /*
3  Software License Agreement (BSD License)
4  Copyright (c) 2003-2016, CHAI3D.
5  (www.chai3d.org)
6 
7  All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions
11  are met:
12 
13  * Redistributions of source code must retain the above copyright
14  notice, this list of conditions and the following disclaimer.
15 
16  * Redistributions in binary form must reproduce the above
17  copyright notice, this list of conditions and the following
18  disclaimer in the documentation and/or other materials provided
19  with the distribution.
20 
21  * Neither the name of CHAI3D nor the names of its contributors may
22  be used to endorse or promote products derived from this software
23  without specific prior written permission.
24 
25  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  POSSIBILITY OF SUCH DAMAGE.
37 
38  \author <http://www.chai3d.org>
39  \author Francois Conti
40  \version 3.2.0 $Rev: 1869 $
41 */
42 //==============================================================================
43 
44 //------------------------------------------------------------------------------
45 #ifndef CBackgroundH
46 #define CBackgroundH
47 //------------------------------------------------------------------------------
48 #include "widgets/CBitmap.h"
49 #include "graphics/CImage.h"
50 //------------------------------------------------------------------------------
51 
52 //------------------------------------------------------------------------------
53 namespace chai3d {
54 //------------------------------------------------------------------------------
55 
56 //==============================================================================
63 //==============================================================================
64 
65 //==============================================================================
78 //==============================================================================
79 class cBackground : public cBitmap
80 {
81  //--------------------------------------------------------------------------
82  // CONSTRUCTOR & DESTRUCTOR:
83  //--------------------------------------------------------------------------
84 
85 public:
86 
88  cBackground();
89 
91  virtual ~cBackground() {};
92 
93 
94  //--------------------------------------------------------------------------
95  // PUBLIC METHODS:
96  //--------------------------------------------------------------------------
97 
98 public:
99 
101  virtual cBackground* copy(const bool a_duplicateMaterialData = false,
102  const bool a_duplicateTextureData = false,
103  const bool a_duplicateMeshData = false,
104  const bool a_buildCollisionDetector = false);
105 
107  void update(const unsigned int a_bottomLeftX,
108  const unsigned int a_bottomLeftY,
109  const unsigned int a_topRightX,
110  const unsigned int a_topRightY);
111 
113  inline void setFixedAspectRatio(bool a_fixedAspectRatio) { m_fixedAspectRatio = a_fixedAspectRatio; }
114 
116  inline bool getFixedAspectRatio() { return (m_fixedAspectRatio); }
117 
118 
119  //--------------------------------------------------------------------------
120  // PROTECTED MEMBERS:
121  //--------------------------------------------------------------------------
122 
123 protected:
124 
127 
128 
129  //--------------------------------------------------------------------------
130  // PROTECTED METHODS:
131  //--------------------------------------------------------------------------
132 
133 protected:
134 
136  virtual void render(cRenderOptions& a_options);
137 
140  const bool a_duplicateMaterialData,
141  const bool a_duplicateTextureData,
142  const bool a_duplicateMeshData,
143  const bool a_buildCollisionDetector);
144 };
145 
146 //------------------------------------------------------------------------------
147 } // namespace chai3d
148 //------------------------------------------------------------------------------
149 
150 //------------------------------------------------------------------------------
151 #endif
152 //------------------------------------------------------------------------------
cBackground()
Constructor of cBackground.
Definition: CBackground.cpp:60
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition: CRenderOptions.h:82
virtual cBackground * copy(const bool a_duplicateMaterialData=false, const bool a_duplicateTextureData=false, const bool a_duplicateMeshData=false, const bool a_buildCollisionDetector=false)
This method create a copy of itself.
Definition: CBackground.cpp:239
Implements a 2D bimap widget.
void update(const unsigned int a_bottomLeftX, const unsigned int a_bottomLeftY, const unsigned int a_topRightX, const unsigned int a_topRightY)
This method updates the dimensions of the background in pixel coordinates.
Definition: CBackground.cpp:110
void setFixedAspectRatio(bool a_fixedAspectRatio)
This method enabled or disables the fixed aspect ratio property of this background image...
Definition: CBackground.h:113
void copyBackgroundProperties(cBackground *a_obj, const bool a_duplicateMaterialData, const bool a_duplicateTextureData, const bool a_duplicateMeshData, const bool a_buildCollisionDetector)
This method copies properties of this object to another.
Definition: CBackground.cpp:270
bool getFixedAspectRatio()
This method returns the fixed aspect ratio status of this background image.
Definition: CBackground.h:116
bool m_fixedAspectRatio
If true then the aspect ratio of the background image is maintained.
Definition: CBackground.h:126
This class implements a 2D bitmap widget.
Definition: CBitmap.h:77
This class implements a 2D background widget.
Definition: CBackground.h:79
virtual void render(cRenderOptions &a_options)
This method renders this object graphically (OpenGL).
Definition: CBackground.cpp:87
virtual ~cBackground()
Destructor of cBackground.
Definition: CBackground.h:91
Definition: CAudioBuffer.cpp:56
Implements a 2D image data structure.