Skip to content

Commit

Permalink
support per-control point width in temporary curve file format.
Browse files Browse the repository at this point in the history
  • Loading branch information
dictoon committed Jul 29, 2014
1 parent 5d52e19 commit 90dc71a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/appleseed/renderer/modeling/object/curveobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ struct CurveObject::Impl

void load_curve_file(const char* filepath)
{
const double CurveWidth = 0.009;

ifstream input;
input.open(filepath);

Expand All @@ -185,32 +183,40 @@ struct CurveObject::Impl
size_t control_point_count;
input >> control_point_count;

if (control_point_count != 4)
{
RENDERER_LOG_ERROR(
"while loading curve file %s: only curves with 4 control points are currently supported.",
filepath);
return;
}

vector<Vector3d> points(control_point_count);
vector<double> widths(control_point_count);

m_curves.reserve(curve_count);

for (size_t c = 0; c < curve_count; ++c)
{
for (size_t p = 0; p < control_point_count; ++p)
{
Vector3d point;
input >> point.x >> point.y >> point.z;
points[p] = point;
input >> points[p].x >> points[p].y >> points[p].z;
input >> widths[p];
}

const BezierCurve3d curve(&points[0], CurveWidth);
const BezierCurve3d curve(&points[0], &widths[0]);
m_curves.push_back(curve);
}

input.close();

stopwatch.measure();

RENDERER_LOG_INFO(
"loaded curve file %s (%s curves) in %s.",
filepath,
pretty_uint(curve_count).c_str(),
pretty_time(stopwatch.get_seconds()).c_str());

input.close();
}
else
{
Expand Down

0 comments on commit 90dc71a

Please sign in to comment.