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:
authorLukas Tönne <lukas.toenne@gmail.com>2014-01-22 17:32:21 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-01-22 17:37:40 +0400
commit9c883a1ecabe387533909b1e3116c2c30418f6e9 (patch)
treee3fb294597eb3575452e0624aad5536aec1d07ea /source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
parent418aafd503617c45c9199c1fb4616910557b6e92 (diff)
Fix T38011 and cleanup of Lens Distortion node code.
The area-of-interest calculation for that node didn't work reliably. It tries to estimate the distorted rectangular area based on min/max distortion and dispersion values, but this fails in some cases and leaves uninitialized buffer chunks. So now simply use the full input rect as the area, even though it may not be as efficient - at least it works ... Also cleaned up the code somewhat to make it understandable, using separate functions for common stuff instead of cryptic walls of math.
Diffstat (limited to 'source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h')
-rw-r--r--source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
index 2e2105c764d..c35bbdef4d0 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
@@ -32,16 +32,18 @@ private:
*/
SocketReader *m_inputProgram;
- NodeLensDist *m_data;
+ bool m_fit;
+ bool m_jitter;
float m_dispersion;
float m_distortion;
- bool m_valuesAvailable;
- float m_kr, m_kg, m_kb;
- float m_kr4, m_kg4, m_kb4;
+ bool m_dispersion_const;
+ bool m_distortion_const;
+ bool m_variables_ready;
+ float m_k[3];
+ float m_k4[3];
+ float m_dk4[3];
float m_maxk;
- float m_drg;
- float m_dgb;
float m_sc, m_cx, m_cy;
public:
ScreenLensDistortionOperation();
@@ -62,27 +64,25 @@ public:
*/
void deinitExecution();
- void setData(NodeLensDist *data) { this->m_data = data; }
+ void setFit(bool fit) { m_fit = fit; }
+ void setJitter(bool jitter) { m_jitter = jitter; }
+
+ /** Set constant distortion value */
+ void setDistortion(float distortion);
+ /** Set constant dispersion value */
+ void setDispersion(float dispersion);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
- /**
- * @brief Set the distortion and dispersion and precalc some values
- * @param distortion
- * @param dispersion
- */
- void setDistortionAndDispersion(float distortion, float dispersion) {
- this->m_distortion = distortion;
- this->m_dispersion = dispersion;
- updateVariables(distortion, dispersion);
- this->m_valuesAvailable = true;
- }
-
private:
void determineUV(float result[6], float x, float y) const;
- void determineUV(float result[6], float x, float y, float distortion, float dispersion);
- void updateDispersionAndDistortion();
void updateVariables(float distortion, float dispersion);
+ void get_uv(const float xy[2], float uv[2]) const;
+ void distort_uv(const float uv[2], float t, float xy[2]) const;
+ bool get_delta(float r_sq, float k4, const float uv[2], float delta[2]) const;
+ void accumulate(MemoryBuffer *buffer, int a, int b,
+ float r_sq, const float uv[2], const float delta[3][2],
+ float sum[4], int count[3]) const;
};
#endif