Skip to content

Commit 8dce4c4

Browse files
committed
--cleanup magnum namespace aliases
1 parent f83fa04 commit 8dce4c4

17 files changed

+65
-86
lines changed

src/esp/sensor/AudioSensor.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,16 @@ void AudioSensor::reset() {
7878
impulseResponse_.clear();
7979
}
8080

81-
void AudioSensor::setAudioSourceTransform(const Magnum::Vector3& sourcePos) {
81+
void AudioSensor::setAudioSourceTransform(const Mn::Vector3& sourcePos) {
8282
ESP_DEBUG() << logHeader_
8383
<< "Setting the audio source position : " << sourcePos << "]";
8484
lastSourcePos_ = sourcePos;
8585
// track if the source has changed
8686
newSource_ = true;
8787
}
8888

89-
void AudioSensor::setAudioListenerTransform(
90-
const Magnum::Vector3& agentPos,
91-
const Magnum::Vector4& agentRotQuat) {
89+
void AudioSensor::setAudioListenerTransform(const Mn::Vector3& agentPos,
90+
const Mn::Vector4& agentRotQuat) {
9291
ESP_DEBUG() << logHeader_ << "Setting the agent transform : position ["
9392
<< agentPos << "], rotQuat[" << agentRotQuat << "]";
9493

src/esp/sensor/AudioSensor.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ class AudioSensor : public Sensor {
6868
* @brief Set the audio source transform
6969
* @param sourcePos = vec3 source position
7070
* */
71-
void setAudioSourceTransform(const Magnum::Vector3& sourcePos);
71+
void setAudioSourceTransform(const Mn::Vector3& sourcePos);
7272

7373
/**
7474
* @brief Set the audio listener position and orientation
7575
* @param agentPos = vec3 agent position
7676
* @param agentRotQuat = vec4 agent rotation quaternion
7777
* */
78-
void setAudioListenerTransform(const Magnum::Vector3& agentPos,
79-
const Magnum::Vector4& agentRotQuat);
78+
void setAudioListenerTransform(const Mn::Vector3& agentPos,
79+
const Mn::Vector4& agentRotQuat);
8080

8181
/**
8282
* @brief Run the audio simulation. This will run the RLRAudioPropagation code
@@ -146,11 +146,11 @@ class AudioSensor : public Sensor {
146146
//! track the number of simulations
147147
std::int32_t currentSimCount_ = -1;
148148
//! track the source position
149-
Magnum::Vector3 lastSourcePos_;
149+
Mn::Vector3 lastSourcePos_;
150150
//! track the agent orientation
151-
Magnum::Vector3 lastAgentPos_;
151+
Mn::Vector3 lastAgentPos_;
152152
//! track the agent rotation
153-
Magnum::Vector4 lastAgentRot_;
153+
Mn::Vector4 lastAgentRot_;
154154
//! audio materials json path
155155
std::string audioMaterialsJSON_;
156156

src/esp/sensor/CameraSensor.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ Mn::Matrix4 CameraSensorSpec::projectionMatrix() const {
6969
CameraSensor::CameraSensor(scene::SceneNode& cameraNode,
7070
const CameraSensorSpec::ptr& spec)
7171
: VisualSensor(cameraNode, spec),
72-
baseProjMatrix_(Magnum::Math::IdentityInit),
73-
zoomMatrix_(Magnum::Math::IdentityInit),
72+
baseProjMatrix_(Mn::Math::IdentityInit),
73+
zoomMatrix_(Mn::Math::IdentityInit),
7474
renderCamera_(new gfx::RenderCamera(cameraNode,
7575
visualSensorSpec_->semanticTarget)) {
7676
// Sanity check
@@ -177,8 +177,7 @@ bool CameraSensor::drawObservation(sim::Simulator& sim) {
177177
return true;
178178
}
179179

180-
Corrade::Containers::Optional<Magnum::Vector2> CameraSensor::depthUnprojection()
181-
const {
180+
Cr::Containers::Optional<Mn::Vector2> CameraSensor::depthUnprojection() const {
182181
// projectionMatrix_ is managed by implementation class and is set whenever
183182
// quantities change.
184183
return {gfx_batch::calculateDepthUnprojection(projectionMatrix_)};

src/esp/sensor/CameraSensor.h

+7-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct CameraSensorSpec : public VisualSensorSpec {
2121
CameraSensorSpec();
2222
void sanityCheck() const override;
2323
bool operator==(const CameraSensorSpec& a) const;
24-
Magnum::Matrix4 projectionMatrix() const;
24+
Mn::Matrix4 projectionMatrix() const;
2525
ESP_SMART_POINTERS(CameraSensorSpec)
2626
};
2727

@@ -50,8 +50,7 @@ class CameraSensor : public VisualSensor {
5050
* perspective projection model.
5151
* See @ref gfx::calculateDepthUnprojection
5252
*/
53-
Corrade::Containers::Optional<Magnum::Vector2> depthUnprojection()
54-
const override;
53+
Cr::Containers::Optional<Mn::Vector2> depthUnprojection() const override;
5554

5655
/**
5756
* @brief Draw an observation to the frame buffer using simulator's renderer
@@ -66,8 +65,7 @@ class CameraSensor : public VisualSensor {
6665
* @param factor Modification amount.
6766
*/
6867
void modifyZoom(float factor) {
69-
zoomMatrix_ =
70-
Magnum::Matrix4::scaling({factor, factor, 1.0f}) * zoomMatrix_;
68+
zoomMatrix_ = Mn::Matrix4::scaling({factor, factor, 1.0f}) * zoomMatrix_;
7169
recomputeProjectionMatrix();
7270
}
7371

@@ -76,7 +74,7 @@ class CameraSensor : public VisualSensor {
7674
* values.
7775
*/
7876
void resetZoom() {
79-
zoomMatrix_ = Magnum::Matrix4(Magnum::Math::IdentityInit);
77+
zoomMatrix_ = Mn::Matrix4(Mn::Math::IdentityInit);
8078
recomputeProjectionMatrix();
8179
}
8280

@@ -197,17 +195,17 @@ class CameraSensor : public VisualSensor {
197195
* @brief This camera's projection matrix. Should be recomputed every time
198196
* size changes.
199197
*/
200-
Magnum::Matrix4 projectionMatrix_;
198+
Mn::Matrix4 projectionMatrix_;
201199

202200
/**
203201
* @brief A base projection matrix based on camera's type and display size.
204202
*/
205-
Magnum::Matrix4 baseProjMatrix_;
203+
Mn::Matrix4 baseProjMatrix_;
206204

207205
/**
208206
* @brief A matrix to determine the zoom for the projection.
209207
*/
210-
Magnum::Matrix4 zoomMatrix_;
208+
Mn::Matrix4 zoomMatrix_;
211209

212210
/** @brief size of near plane
213211
*/

src/esp/sensor/CubeMapSensorBase.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#include <Corrade/Utility/Assert.h>
99
#include <Corrade/Utility/FormatStl.h>
1010

11-
namespace Mn = Magnum;
12-
namespace Cr = Corrade;
13-
1411
namespace esp {
1512
namespace sensor {
1613

@@ -28,11 +25,11 @@ void CubeMapSensorBaseSpec::sanityCheck() const {
2825
}
2926
}
3027

31-
int computeCubemapSize(const Magnum::Vector2i& resolution,
28+
int computeCubemapSize(const Mn::Vector2i& resolution,
3229
const Cr::Containers::Optional<int>& cubemapSize) {
3330
int size = (resolution[0] < resolution[1] ? resolution[0] : resolution[1]);
3431
// if user sets the size of the cubemap, use it
35-
if (cubemapSize != Corrade::Containers::NullOpt) {
32+
if (cubemapSize != Cr::Containers::NullOpt) {
3633
size = *cubemapSize;
3734
}
3835
return size;

src/esp/sensor/CubeMapSensorBase.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct CubeMapSensorBaseSpec : public VisualSensorSpec {
2626
/**
2727
* @brief the size of the cubemap
2828
*/
29-
Corrade::Containers::Optional<int> cubemapSize = Corrade::Containers::NullOpt;
29+
Cr::Containers::Optional<int> cubemapSize = Cr::Containers::NullOpt;
3030

3131
/**
3232
* @brief Constructor
@@ -75,22 +75,22 @@ class CubeMapSensorBase : public VisualSensor {
7575
// raw pointer only, we can create it but let magnum to handle the memory
7676
// recycling when releasing it.
7777
gfx::CubeMapCamera* cubeMapCamera_;
78-
Corrade::Containers::Optional<esp::gfx::CubeMap> cubeMap_;
78+
Cr::Containers::Optional<esp::gfx::CubeMap> cubeMap_;
7979

8080
// a big triangles that covers the whole screen
81-
Magnum::GL::Mesh mesh_;
81+
Mn::GL::Mesh mesh_;
8282

8383
// cubemap shader resource manager, which manages different shaders such as
8484
// DoubleSphereCameraShader, FieldOfViewCameraShader (TODO),
8585
// EquiRectangularShader ...
86-
Magnum::ResourceManager<gfx::CubeMapShaderBase> cubeMapShaderBaseManager_;
86+
Mn::ResourceManager<gfx::CubeMapShaderBase> cubeMapShaderBaseManager_;
8787

8888
gfx::CubeMapShaderBase::Flags cubeMapShaderBaseFlags_{};
8989

90-
virtual Magnum::ResourceKey getShaderKey() = 0;
90+
virtual Mn::ResourceKey getShaderKey() = 0;
9191

9292
template <typename T>
93-
Magnum::Resource<gfx::CubeMapShaderBase, T> getShader();
93+
Mn::Resource<gfx::CubeMapShaderBase, T> getShader();
9494

9595
/**
9696
* @brief render the sense into cubemap textures
@@ -108,8 +108,8 @@ class CubeMapSensorBase : public VisualSensor {
108108
};
109109

110110
template <typename T>
111-
Magnum::Resource<gfx::CubeMapShaderBase, T> CubeMapSensorBase::getShader() {
112-
Magnum::Resource<gfx::CubeMapShaderBase, T> shader =
111+
Mn::Resource<gfx::CubeMapShaderBase, T> CubeMapSensorBase::getShader() {
112+
Mn::Resource<gfx::CubeMapShaderBase, T> shader =
113113
cubeMapShaderBaseManager_.get<gfx::CubeMapShaderBase, T>(getShaderKey());
114114
if (!shader) {
115115
cubeMapShaderBaseManager_.set<gfx::CubeMapShaderBase>(

src/esp/sensor/EquirectangularSensor.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
#include "esp/gfx/EquirectangularShader.h"
1010
#include "esp/sim/Simulator.h"
1111

12-
namespace Mn = Magnum;
13-
namespace Cr = Corrade;
14-
1512
namespace esp {
1613
namespace sensor {
1714

@@ -40,7 +37,7 @@ bool EquirectangularSensor::drawObservation(sim::Simulator& sim) {
4037
return false;
4138
}
4239
renderToCubemapTexture(sim);
43-
Magnum::Resource<gfx::CubeMapShaderBase, gfx::EquirectangularShader> shader =
40+
Mn::Resource<gfx::CubeMapShaderBase, gfx::EquirectangularShader> shader =
4441
getShader<gfx::EquirectangularShader>();
4542

4643
(*shader).setViewportSize(equirectangularSensorSpec_->resolution);

src/esp/sensor/EquirectangularSensor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class EquirectangularSensor : public CubeMapSensorBase {
7373
protected:
7474
EquirectangularSensorSpec::ptr equirectangularSensorSpec_ =
7575
std::dynamic_pointer_cast<EquirectangularSensorSpec>(spec_);
76-
Magnum::ResourceKey getShaderKey() override;
76+
Mn::ResourceKey getShaderKey() override;
7777
ESP_SMART_POINTERS(EquirectangularSensor)
7878
};
7979

src/esp/sensor/FisheyeSensor.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#include <Corrade/Utility/Assert.h>
99
#include <Corrade/Utility/FormatStl.h>
1010

11-
namespace Mn = Magnum;
12-
namespace Cr = Corrade;
13-
1411
namespace esp {
1512
namespace sensor {
1613

@@ -48,7 +45,7 @@ void specSanityCheck(FisheyeSensorSpec* spec) {
4845
actualSpec->sanityCheck();
4946
}
5047

51-
Magnum::Vector2 computePrincipalPointOffset(const FisheyeSensorSpec& spec) {
48+
Mn::Vector2 computePrincipalPointOffset(const FisheyeSensorSpec& spec) {
5249
if (bool(spec.principalPointOffset)) {
5350
return *spec.principalPointOffset;
5451
}
@@ -86,7 +83,7 @@ bool FisheyeSensor::drawObservation(sim::Simulator& sim) {
8683

8784
switch (fisheyeSensorSpec_->fisheyeModelType) {
8885
case FisheyeSensorModelType::DoubleSphere: {
89-
Magnum::Resource<gfx::CubeMapShaderBase, gfx::DoubleSphereCameraShader>
86+
Mn::Resource<gfx::CubeMapShaderBase, gfx::DoubleSphereCameraShader>
9087
shader = getShader<gfx::DoubleSphereCameraShader>();
9188
auto& actualSpec =
9289
static_cast<FisheyeSensorDoubleSphereSpec&>(*fisheyeSensorSpec_);

src/esp/sensor/FisheyeSensor.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Simulator;
2424

2525
namespace sensor {
2626

27-
enum class FisheyeSensorModelType : Magnum::UnsignedInt {
27+
enum class FisheyeSensorModelType : Mn::UnsignedInt {
2828

2929
// Vladyslav Usenko, Nikolaus Demmel and Daniel Cremers: The Double Sphere
3030
// Camera Model, The International Conference on 3D Vision (3DV), 2018
@@ -46,13 +46,13 @@ struct FisheyeSensorSpec : public CubeMapSensorBaseSpec {
4646
* In practice, fx and fy can differ for a number of reasons. See
4747
* details here: http://ksimek.github.io/2013/08/13/intrinsic/
4848
*/
49-
Magnum::Vector2 focalLength;
49+
Mn::Vector2 focalLength;
5050
/**
5151
* @brief Principal Point Offset in pixel, cx, cy, location of the principal
5252
* point relative to the image plane's origin. None will place it in the
5353
* middle of the image (height/2, width/2).
5454
*/
55-
Corrade::Containers::Optional<Magnum::Vector2> principalPointOffset;
55+
Cr::Containers::Optional<Mn::Vector2> principalPointOffset;
5656

5757
/**
5858
* @brief Constructor
@@ -127,7 +127,7 @@ class FisheyeSensor : public CubeMapSensorBase {
127127
protected:
128128
FisheyeSensorSpec::ptr fisheyeSensorSpec_ =
129129
std::dynamic_pointer_cast<FisheyeSensorSpec>(spec_);
130-
Magnum::ResourceKey getShaderKey() override;
130+
Mn::ResourceKey getShaderKey() override;
131131

132132
ESP_SMART_POINTERS(FisheyeSensor)
133133
};

src/esp/sensor/Sensor.cpp

+9-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include <utility>
1010

11-
namespace Mn = Magnum;
1211
namespace esp {
1312
namespace sensor {
1413

@@ -44,7 +43,7 @@ void SensorSpec::sanityCheck() const {
4443
}
4544

4645
Sensor::Sensor(scene::SceneNode& node, SensorSpec::ptr spec)
47-
: Magnum::SceneGraph::AbstractFeature3D{node}, spec_(std::move(spec)) {
46+
: Mn::SceneGraph::AbstractFeature3D{node}, spec_(std::move(spec)) {
4847
CORRADE_ASSERT(node.children().first() == nullptr,
4948
"Sensor::Sensor(): Cannot attach a sensor to a non-LEAF node. "
5049
"The number of children of this node is not zero.", );
@@ -71,11 +70,11 @@ Sensor::~Sensor() {
7170

7271
scene::SceneNode& Sensor::object() {
7372
return static_cast<scene::SceneNode&>(
74-
Magnum::SceneGraph::AbstractFeature3D::object());
73+
Mn::SceneGraph::AbstractFeature3D::object());
7574
}
7675
const scene::SceneNode& Sensor::object() const {
7776
return static_cast<const scene::SceneNode&>(
78-
Magnum::SceneGraph::AbstractFeature3D::object());
77+
Mn::SceneGraph::AbstractFeature3D::object());
7978
}
8079

8180
void Sensor::setTransformationFromSpec() {
@@ -86,21 +85,21 @@ void Sensor::setTransformationFromSpec() {
8685
node().resetTransformation();
8786

8887
node().translate(spec_->position);
89-
node().rotateX(Magnum::Rad(spec_->orientation[0]));
90-
node().rotateY(Magnum::Rad(spec_->orientation[1]));
91-
node().rotateZ(Magnum::Rad(spec_->orientation[2]));
88+
node().rotateX(Mn::Rad(spec_->orientation[0]));
89+
node().rotateY(Mn::Rad(spec_->orientation[1]));
90+
node().rotateZ(Mn::Rad(spec_->orientation[2]));
9291
}
9392

9493
SensorSuite::SensorSuite(scene::SceneNode& node)
95-
: Magnum::SceneGraph::AbstractFeature3D{node} {}
94+
: Mn::SceneGraph::AbstractFeature3D{node} {}
9695

9796
scene::SceneNode& SensorSuite::object() {
9897
return static_cast<scene::SceneNode&>(
99-
Magnum::SceneGraph::AbstractFeature3D::object());
98+
Mn::SceneGraph::AbstractFeature3D::object());
10099
}
101100
const scene::SceneNode& SensorSuite::object() const {
102101
return static_cast<const scene::SceneNode&>(
103-
Magnum::SceneGraph::AbstractFeature3D::object());
102+
Mn::SceneGraph::AbstractFeature3D::object());
104103
}
105104

106105
void SensorSuite::add(sensor::Sensor& sensor) {

0 commit comments

Comments
 (0)