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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2013-11-28 03:13:32 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2013-11-28 05:11:42 +0400
commit731ffd3cd4c1d578fb02d39dc512bace850c2e8b (patch)
tree63cced11229d028a2d8a7e5b6c9600e4e0fa6351 /intern/cycles/subd/subd_split.cpp
parentaf7a2a3b6a08bdbe99d295e593e770af165eb0e6 (diff)
Cycles: remove approximate subdivision surface with gregory patches code.
It was never fully implemented and will be replaced by OpenSubdiv. Only linear subdivision remains now. Also includes some refactoring in the split/dice code, adding a SubdParams struct to pass around parameters more easily.
Diffstat (limited to 'intern/cycles/subd/subd_split.cpp')
-rw-r--r--intern/cycles/subd/subd_split.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/intern/cycles/subd/subd_split.cpp b/intern/cycles/subd/subd_split.cpp
index 6c1486cecca..417ecfffd49 100644
--- a/intern/cycles/subd/subd_split.cpp
+++ b/intern/cycles/subd/subd_split.cpp
@@ -29,12 +29,9 @@ CCL_NAMESPACE_BEGIN
/* DiagSplit */
-DiagSplit::DiagSplit()
+DiagSplit::DiagSplit(const SubdParams& params_)
+: params(params_)
{
- test_steps = 3;
- split_threshold = 1;
- dicing_rate = 0.1f;
- camera = NULL;
}
void DiagSplit::dispatch(QuadDice::SubPatch& sub, QuadDice::EdgeFactors& ef)
@@ -54,8 +51,8 @@ float3 DiagSplit::project(Patch *patch, float2 uv)
float3 P;
patch->eval(&P, NULL, NULL, uv.x, uv.y);
- if(camera)
- P = transform_perspective(&camera->worldtoraster, P);
+ if(params.camera)
+ P = transform_perspective(&params.camera->worldtoraster, P);
return P;
}
@@ -66,8 +63,8 @@ int DiagSplit::T(Patch *patch, float2 Pstart, float2 Pend)
float Lsum = 0.0f;
float Lmax = 0.0f;
- for(int i = 0; i < test_steps; i++) {
- float t = i/(float)(test_steps-1);
+ for(int i = 0; i < params.test_steps; i++) {
+ float t = i/(float)(params.test_steps-1);
float3 P = project(patch, Pstart + t*(Pend - Pstart));
@@ -80,10 +77,10 @@ int DiagSplit::T(Patch *patch, float2 Pstart, float2 Pend)
Plast = P;
}
- int tmin = (int)ceil(Lsum/dicing_rate);
- int tmax = (int)ceil((test_steps-1)*Lmax/dicing_rate); // XXX paper says N instead of N-1, seems wrong?
+ int tmin = (int)ceil(Lsum/params.dicing_rate);
+ int tmax = (int)ceil((params.test_steps-1)*Lmax/params.dicing_rate); // XXX paper says N instead of N-1, seems wrong?
- if(tmax - tmin > split_threshold)
+ if(tmax - tmin > params.split_threshold)
return DSPLIT_NON_UNIFORM;
return tmax;
@@ -244,7 +241,7 @@ void DiagSplit::split(QuadDice::SubPatch& sub, QuadDice::EdgeFactors& ef, int de
dispatch(sub, ef);
}
-void DiagSplit::split_triangle(Mesh *mesh, Patch *patch, int shader, bool smooth)
+void DiagSplit::split_triangle(Patch *patch)
{
TriangleDice::SubPatch sub_split;
TriangleDice::EdgeFactors ef_split;
@@ -260,8 +257,7 @@ void DiagSplit::split_triangle(Mesh *mesh, Patch *patch, int shader, bool smooth
split(sub_split, ef_split);
- TriangleDice dice(mesh, shader, smooth, dicing_rate);
- dice.camera = camera;
+ TriangleDice dice(params);
for(size_t i = 0; i < subpatches_triangle.size(); i++) {
TriangleDice::SubPatch& sub = subpatches_triangle[i];
@@ -282,7 +278,7 @@ void DiagSplit::split_triangle(Mesh *mesh, Patch *patch, int shader, bool smooth
edgefactors_triangle.clear();
}
-void DiagSplit::split_quad(Mesh *mesh, Patch *patch, int shader, bool smooth)
+void DiagSplit::split_quad(Patch *patch)
{
QuadDice::SubPatch sub_split;
QuadDice::EdgeFactors ef_split;
@@ -300,8 +296,7 @@ void DiagSplit::split_quad(Mesh *mesh, Patch *patch, int shader, bool smooth)
split(sub_split, ef_split);
- QuadDice dice(mesh, shader, smooth, dicing_rate);
- dice.camera = camera;
+ QuadDice dice(params);
for(size_t i = 0; i < subpatches_quad.size(); i++) {
QuadDice::SubPatch& sub = subpatches_quad[i];