forked from blender/blender
Export curves #46
@ -26,7 +26,7 @@ class Engine;
|
|||||||
|
|
||||||
class BlenderSceneDelegate : public pxr::HdSceneDelegate {
|
class BlenderSceneDelegate : public pxr::HdSceneDelegate {
|
||||||
friend ObjectData; /* has access to instances */
|
friend ObjectData; /* has access to instances */
|
||||||
friend CurvesData; /* has access to curves */
|
friend CurvesData; /* has access to materials */
|
||||||
friend MeshData; /* has access to materials */
|
friend MeshData; /* has access to materials */
|
||||||
friend MaterialData; /* has access to objects and instancers */
|
friend MaterialData; /* has access to objects and instancers */
|
||||||
|
|
||||||
|
@ -156,18 +156,16 @@ void CurvesData::write_curves(Curves *curves)
|
|||||||
vertices_.reserve(curves->geometry.curve_num);
|
vertices_.reserve(curves->geometry.curve_num);
|
||||||
|
|
||||||
for (int i = 0; i < curves->geometry.curve_num; i++) {
|
for (int i = 0; i < curves->geometry.curve_num; i++) {
|
||||||
const int first_point_index = *(curves->geometry.curve_offsets + i);
|
int first_point_index = *(curves->geometry.curve_offsets + i);
|
||||||
const int num_points = *(curves->geometry.curve_offsets + i + 1) - first_point_index;
|
int num_points = *(curves->geometry.curve_offsets + i + 1) - first_point_index;
|
||||||
curve_vertex_counts_.push_back(num_points);
|
curve_vertex_counts_.push_back(num_points);
|
||||||
|
|
||||||
/* Set radius similar to Cycles if isn't set */
|
/* Set radius similar to Cycles if isn't set */
|
||||||
float radius = radii ? radii[i] : 0.01f;
|
widths_.push_back(radii ? radii[i] : 0.01f);
|
||||||
widths_.push_back(radius);
|
|
||||||
|
|
||||||
for (int j = 0; j < num_points; j++) {
|
for (int j = 0; j < num_points; j++) {
|
||||||
const int index = first_point_index + j;
|
int ind = first_point_index + j;
|
||||||
vertices_.push_back(
|
vertices_.push_back(pxr::GfVec3f(positions[ind][0], positions[ind][1], positions[ind][2]));
|
||||||
pxr::GfVec3f(positions[index][0], positions[index][1], positions[index][2]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,9 +178,10 @@ void CurvesData::write_uv_maps(Curves *curves)
|
|||||||
|
|
||||||
const float(*uvs)[2] = (const float(*)[2])CustomData_get_layer_named(
|
const float(*uvs)[2] = (const float(*)[2])CustomData_get_layer_named(
|
||||||
&curves->geometry.curve_data, CD_PROP_FLOAT2, "surface_uv_coordinate");
|
&curves->geometry.curve_data, CD_PROP_FLOAT2, "surface_uv_coordinate");
|
||||||
|
if (uvs) {
|
||||||
for (int i = 0; i < curves->geometry.curve_num; i++) {
|
for (int i = 0; i < curves->geometry.curve_num; i++) {
|
||||||
uvs_.push_back(pxr::GfVec2f(uvs[i][0], uvs[i][1]));
|
uvs_.push_back(pxr::GfVec2f(uvs[i][0], uvs[i][1]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class CurvesData : public ObjectData {
|
|||||||
pxr::VtIntArray curve_vertex_counts_;
|
pxr::VtIntArray curve_vertex_counts_;
|
||||||
pxr::VtVec3fArray vertices_;
|
pxr::VtVec3fArray vertices_;
|
||||||
pxr::VtVec2fArray uvs_;
|
pxr::VtVec2fArray uvs_;
|
||||||
pxr::VtFloatArray width_;
|
pxr::VtFloatArray widths_;
|
||||||
|
|
||||||
MaterialData *mat_data_ = nullptr;
|
MaterialData *mat_data_ = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -65,10 +65,6 @@ void MaterialData::update()
|
|||||||
if (m_data) {
|
if (m_data) {
|
||||||
m_data->update_double_sided(this);
|
m_data->update_double_sided(this);
|
||||||
}
|
}
|
||||||
CurvesData *c_data = dynamic_cast<CurvesData *>(it.second.get());
|
|
||||||
if (c_data) {
|
|
||||||
c_data->update_double_sided(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (auto &it : scene_delegate_->instancers_) {
|
for (auto &it : scene_delegate_->instancers_) {
|
||||||
it.second->update_double_sided(this);
|
it.second->update_double_sided(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user