Updated SensorGeometry so that frustum base color may be set separately in
in an SSC file.sensor-dev
parent
3617dd6e94
commit
7512d65311
|
@ -31,6 +31,7 @@ SensorGeometry::SensorGeometry() :
|
||||||
m_horizontalFov(degToRad(5.0)),
|
m_horizontalFov(degToRad(5.0)),
|
||||||
m_verticalFov(degToRad(5.0)),
|
m_verticalFov(degToRad(5.0)),
|
||||||
m_frustumColor(1.0f, 1.0f, 1.0f),
|
m_frustumColor(1.0f, 1.0f, 1.0f),
|
||||||
|
m_frustumBaseColor(1.0f, 1.0f, 1.0f),
|
||||||
m_frustumOpacity(0.25f),
|
m_frustumOpacity(0.25f),
|
||||||
m_gridOpacity(1.0f),
|
m_gridOpacity(1.0f),
|
||||||
m_shape(EllipticalShape)
|
m_shape(EllipticalShape)
|
||||||
|
@ -171,7 +172,7 @@ SensorGeometry::render(RenderContext& rc, double tsec)
|
||||||
glEnable(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
|
|
||||||
// Draw the footprint outline
|
// Draw the footprint outline
|
||||||
glColor4f(m_frustumColor.red(), m_frustumColor.green(), m_frustumColor.blue(), m_gridOpacity);
|
glColor4f(m_frustumBaseColor.red(), m_frustumBaseColor.green(), m_frustumBaseColor.blue(), m_gridOpacity);
|
||||||
glLineWidth(2.0f);
|
glLineWidth(2.0f);
|
||||||
glBegin(GL_LINE_LOOP);
|
glBegin(GL_LINE_LOOP);
|
||||||
for (unsigned int i = 0; i < sectionCount; ++i)
|
for (unsigned int i = 0; i < sectionCount; ++i)
|
||||||
|
@ -181,6 +182,7 @@ SensorGeometry::render(RenderContext& rc, double tsec)
|
||||||
glEnd();
|
glEnd();
|
||||||
glLineWidth(1.0f);
|
glLineWidth(1.0f);
|
||||||
|
|
||||||
|
glColor4f(m_frustumColor.red(), m_frustumColor.green(), m_frustumColor.blue(), m_frustumOpacity);
|
||||||
for (unsigned int slice = 1; slice < sliceCount; ++slice)
|
for (unsigned int slice = 1; slice < sliceCount; ++slice)
|
||||||
{
|
{
|
||||||
// Linear arrangement of slices
|
// Linear arrangement of slices
|
||||||
|
|
|
@ -92,6 +92,16 @@ class SensorGeometry : public Geometry
|
||||||
m_frustumColor = color;
|
m_frustumColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color frustumBaseColor() const
|
||||||
|
{
|
||||||
|
return m_frustumBaseColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFrustumBaseColor(const Color& color)
|
||||||
|
{
|
||||||
|
m_frustumBaseColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
float frustumOpacity() const
|
float frustumOpacity() const
|
||||||
{
|
{
|
||||||
return m_frustumOpacity;
|
return m_frustumOpacity;
|
||||||
|
@ -121,6 +131,7 @@ class SensorGeometry : public Geometry
|
||||||
double m_horizontalFov;
|
double m_horizontalFov;
|
||||||
double m_verticalFov;
|
double m_verticalFov;
|
||||||
Color m_frustumColor;
|
Color m_frustumColor;
|
||||||
|
Color m_frustumBaseColor;
|
||||||
float m_frustumOpacity;
|
float m_frustumOpacity;
|
||||||
float m_gridOpacity;
|
float m_gridOpacity;
|
||||||
SensorShape m_shape;
|
SensorShape m_shape;
|
||||||
|
|
|
@ -933,12 +933,15 @@ static Body* CreateBody(const string& name,
|
||||||
|
|
||||||
// Appearance attributes
|
// Appearance attributes
|
||||||
Color frustumColor(1.0f, 1.0f, 1.0f);
|
Color frustumColor(1.0f, 1.0f, 1.0f);
|
||||||
|
Color frustumBaseColor(1.0f, 1.0f, 1.0f);
|
||||||
float frustumOpacity = 0.25f;
|
float frustumOpacity = 0.25f;
|
||||||
float gridOpacity = 1.0f;
|
float gridOpacity = 1.0f;
|
||||||
sensorData->getColor("FrustumColor", frustumColor);
|
sensorData->getColor("FrustumColor", frustumColor);
|
||||||
|
sensorData->getColor("FrustumBaseColor", frustumBaseColor);
|
||||||
sensorData->getNumber("FrustumOpacity", frustumOpacity);
|
sensorData->getNumber("FrustumOpacity", frustumOpacity);
|
||||||
sensorData->getNumber("GridOpacity", gridOpacity);
|
sensorData->getNumber("GridOpacity", gridOpacity);
|
||||||
sensor->setFrustumColor(frustumColor);
|
sensor->setFrustumColor(frustumColor);
|
||||||
|
sensor->setFrustumBaseColor(frustumBaseColor);
|
||||||
sensor->setFrustumOpacity(frustumOpacity);
|
sensor->setFrustumOpacity(frustumOpacity);
|
||||||
sensor->setGridOpacity(gridOpacity);
|
sensor->setGridOpacity(gridOpacity);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue