My Project
Loading...
Searching...
No Matches
CBackground.h
Go to the documentation of this file.
1//==============================================================================
2/*
3 Software License Agreement (BSD License)
4 Copyright (c) 2003-2024, 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.3.0
41*/
42//==============================================================================
43
44//------------------------------------------------------------------------------
45#ifndef CBackgroundH
46#define CBackgroundH
47//------------------------------------------------------------------------------
48#include "widgets/CBitmap.h"
49#include "graphics/CImage.h"
50//------------------------------------------------------------------------------
51
52//------------------------------------------------------------------------------
53namespace chai3d {
54//------------------------------------------------------------------------------
55
56//==============================================================================
63//==============================================================================
64
65//==============================================================================
78//==============================================================================
79class cBackground : public cBitmap
80{
81 //--------------------------------------------------------------------------
82 // CONSTRUCTOR & DESTRUCTOR:
83 //--------------------------------------------------------------------------
84
85public:
86
89
91 virtual ~cBackground() {};
92
93
94 //--------------------------------------------------------------------------
95 // PUBLIC METHODS:
96 //--------------------------------------------------------------------------
97
98public:
99
101 virtual std::string getClassName() { return ("Background"); }
102
104 virtual cBackground* copy(const bool a_duplicateMaterialData = false,
105 const bool a_duplicateTextureData = false,
106 const bool a_duplicateMeshData = false,
107 const bool a_buildCollisionDetector = false);
108
110 void update(const unsigned int a_bottomLeftX,
111 const unsigned int a_bottomLeftY,
112 const unsigned int a_topRightX,
113 const unsigned int a_topRightY);
114
116 inline void setFixedAspectRatio(bool a_fixedAspectRatio) { m_fixedAspectRatio = a_fixedAspectRatio; }
117
119 inline bool getFixedAspectRatio() { return (m_fixedAspectRatio); }
120
121
122 //--------------------------------------------------------------------------
123 // PROTECTED MEMBERS:
124 //--------------------------------------------------------------------------
125
126protected:
127
130
131
132 //--------------------------------------------------------------------------
133 // PROTECTED METHODS:
134 //--------------------------------------------------------------------------
135
136protected:
137
139 virtual void render(cRenderOptions& a_options);
140
143 const bool a_duplicateMaterialData,
144 const bool a_duplicateTextureData,
145 const bool a_duplicateMeshData,
146 const bool a_buildCollisionDetector);
147};
148
149//------------------------------------------------------------------------------
150} // namespace chai3d
151//------------------------------------------------------------------------------
152
153//------------------------------------------------------------------------------
154#endif
155//------------------------------------------------------------------------------
Implements a 2D bimap widget.
Implements a 2D image data structure.
This class implements a 2D background widget.
Definition CBackground.h:80
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
cBackground()
Constructor of cBackground.
Definition CBackground.cpp:60
virtual void render(cRenderOptions &a_options)
This method renders this object graphically (OpenGL).
Definition CBackground.cpp:87
bool m_fixedAspectRatio
If true then the aspect ratio of the background image is maintained.
Definition CBackground.h:129
virtual ~cBackground()
Destructor of cBackground.
Definition CBackground.h:91
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
bool getFixedAspectRatio()
This method returns the fixed aspect ratio status of this background image.
Definition CBackground.h:119
void setFixedAspectRatio(bool a_fixedAspectRatio)
This method enabled or disables the fixed aspect ratio property of this background image.
Definition CBackground.h:116
virtual std::string getClassName()
This method returns the name of the object class.
Definition CBackground.h:101
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
This class implements a 2D bitmap widget.
Definition CBitmap.h:78
Definition CAudioBuffer.cpp:57
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition CRenderOptions.h:83