Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/freestyle/intern/application/AppView.cpp
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/freestyle/intern/application/AppView.cpp')
-rw-r--r--source/blender/freestyle/intern/application/AppView.cpp188
1 files changed, 89 insertions, 99 deletions
diff --git a/source/blender/freestyle/intern/application/AppView.cpp b/source/blender/freestyle/intern/application/AppView.cpp
index 12b4f3db93a..e352e77f7ea 100644
--- a/source/blender/freestyle/intern/application/AppView.cpp
+++ b/source/blender/freestyle/intern/application/AppView.cpp
@@ -38,7 +38,7 @@ extern "C" {
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
-#if 1 // FRS_antialiasing
+#if 1 // FRS_antialiasing
# include "BKE_global.h"
# include "DNA_scene_types.h"
#endif
@@ -50,136 +50,126 @@ namespace Freestyle {
AppView::AppView(const char * /*iName*/)
{
- _Fovy = DEG2RADF(30.0f);
- _ModelRootNode = new NodeDrawingStyle;
- _SilhouetteRootNode = new NodeDrawingStyle;
- _DebugRootNode = new NodeDrawingStyle;
+ _Fovy = DEG2RADF(30.0f);
+ _ModelRootNode = new NodeDrawingStyle;
+ _SilhouetteRootNode = new NodeDrawingStyle;
+ _DebugRootNode = new NodeDrawingStyle;
- _RootNode.AddChild(_ModelRootNode);
- _SilhouetteRootNode->setStyle(DrawingStyle::LINES);
- _SilhouetteRootNode->setLightingEnabled(false);
- _SilhouetteRootNode->setLineWidth(2.0f);
- _SilhouetteRootNode->setPointSize(3.0f);
+ _RootNode.AddChild(_ModelRootNode);
+ _SilhouetteRootNode->setStyle(DrawingStyle::LINES);
+ _SilhouetteRootNode->setLightingEnabled(false);
+ _SilhouetteRootNode->setLineWidth(2.0f);
+ _SilhouetteRootNode->setPointSize(3.0f);
- _RootNode.AddChild(_SilhouetteRootNode);
+ _RootNode.AddChild(_SilhouetteRootNode);
- _DebugRootNode->setStyle(DrawingStyle::LINES);
- _DebugRootNode->setLightingEnabled(false);
- _DebugRootNode->setLineWidth(1.0f);
+ _DebugRootNode->setStyle(DrawingStyle::LINES);
+ _DebugRootNode->setLightingEnabled(false);
+ _DebugRootNode->setLineWidth(1.0f);
- _RootNode.AddChild(_DebugRootNode);
+ _RootNode.AddChild(_DebugRootNode);
- _minBBox = std::min(std::min(_ModelRootNode->bbox().getMin()[0], _ModelRootNode->bbox().getMin()[1]),
- _ModelRootNode->bbox().getMin()[2]);
- _maxBBox = std::max(std::max(_ModelRootNode->bbox().getMax()[0], _ModelRootNode->bbox().getMax()[1]),
- _ModelRootNode->bbox().getMax()[2]);
+ _minBBox = std::min(
+ std::min(_ModelRootNode->bbox().getMin()[0], _ModelRootNode->bbox().getMin()[1]),
+ _ModelRootNode->bbox().getMin()[2]);
+ _maxBBox = std::max(
+ std::max(_ModelRootNode->bbox().getMax()[0], _ModelRootNode->bbox().getMax()[1]),
+ _ModelRootNode->bbox().getMax()[2]);
- _maxAbs = std::max(rabs(_minBBox), rabs(_maxBBox));
- _minAbs = std::min(rabs(_minBBox), rabs(_maxBBox));
+ _maxAbs = std::max(rabs(_minBBox), rabs(_maxBBox));
+ _minAbs = std::min(rabs(_minBBox), rabs(_maxBBox));
- _p2DSelectionNode = new NodeDrawingStyle;
- _p2DSelectionNode->setLightingEnabled(false);
- _p2DSelectionNode->setStyle(DrawingStyle::LINES);
- _p2DSelectionNode->setLineWidth(5.0f);
+ _p2DSelectionNode = new NodeDrawingStyle;
+ _p2DSelectionNode->setLightingEnabled(false);
+ _p2DSelectionNode->setStyle(DrawingStyle::LINES);
+ _p2DSelectionNode->setLineWidth(5.0f);
- _p2DNode.AddChild(_p2DSelectionNode);
+ _p2DNode.AddChild(_p2DSelectionNode);
- NodeLight *light = new NodeLight;
- _Light.AddChild(light);
+ NodeLight *light = new NodeLight;
+ _Light.AddChild(light);
}
AppView::~AppView()
{
- /*int ref =*/ /* UNUSED */ _RootNode.destroy();
+ /*int ref =*//* UNUSED */ _RootNode.destroy();
- _Light.destroy();
- /*ref =*/ /* UNUSED */ _p2DNode.destroy();
+ _Light.destroy();
+ /*ref =*//* UNUSED */ _p2DNode.destroy();
}
real AppView::distanceToSceneCenter()
{
- BBox<Vec3r> bbox = _ModelRootNode->bbox();
+ BBox<Vec3r> bbox = _ModelRootNode->bbox();
- Vec3r v(UNPACK3(g_freestyle.viewpoint));
- v -= 0.5 * (bbox.getMin() + bbox.getMax());
+ Vec3r v(UNPACK3(g_freestyle.viewpoint));
+ v -= 0.5 * (bbox.getMin() + bbox.getMax());
- return v.norm();
+ return v.norm();
}
real AppView::znear()
{
- BBox<Vec3r> bbox = _ModelRootNode->bbox();
- Vec3r u = bbox.getMin();
- Vec3r v = bbox.getMax();
- Vec3r cameraCenter(UNPACK3(g_freestyle.viewpoint));
-
- Vec3r w1(u[0], u[1], u[2]);
- Vec3r w2(v[0], u[1], u[2]);
- Vec3r w3(u[0], v[1], u[2]);
- Vec3r w4(v[0], v[1], u[2]);
- Vec3r w5(u[0], u[1], v[2]);
- Vec3r w6(v[0], u[1], v[2]);
- Vec3r w7(u[0], v[1], v[2]);
- Vec3r w8(v[0], v[1], v[2]);
-
- real _znear = std::min((w1 - cameraCenter).norm(),
- std::min((w2 - cameraCenter).norm(),
- std::min((w3 - cameraCenter).norm(),
- std::min((w4 - cameraCenter).norm(),
- std::min((w5 - cameraCenter).norm(),
- std::min((w6 - cameraCenter).norm(),
- std::min((w7 - cameraCenter).norm(),
- (w8 - cameraCenter).norm()
- )
- )
- )
- )
- )
- )
- );
-
- return std::max(_znear, 0.001);
+ BBox<Vec3r> bbox = _ModelRootNode->bbox();
+ Vec3r u = bbox.getMin();
+ Vec3r v = bbox.getMax();
+ Vec3r cameraCenter(UNPACK3(g_freestyle.viewpoint));
+
+ Vec3r w1(u[0], u[1], u[2]);
+ Vec3r w2(v[0], u[1], u[2]);
+ Vec3r w3(u[0], v[1], u[2]);
+ Vec3r w4(v[0], v[1], u[2]);
+ Vec3r w5(u[0], u[1], v[2]);
+ Vec3r w6(v[0], u[1], v[2]);
+ Vec3r w7(u[0], v[1], v[2]);
+ Vec3r w8(v[0], v[1], v[2]);
+
+ real _znear = std::min(
+ (w1 - cameraCenter).norm(),
+ std::min((w2 - cameraCenter).norm(),
+ std::min((w3 - cameraCenter).norm(),
+ std::min((w4 - cameraCenter).norm(),
+ std::min((w5 - cameraCenter).norm(),
+ std::min((w6 - cameraCenter).norm(),
+ std::min((w7 - cameraCenter).norm(),
+ (w8 - cameraCenter).norm())))))));
+
+ return std::max(_znear, 0.001);
}
real AppView::zfar()
{
- BBox<Vec3r> bbox = _ModelRootNode->bbox();
- Vec3r u = bbox.getMin();
- Vec3r v = bbox.getMax();
- Vec3r cameraCenter(UNPACK3(g_freestyle.viewpoint));
-
- Vec3r w1(u[0], u[1], u[2]);
- Vec3r w2(v[0], u[1], u[2]);
- Vec3r w3(u[0], v[1], u[2]);
- Vec3r w4(v[0], v[1], u[2]);
- Vec3r w5(u[0], u[1], v[2]);
- Vec3r w6(v[0], u[1], v[2]);
- Vec3r w7(u[0], v[1], v[2]);
- Vec3r w8(v[0], v[1], v[2]);
-
- real _zfar = std::max((w1 - cameraCenter).norm(),
- std::max((w2 - cameraCenter).norm(),
- std::max((w3 - cameraCenter).norm(),
- std::max((w4 - cameraCenter).norm(),
- std::max((w5 - cameraCenter).norm(),
- std::max((w6 - cameraCenter).norm(),
- std::max((w7 - cameraCenter).norm(),
- (w8 - cameraCenter).norm()
- )
- )
- )
- )
- )
- )
- );
-
- return _zfar;
+ BBox<Vec3r> bbox = _ModelRootNode->bbox();
+ Vec3r u = bbox.getMin();
+ Vec3r v = bbox.getMax();
+ Vec3r cameraCenter(UNPACK3(g_freestyle.viewpoint));
+
+ Vec3r w1(u[0], u[1], u[2]);
+ Vec3r w2(v[0], u[1], u[2]);
+ Vec3r w3(u[0], v[1], u[2]);
+ Vec3r w4(v[0], v[1], u[2]);
+ Vec3r w5(u[0], u[1], v[2]);
+ Vec3r w6(v[0], u[1], v[2]);
+ Vec3r w7(u[0], v[1], v[2]);
+ Vec3r w8(v[0], v[1], v[2]);
+
+ real _zfar = std::max(
+ (w1 - cameraCenter).norm(),
+ std::max((w2 - cameraCenter).norm(),
+ std::max((w3 - cameraCenter).norm(),
+ std::max((w4 - cameraCenter).norm(),
+ std::max((w5 - cameraCenter).norm(),
+ std::max((w6 - cameraCenter).norm(),
+ std::max((w7 - cameraCenter).norm(),
+ (w8 - cameraCenter).norm())))))));
+
+ return _zfar;
}
real AppView::GetFocalLength()
{
- real Near = std::max(0.1, (real)(-2.0f * _maxAbs + distanceToSceneCenter()));
- return Near;
+ real Near = std::max(0.1, (real)(-2.0f * _maxAbs + distanceToSceneCenter()));
+ return Near;
}
} /* namespace Freestyle */