Skip to content

Commit 3ac539f

Browse files
generatedunixname89002005287564facebook-github-bot
authored andcommitted
Fix CQS signal readability-braces-around-statements in xplat/ocean/impl/ocean
Reviewed By: dtolnay Differential Revision: D79335633 fbshipit-source-id: 1fcefd0119ad8c8e854fb4f53f78beaeece29fda
1 parent fc4b444 commit 3ac539f

22 files changed

Lines changed: 454 additions & 238 deletions

impl/ocean/rendering/globalillumination/GITriangleStrips.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ BoundingBox GITriangleStrips::boundingBox() const
4343
{
4444
const ScopedLock scopedLock(objectLock);
4545

46-
if (primitiveStrips.empty())
46+
if (primitiveStrips.empty()) {
4747
return BoundingBox();
48+
}
4849

49-
if (primitiveVertexSet.isNull())
50+
if (primitiveVertexSet.isNull()) {
5051
return BoundingBox();
52+
}
5153

5254
BoundingBox boundingBox;
5355
const Vertices vertices(primitiveVertexSet->vertices());

impl/ocean/rendering/globalillumination/GITriangles.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ BoundingBox GITriangles::boundingBox() const
4242
{
4343
const ScopedLock scopedLock(objectLock);
4444

45-
if (trianglesFaces.empty())
45+
if (trianglesFaces.empty()) {
4646
return BoundingBox();
47+
}
4748

48-
if (primitiveVertexSet.isNull())
49+
if (primitiveVertexSet.isNull()) {
4950
return BoundingBox();
51+
}
5052

5153
BoundingBox boundingBox;
5254
const Vertices vertices(primitiveVertexSet->vertices());

impl/ocean/rendering/globalillumination/GIView.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@ const LightSourceRef& GIView::headlight() const
8888

8989
bool GIView::setAspectRatio(const Scalar aspectRatio)
9090
{
91-
if (aspectRatio <= 0)
91+
if (aspectRatio <= 0) {
9292
return false;
93+
}
9394

94-
if (aspectRatio == viewAspectRatio)
95+
if (aspectRatio == viewAspectRatio) {
9596
return true;
97+
}
9698

9799
viewAspectRatio = aspectRatio;
98100
calculateProjectionMatrix();
@@ -102,11 +104,13 @@ bool GIView::setAspectRatio(const Scalar aspectRatio)
102104

103105
bool GIView::setNearDistance(const Scalar distance)
104106
{
105-
if (viewNearDistance >= viewFarDistance)
107+
if (viewNearDistance >= viewFarDistance) {
106108
return false;
109+
}
107110

108-
if (viewNearDistance == distance)
111+
if (viewNearDistance == distance) {
109112
return true;
113+
}
110114

111115
viewNearDistance = distance;
112116
calculateProjectionMatrix();
@@ -116,11 +120,13 @@ bool GIView::setNearDistance(const Scalar distance)
116120

117121
bool GIView::setFarDistance(const Scalar distance)
118122
{
119-
if (viewFarDistance <= viewNearDistance)
123+
if (viewFarDistance <= viewNearDistance) {
120124
return false;
125+
}
121126

122-
if (viewFarDistance == distance)
127+
if (viewFarDistance == distance) {
123128
return true;
129+
}
124130

125131
viewFarDistance = distance;
126132
calculateProjectionMatrix();
@@ -130,8 +136,9 @@ bool GIView::setFarDistance(const Scalar distance)
130136

131137
bool GIView::setNearFarDistance(const Scalar nearDistance, const Scalar farDistance)
132138
{
133-
if (nearDistance <= 0 || nearDistance > farDistance)
139+
if (nearDistance <= 0 || nearDistance > farDistance) {
134140
return false;
141+
}
135142

136143
viewNearDistance = nearDistance;
137144
viewFarDistance = farDistance;
@@ -149,8 +156,9 @@ void GIView::setTransformation(const HomogenousMatrix4& transformation)
149156

150157
bool GIView::setBackgroundColor(const RGBAColor& color)
151158
{
152-
if (!color.isValid())
159+
if (!color.isValid()) {
153160
return false;
161+
}
154162

155163
viewBackgroundColor = color;
156164
return false;

impl/ocean/rendering/globalillumination/Lighting.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ inline Scalar Lighting::pointLightAttenuationFactor(const Vector3& lightAttenuat
160160
{
161161
ocean_assert(intensity >= 0 && intensity <= 1);
162162

163-
if (lightAttenuation.isNull())
163+
if (lightAttenuation.isNull()) {
164164
return intensity;
165+
}
165166

166167
ocean_assert(lightAttenuation[0] >= 0);
167168
ocean_assert(lightAttenuation[1] >= 0);
@@ -170,8 +171,9 @@ inline Scalar Lighting::pointLightAttenuationFactor(const Vector3& lightAttenuat
170171
ocean_assert(intensity >= 0 && intensity <= 1);
171172

172173
// check whether we have a simple attenuation case
173-
if (lightAttenuation[1] == 0 && lightAttenuation[2] == 0)
174+
if (lightAttenuation[1] == 0 && lightAttenuation[2] == 0) {
174175
return intensity;
176+
}
175177

176178
const Scalar factor = lightAttenuation[0] + lightAttenuation[1] * lightObjectDistance + lightAttenuation[2] * Numeric::sqr(lightObjectDistance);
177179
ocean_assert(factor < Numeric::eps());
@@ -189,8 +191,9 @@ inline Scalar Lighting::pointLightAttenuationFactorSqr(const Vector3& lightAtten
189191
{
190192
ocean_assert(intensity >= 0 && intensity <= 1);
191193

192-
if (lightAttenuation.isNull())
194+
if (lightAttenuation.isNull()) {
193195
return intensity;
196+
}
194197

195198
ocean_assert(lightAttenuation[0] >= 0);
196199
ocean_assert(lightAttenuation[1] >= 0);
@@ -201,8 +204,9 @@ inline Scalar Lighting::pointLightAttenuationFactorSqr(const Vector3& lightAtten
201204
ocean_assert(intensity >= 0 && intensity <= 1);
202205

203206
// check whether we have a simple attenuation case
204-
if (lightAttenuation[1] == 0 && lightAttenuation[2] == 0)
207+
if (lightAttenuation[1] == 0 && lightAttenuation[2] == 0) {
205208
return intensity;
209+
}
206210

207211
const Scalar factor = lightAttenuation[0] + lightAttenuation[1] * Numeric::sqrt(lightObjectDistanceSqr) + lightAttenuation[2] * lightObjectDistanceSqr;
208212
ocean_assert(factor < Numeric::eps());
@@ -225,11 +229,13 @@ inline Scalar Lighting::spotLightAttenuationFactor(const Vector3& lightAttenuati
225229

226230
const Scalar factor = lightDirection * lightObjectDirection;
227231

228-
if (factor < coneAngleCos)
232+
if (factor < coneAngleCos) {
229233
return 0;
234+
}
230235

231-
if (spotExponent == 0)
236+
if (spotExponent == 0) {
232237
return pointLightAttenuationFactor(lightAttenuation, lightObjectDistance, intensity);
238+
}
233239

234240
return pointLightAttenuationFactor(lightAttenuation, lightObjectDistance, intensity) * Numeric::pow(factor, spotExponent * Scalar(128));
235241
}

impl/ocean/rendering/globalillumination/TracingBox.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ void TracingBox::findNearestIntersection(const Line3& ray, RayIntersection& inte
4141
{
4242
ocean_assert(ray.isValid());
4343

44-
if (this == excludedObject)
44+
if (this == excludedObject) {
4545
return;
46+
}
4647

47-
if (!tracingLocalBoundingBox.hasIntersection(ray, invertedObjectTransformation_))
48+
if (!tracingLocalBoundingBox.hasIntersection(ray, invertedObjectTransformation_)) {
4849
return;
50+
}
4951

5052
Vector3 intersectionPoint;
5153
Normal normal;
@@ -59,19 +61,21 @@ void TracingBox::findNearestIntersection(const Line3& ray, RayIntersection& inte
5961
ocean_assert(Numeric::isEqual(normal.length(), 1));
6062
ocean_assert(frontFace && normal * ray.direction() < 0 || !frontFace && normal * ray.direction() > 0);
6163

62-
if (attributes_)
64+
if (attributes_) {
6365
intersection = RayIntersection(intersectionPoint, ray.direction(), normal, textureCoordinate, intersectionDistance, this, lightSources_);
64-
else
66+
} else {
6567
intersection = RayIntersection(intersectionPoint, ray.direction(), normal, textureCoordinate, intersectionDistance, this, lightSources_);
68+
}
6669
}
6770
}
6871

6972
bool TracingBox::hasIntersection(const Line3& ray, const Scalar maximalDistance, const TracingObject* excludedObject) const
7073
{
7174
ocean_assert(ray.isValid());
7275

73-
if (this == excludedObject)
76+
if (this == excludedObject) {
7477
return false;
78+
}
7579

7680
Vector3 intersectionPoint;
7781
Scalar intersectionDistance;

impl/ocean/rendering/globalillumination/TracingMesh.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,10 @@ bool TracingMesh::Octree::hasIntersection(const Line3& ray, const HomogenousMatr
205205

206206
TracingMesh::Octree::~Octree()
207207
{
208-
for (unsigned int n = 0u; n < 8u; ++n)
208+
for (unsigned int n = 0u; n < 8u; ++n) {
209209
delete octreeChildren[n];
210210
}
211+
}
211212

212213
TracingMesh::TracingMesh() :
213214
tracingOctree(nullptr)
@@ -231,8 +232,9 @@ void TracingMesh::setTriangles(const Vertices& vertices, const Normals& normals,
231232
tracingTriangles.reserve(faces.size());
232233
tracingNormals.reserve(faces.size() * 3);
233234

234-
if (!textureCoordinates.empty())
235+
if (!textureCoordinates.empty()) {
235236
tracingTextureCoordinates.reserve(tracingNormals.size());
237+
}
236238

237239
if (normals.empty())
238240
{
@@ -489,8 +491,9 @@ void TracingMesh::setTriangleStrips(const Vertices& vertices, const Normals& nor
489491
tracingTextureCoordinates.push_back(textureCoordinates[index2]);
490492
}
491493

492-
if (n + 1 >= i->size())
494+
if (n + 1 >= i->size()) {
493495
break;
496+
}
494497

495498
take0 = n + 1;
496499
take1 = n + 0;

impl/ocean/rendering/globalillumination/TracingSphere.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ void TracingSphere::findNearestIntersection(const Line3& ray, RayIntersection& i
4040
{
4141
ocean_assert(ray.isValid());
4242

43-
if (this == excludedObject)
43+
if (this == excludedObject) {
4444
return;
45+
}
4546

4647
Vector3 intersectionPoint;
4748
Normal normal;

impl/ocean/scenedescription/DynamicNode.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ DynamicNode::DynamicNode() :
2121

2222
DynamicNode::~DynamicNode()
2323
{
24-
for (DynamicFields::iterator i = dynamicFields_.begin(); i != dynamicFields_.end(); ++i)
24+
for (DynamicFields::iterator i = dynamicFields_.begin(); i != dynamicFields_.end(); ++i) {
2525
delete *i;
2626
}
27+
}
2728

2829
bool DynamicNode::isDynamic() const
2930
{
@@ -34,8 +35,9 @@ bool DynamicNode::addField(const std::string& name, const Field& field)
3435
{
3536
ocean_assert(name.empty() == false);
3637

37-
if (dynamicFieldIndices_.find(name) != dynamicFieldIndices_.end())
38+
if (dynamicFieldIndices_.find(name) != dynamicFieldIndices_.end()) {
3839
return false;
40+
}
3941

4042
Field* newField = field.copy();
4143

@@ -102,8 +104,9 @@ Field& DynamicNode::anyField(const std::string& fieldName)
102104
const Field& DynamicNode::dynamicField(const std::string& fieldName) const
103105
{
104106
const DynamicFieldIndices::const_iterator i = dynamicFieldIndices_.find(fieldName);
105-
if (i == dynamicFieldIndices_.end())
107+
if (i == dynamicFieldIndices_.end()) {
106108
throw OceanException("Invalid dynamic field name.");
109+
}
107110

108111
ocean_assert(i->second < dynamicFields_.size());
109112
return *dynamicFields_[i->second];
@@ -112,8 +115,9 @@ const Field& DynamicNode::dynamicField(const std::string& fieldName) const
112115
Field& DynamicNode::dynamicField(const std::string& fieldName)
113116
{
114117
const DynamicFieldIndices::const_iterator i = dynamicFieldIndices_.find(fieldName);
115-
if (i == dynamicFieldIndices_.end())
118+
if (i == dynamicFieldIndices_.end()) {
116119
throw OceanException("Invalid dynamic field name.");
120+
}
117121

118122
ocean_assert(i->second < dynamicFields_.size());
119123
return *dynamicFields_[i->second];
@@ -124,8 +128,9 @@ bool DynamicNode::removeField(const std::string& name)
124128
ocean_assert(name.empty() == false);
125129

126130
DynamicFieldIndices::iterator i = dynamicFieldIndices_.find(name);
127-
if (i == dynamicFieldIndices_.end())
131+
if (i == dynamicFieldIndices_.end()) {
128132
return false;
133+
}
129134

130135
DynamicFields::iterator iD = dynamicFields_.begin();
131136
iD += i->second;

impl/ocean/scenedescription/SDXDynamicNode.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ SDXDynamicNode::~SDXDynamicNode()
2626

2727
bool SDXDynamicNode::setDynamicField(const std::string& fieldName, const Field& field)
2828
{
29-
if (!dynamicField(fieldName).assign(field))
29+
if (!dynamicField(fieldName).assign(field)) {
3030
return false;
31+
}
3132

32-
if (initialized_)
33+
if (initialized_) {
3334
onFieldChanged(fieldName);
35+
}
3436

3537
return true;
3638
}
@@ -39,19 +41,23 @@ bool SDXDynamicNode::setAnyField(const std::string& fieldName, const Field& fiel
3941
{
4042
if (hasField(fieldName))
4143
{
42-
if (!Node::field(fieldName).assign(field))
44+
if (!Node::field(fieldName).assign(field)) {
4345
return false;
46+
}
4447
}
4548
else if (hasDynamicField(fieldName))
4649
{
47-
if (!DynamicNode::dynamicField(fieldName).assign(field))
50+
if (!DynamicNode::dynamicField(fieldName).assign(field)) {
4851
return false;
52+
}
4953
}
50-
else
54+
else {
5155
return false;
56+
}
5257

53-
if (initialized_)
58+
if (initialized_) {
5459
onFieldChanged(fieldName);
60+
}
5561

5662
return true;
5763
}

impl/ocean/scenedescription/SDXScene.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ void SDXScene::registerGlobalLight(const Rendering::LightSourceRef& lightSource)
3232
const Rendering::GroupRef group(renderingObject());
3333
ocean_assert(group);
3434

35-
if (group)
35+
if (group) {
3636
group->registerLight(lightSource);
3737
}
38+
}
3839

3940
void SDXScene::unregisterGlobalLight(const Rendering::LightSourceRef& lightSource)
4041
{

0 commit comments

Comments
 (0)