diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-18 02:55:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-18 02:55:28 +0400 |
commit | 7862b2fa13c0437d9c17eae78e7b79a421dacf05 (patch) | |
tree | 08f9c26af3e71795d0f65803a415b5612d6b53ab /source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp | |
parent | 69b95e1a8a00c9ff146d803b8ec11183d7a68908 (diff) |
style cleanup: compositor, pointer syntax, function brace placement, line length
Diffstat (limited to 'source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp index e262533b2f7..f64f0c054b1 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp @@ -24,7 +24,8 @@ #include "BLI_math.h" #include "DNA_camera_types.h" -ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation(): NodeOperation() { +ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->inputOperation = NULL; @@ -33,13 +34,14 @@ ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation(): NodeOperation() this->maxRadius = 32.0f; } -float ConvertDepthToRadiusOperation::determineFocalDistance() { +float ConvertDepthToRadiusOperation::determineFocalDistance() +{ if (cameraObject == NULL || cameraObject->type != OB_CAMERA) { return 10.0f; } else { - Camera *camera= (Camera*)this->cameraObject->data; + Camera *camera = (Camera*)this->cameraObject->data; cam_lens = camera->lens; if (camera->dof_ob) { /* too simple, better to return the distance on the view axis only @@ -56,10 +58,11 @@ float ConvertDepthToRadiusOperation::determineFocalDistance() { } } -void ConvertDepthToRadiusOperation::initExecution() { +void ConvertDepthToRadiusOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); float focalDistance = determineFocalDistance(); - if (focalDistance==0.0f) focalDistance = 1e10f; /* if the dof is 0.0 then set it be be far away */ + if (focalDistance == 0.0f) focalDistance = 1e10f; /* if the dof is 0.0 then set it be be far away */ inverseFocalDistance = 1.f/focalDistance; this->aspect = (this->getWidth() > this->getHeight()) ? (this->getHeight() / (float)this->getWidth()) : (this->getWidth() / (float)this->getHeight()); this->aperture = 0.5f*(this->cam_lens / (this->aspect*32.f)) / this->fStop; @@ -67,7 +70,8 @@ void ConvertDepthToRadiusOperation::initExecution() { this->dof_sp = (float)minsz / (16.f / cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov); } -void ConvertDepthToRadiusOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue[4]; float z; float radius; @@ -93,6 +97,7 @@ void ConvertDepthToRadiusOperation::executePixel(float* outputValue, float x, fl else outputValue[0] = 0.0f; } -void ConvertDepthToRadiusOperation::deinitExecution() { +void ConvertDepthToRadiusOperation::deinitExecution() +{ this->inputOperation = NULL; } |