My Project
Loading...
Searching...
No Matches
CScope.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 CScopeH
46#define CScopeH
47//------------------------------------------------------------------------------
48#include "widgets/CPanel.h"
49//------------------------------------------------------------------------------
50
51//------------------------------------------------------------------------------
52namespace chai3d {
53//------------------------------------------------------------------------------
54
55//------------------------------------------------------------------------------
56const int C_SCOPE_MAX_SAMPLES = 6000;
57//------------------------------------------------------------------------------
58
59//==============================================================================
66//==============================================================================
67
68//==============================================================================
79//==============================================================================
80class cScope : public cPanel
81{
82 //--------------------------------------------------------------------------
83 // CONSTRUCTOR & DESTRUCTOR:
84 //--------------------------------------------------------------------------
85
86public:
87
89 cScope();
90
92 virtual ~cScope() {};
93
94
95 //--------------------------------------------------------------------------
96 // PUBLIC METHODS:
97 //--------------------------------------------------------------------------
98
99public:
100
102 virtual std::string getClassName() { return ("Scope"); }
103
105 virtual cScope* copy(const bool a_duplicateMaterialData = false,
106 const bool a_duplicateTextureData = false,
107 const bool a_duplicateMeshData = false,
108 const bool a_buildCollisionDetector = false);
109
111 virtual void setSize(const double& a_width, const double& a_height);
112
114 inline void setLineWidth(const double a_lineWidth) { m_lineWidth = fabs(a_lineWidth); }
115
117 inline double getLineWidth() const { return (m_lineWidth); }
118
120 void setSignalValues(const double a_signalValue0 = 0.0,
121 const double a_signalValue1 = 0.0,
122 const double a_signalValue2 = 0.0,
123 const double a_signalValue3 = 0.0);
124
126 void setSignalEnabled(const bool a_signalEnabled0 = true,
127 const bool a_signalEnabled1 = true,
128 const bool a_signalEnabled2 = true,
129 const bool a_signalEnabled3 = true);
130
132 void clearSignals();
133
135 virtual void setRange(const double a_minValue,
136 const double a_maxValue);
137
139 inline double getRangeMin() const { return (m_minValue); }
140
142 inline double getRangeMax() const { return (m_maxValue); }
143
144
145 //--------------------------------------------------------------------------
146 // PUBLIC MEMBERS:
147 //--------------------------------------------------------------------------
148
149public:
150
153
156
159
162
163
164 //--------------------------------------------------------------------------
165 // PROTECTED MEMBERS:
166 //--------------------------------------------------------------------------
167
168protected:
169
172
175
178
181
184
186 unsigned int m_index0;
187
189 unsigned int m_index1;
190
193
196
199
202
203
204 //--------------------------------------------------------------------------
205 // PROTECTED METHODS:
206 //--------------------------------------------------------------------------
207
208protected:
209
211 virtual void render(cRenderOptions& a_options);
212
214 void copyScopeProperties(cScope* a_obj,
215 const bool a_duplicateMaterialData,
216 const bool a_duplicateTextureData,
217 const bool a_duplicateMeshData,
218 const bool a_buildCollisionDetector);
219};
220
221//------------------------------------------------------------------------------
222} // namespace chai3d
223//------------------------------------------------------------------------------
224
225//------------------------------------------------------------------------------
226#endif
227//------------------------------------------------------------------------------
Implements a panel widget.
This class implements a 2D panel widget.
Definition CPanel.h:81
This class implements a 2D scope to display signals.
Definition CScope.h:81
double m_scopeHeight
Internal height of scope data display.
Definition CScope.h:198
void copyScopeProperties(cScope *a_obj, const bool a_duplicateMaterialData, const bool a_duplicateTextureData, const bool a_duplicateMeshData, const bool a_buildCollisionDetector)
This method copies all properties of this object to another.
Definition CScope.cpp:382
virtual cScope * copy(const bool a_duplicateMaterialData=false, const bool a_duplicateTextureData=false, const bool a_duplicateMeshData=false, const bool a_buildCollisionDetector=false)
This method creates a copy of itself.
Definition CScope.cpp:351
virtual std::string getClassName()
This method returns the name of the object class.
Definition CScope.h:102
virtual void setRange(const double a_minValue, const double a_maxValue)
This method sets the range of input values which can be displayed on the scope.
Definition CScope.cpp:186
void setLineWidth(const double a_lineWidth)
This method sets the line width of the signal.
Definition CScope.h:114
double m_scopeWidth
Internal width of scope data display.
Definition CScope.h:195
double getRangeMax() const
This method returns the maximum value from the range.
Definition CScope.h:142
double m_lineWidth
Width used to render lines.
Definition CScope.h:192
unsigned int m_index1
Index of last sample.
Definition CScope.h:189
bool m_signalEnabled[4]
Status about all signals.
Definition CScope.h:183
int m_signalPoints[4][C_SCOPE_MAX_SAMPLES]
Data points for all signals.
Definition CScope.h:180
double getRangeMin() const
This method returns the minimum value from the range.
Definition CScope.h:139
virtual void setSize(const double &a_width, const double &a_height)
This method sets the size of this scope.
Definition CScope.cpp:218
double m_signalValues[4][C_SCOPE_MAX_SAMPLES]
Data values for all signals.
Definition CScope.h:177
virtual void render(cRenderOptions &a_options)
This method renders the object graphically using OpenGL.
Definition CScope.cpp:265
cColorf m_colorSignal3
Color settings for signal 3.
Definition CScope.h:161
cVector3d m_scopePosition
Position of scope in reference to Panel.
Definition CScope.h:201
cColorf m_colorSignal2
Color settings for signal 2.
Definition CScope.h:158
void clearSignals()
This method clears all signals.
Definition CScope.cpp:171
cScope()
Constructor of cScope.
Definition CScope.cpp:59
double m_minValue
Range - minimum value.
Definition CScope.h:171
unsigned int m_index0
Index of first sample.
Definition CScope.h:186
cColorf m_colorSignal1
Color settings for signal 1.
Definition CScope.h:155
cColorf m_colorSignal0
Color settings for signal 0.
Definition CScope.h:152
void setSignalValues(const double a_signalValue0=0.0, const double a_signalValue1=0.0, const double a_signalValue2=0.0, const double a_signalValue3=0.0)
This method sets values for signals 0, 1, 2, and 3.
Definition CScope.cpp:105
void setSignalEnabled(const bool a_signalEnabled0=true, const bool a_signalEnabled1=true, const bool a_signalEnabled2=true, const bool a_signalEnabled3=true)
This method enables or disables selected signals.
Definition CScope.cpp:154
double getLineWidth() const
This method returns the line width of the signal.
Definition CScope.h:117
double m_maxValue
Range - maximum value.
Definition CScope.h:174
virtual ~cScope()
Destructor of cScope.
Definition CScope.h:92
Definition CAudioBuffer.cpp:57
const int C_SCOPE_MAX_SAMPLES
Definition CScope.h:56
This class defines a color using a GLfloat representation for each component.
Definition CColor.h:139
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition CRenderOptions.h:83
This class implements a 3D vector.
Definition CVector3d.h:89