mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-06-30 21:36:33 -04:00
--User changes
-Add new Blur Cuve field which controls how blurring increases when moving from the center out. --Bug fixes -Undo Y axis flipping from previous commit, it never worked and is not worth the effort. --Code changes -The new field is a member of Ember and is called m_BlurCurve, and the corresponding xml field is called "blur_curve".
This commit is contained in:
@ -205,6 +205,7 @@ struct ALIGN EmberCL
|
||||
T m_CamPerspective;
|
||||
T m_CamYaw;
|
||||
T m_CamPitch;
|
||||
T m_BlurCurve;
|
||||
T m_CamDepthBlur;
|
||||
T m_BlurCoef;
|
||||
m3T m_CamMat;
|
||||
@ -225,6 +226,7 @@ static const char* EmberCLStructString =
|
||||
" real_t m_CamPerspective;\n"
|
||||
" real_t m_CamYaw;\n"
|
||||
" real_t m_CamPitch;\n"
|
||||
" real_t m_BlurCurve;\n"
|
||||
" real_t m_CamDepthBlur;\n"
|
||||
" real_t m_BlurCoef;\n"
|
||||
" real_t m_C00;\n"
|
||||
@ -254,6 +256,7 @@ struct ALIGN CarToRasCL
|
||||
uint m_RasWidth;
|
||||
T m_PixPerImageUnitH, m_RasLlY;
|
||||
T m_CarLlX, m_CarUrX, m_CarUrY, m_CarLlY;
|
||||
T m_CarHalfX, m_CarHalfY, m_CarCenterX, m_CarCenterY;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -266,6 +269,7 @@ static const char* CarToRasCLStructString =
|
||||
" uint m_RasWidth;\n"
|
||||
" real_t m_PixPerImageUnitH, m_RasLlY;\n"
|
||||
" real_t m_CarLlX, m_CarUrX, m_CarUrY, m_CarLlY;\n"
|
||||
" real_t m_CarHalfX, m_CarHalfY, m_CarCenterX, m_CarCenterY;\n"
|
||||
"} CarToRasCL;\n"
|
||||
"\n";
|
||||
|
||||
|
@ -940,7 +940,11 @@ string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember)
|
||||
" z = fma(ember->m_C02, secondPoint.m_X, fma(ember->m_C12, secondPoint.m_Y, ember->m_C22 * z));\n"
|
||||
"\n"
|
||||
" real_t zr = Zeps(1 - ember->m_CamPerspective * z);\n"
|
||||
" real_t dr = MwcNext01(&mwc) * ember->m_BlurCoef * z;\n"
|
||||
" real_t prcx = (x - carToRas->m_CarCenterX) / carToRas->m_CarHalfX;\n"
|
||||
" real_t prcy = (y - carToRas->m_CarCenterY) / carToRas->m_CarHalfY;\n"
|
||||
" real_t dist = sqrt(SQR(prcx) + SQR(prcy)) * (real_t)(10.0);\n"
|
||||
" real_t scale = ember->m_BlurCurve ? min((real_t)(1.0), (dist * dist) / (4 * ember->m_BlurCurve)) : (real_t)(1.0);\n"
|
||||
" real_t dr = MwcNext01(&mwc) * (ember->m_BlurCoef * scale) * z;\n"
|
||||
"\n"
|
||||
" dsin = sin(t);\n"
|
||||
" dcos = cos(t);\n"
|
||||
@ -964,7 +968,11 @@ string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember)
|
||||
" dsin = sin(t);\n"
|
||||
" dcos = cos(t);\n"
|
||||
"\n"
|
||||
" real_t dr = MwcNext01(&mwc) * ember->m_BlurCoef * z;\n"
|
||||
" real_t prcx = (secondPoint.m_X - carToRas->m_CarCenterX) / carToRas->m_CarHalfX;\n"
|
||||
" real_t prcy = (y - carToRas->m_CarCenterY) / carToRas->m_CarHalfY;\n"
|
||||
" real_t dist = sqrt(SQR(prcx) + SQR(prcy)) * (real_t)(10.0);\n"
|
||||
" real_t scale = ember->m_BlurCurve ? min((real_t)(1.0), (dist * dist) / (4 * ember->m_BlurCurve)) : (real_t)(1.0);\n"
|
||||
" real_t dr = MwcNext01(&mwc) * (ember->m_BlurCoef * scale) * z;\n"
|
||||
"\n"
|
||||
" secondPoint.m_X = fma(dr, dcos, secondPoint.m_X) / zr;\n"
|
||||
" secondPoint.m_Y = fma(dr, dsin, y) / zr;\n"
|
||||
|
@ -1778,6 +1778,7 @@ void RendererCL<T, bucketT>::ConvertEmber(Ember<T>& ember, EmberCL<T>& emberCL,
|
||||
emberCL.m_CamPerspective = ember.m_CamPerspective;
|
||||
emberCL.m_CamYaw = ember.m_CamYaw;
|
||||
emberCL.m_CamPitch = ember.m_CamPitch;
|
||||
emberCL.m_BlurCurve = ember.m_BlurCurve;
|
||||
emberCL.m_CamDepthBlur = ember.m_CamDepthBlur;
|
||||
emberCL.m_BlurCoef = ember.BlurCoef();
|
||||
emberCL.m_CamMat = ember.m_CamMat;
|
||||
@ -1829,6 +1830,10 @@ void RendererCL<T, bucketT>::ConvertCarToRas(const CarToRas<T>& carToRas)
|
||||
m_CarToRasCL.m_CarLlY = carToRas.CarLlY();
|
||||
m_CarToRasCL.m_CarUrX = carToRas.CarUrX();
|
||||
m_CarToRasCL.m_CarUrY = carToRas.CarUrY();
|
||||
m_CarToRasCL.m_CarHalfX = carToRas.CarHalfX();
|
||||
m_CarToRasCL.m_CarHalfY = carToRas.CarHalfY();
|
||||
m_CarToRasCL.m_CarCenterX = carToRas.CarCenterX();
|
||||
m_CarToRasCL.m_CarCenterY = carToRas.CarCenterY();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user