Skip to content

Commit

Permalink
Bug fix (#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
xelatihy authored Aug 19, 2020
1 parent 3f48a3a commit 76adcf1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
10 changes: 5 additions & 5 deletions apps/ysceneitrace/ysceneitrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,13 @@ void init_scene(trace_scene* scene, scene_model* ioscene, trace_camera*& camera,
shape_map[ioshape] = shape;
}

for (auto ioobject : ioscene->instances) {
for (auto ioinstance : ioscene->instances) {
if (progress_cb)
progress_cb("converting objects", progress.x++, progress.y);
progress_cb("converting instances", progress.x++, progress.y);
auto instance = add_instance(scene);
set_frame(instance, ioobject->frame);
set_shape(instance, shape_map.at(ioobject->shape));
set_material(instance, material_map.at(ioobject->material));
set_frame(instance, ioinstance->frame);
set_shape(instance, shape_map.at(ioinstance->shape));
set_material(instance, material_map.at(ioinstance->material));
}

for (auto ioenvironment : ioscene->environments) {
Expand Down
10 changes: 5 additions & 5 deletions apps/ysceneitraces/ysceneitraces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ void init_scene(trace_scene* scene, scene_model* ioscene, trace_camera*& camera,
shape_map[ioshape] = shape;
}

for (auto ioobject : ioscene->instances) {
for (auto ioinstance : ioscene->instances) {
if (progress_cb)
progress_cb("converting objects", progress.x++, progress.y);
progress_cb("converting instances", progress.x++, progress.y);
auto instance = add_instance(scene);
set_frame(instance, ioobject->frame);
set_shape(instance, shape_map.at(ioobject->shape));
set_material(instance, material_map.at(ioobject->material));
set_frame(instance, ioinstance->frame);
set_shape(instance, shape_map.at(ioinstance->shape));
set_material(instance, material_map.at(ioinstance->material));
}

for (auto ioenvironment : ioscene->environments) {
Expand Down
10 changes: 5 additions & 5 deletions apps/yscenetrace/yscenetrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ void init_scene(trace_scene* scene, scene_model* ioscene, trace_camera*& camera,
shape_map[ioshape] = shape;
}

for (auto ioobject : ioscene->instances) {
for (auto ioinstance : ioscene->instances) {
if (progress_cb)
progress_cb("converting objects", progress.x++, progress.y);
progress_cb("converting instances", progress.x++, progress.y);
auto instance = add_instance(scene);
set_frame(instance, ioobject->frame);
set_shape(instance, shape_map.at(ioobject->shape));
set_material(instance, material_map.at(ioobject->material));
set_frame(instance, ioinstance->frame);
set_shape(instance, shape_map.at(ioinstance->shape));
set_material(instance, material_map.at(ioinstance->material));
}

for (auto ioenvironment : ioscene->environments) {
Expand Down
8 changes: 5 additions & 3 deletions libs/yocto/yocto_modelio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,13 +868,15 @@ bool get_colors(ply_model* ply, vector<vec3f>& colors) {
}
bool get_colors(ply_model* ply, vector<vec4f>& colors) {
if (has_property(ply, "vertex", "alpha")) {
return get_values(ply, "vertex", {"red", "green", "blue", "alpha"}, colors);
} else {
auto colors3 = vector<vec3f>{};
return get_values(ply, "vertex", {"red", "green", "blue"}, colors3);
if (!get_values(ply, "vertex", {"red", "green", "blue"}, colors3))
return false;
colors.resize(colors3.size());
for (auto i = 0; i < colors.size(); i++)
colors[i] = {colors3[i].x, colors3[i].y, colors3[i].z, 1};
} else {
return get_values(ply, "vertex", {"red", "green", "blue", "alpha"}, colors);
return true;
}
}
bool get_radius(ply_model* ply, vector<float>& radius) {
Expand Down

0 comments on commit 76adcf1

Please sign in to comment.