本文整理汇总了C++中bl::Object::mode方法的典型用法代码示例。如果您正苦于以下问题:C++ Object::mode方法的具体用法?C++ Object::mode怎么用?C++ Object::mode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bl::Object
的用法示例。
在下文中一共展示了Object::mode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sync_hair
OCT_NAMESPACE_BEGIN
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sync hair data
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void BlenderSync::sync_hair(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool motion, int time_index) {
if(!motion) {
mesh->hair_points.clear();
mesh->vert_per_hair.clear();
mesh->hair_thickness.clear();
mesh->hair_mat_indices.clear();
mesh->hair_uvs.clear();
}
if(b_ob.mode() == b_ob.mode_PARTICLE_EDIT) return;
fill_mesh_hair_data(mesh, &b_mesh, &b_ob);
} //sync_hair()
示例2: sync_curves
void BlenderSync::sync_curves(
Mesh *mesh, BL::Mesh &b_mesh, BL::Object &b_ob, bool motion, int motion_step)
{
if (!motion) {
/* Clear stored curve data */
mesh->curve_keys.clear();
mesh->curve_radius.clear();
mesh->curve_first_key.clear();
mesh->curve_shader.clear();
mesh->curve_attributes.clear();
}
/* obtain general settings */
const bool use_curves = scene->curve_system_manager->use_curves;
if (!(use_curves && b_ob.mode() != b_ob.mode_PARTICLE_EDIT && b_ob.mode() != b_ob.mode_EDIT)) {
if (!motion)
mesh->compute_bounds();
return;
}
const int primitive = scene->curve_system_manager->primitive;
const int triangle_method = scene->curve_system_manager->triangle_method;
const int resolution = scene->curve_system_manager->resolution;
const size_t vert_num = mesh->verts.size();
const size_t tri_num = mesh->num_triangles();
int used_res = 1;
/* extract particle hair data - should be combined with connecting to mesh later*/
ParticleCurveData CData;
ObtainCacheParticleData(mesh, &b_mesh, &b_ob, &CData, !preview);
/* add hair geometry to mesh */
if (primitive == CURVE_TRIANGLES) {
if (triangle_method == CURVE_CAMERA_TRIANGLES) {
/* obtain camera parameters */
float3 RotCam;
Camera *camera = scene->camera;
Transform &ctfm = camera->matrix;
if (camera->type == CAMERA_ORTHOGRAPHIC) {
RotCam = -make_float3(ctfm.x.z, ctfm.y.z, ctfm.z.z);
}
else {
Transform tfm = get_transform(b_ob.matrix_world());
Transform itfm = transform_quick_inverse(tfm);
RotCam = transform_point(&itfm, make_float3(ctfm.x.w, ctfm.y.w, ctfm.z.w));
}
bool is_ortho = camera->type == CAMERA_ORTHOGRAPHIC;
ExportCurveTrianglePlanes(mesh, &CData, RotCam, is_ortho);
}
else {
ExportCurveTriangleGeometry(mesh, &CData, resolution);
used_res = resolution;
}
}
else {
if (motion)
ExportCurveSegmentsMotion(mesh, &CData, motion_step);
else
ExportCurveSegments(scene, mesh, &CData);
}
/* generated coordinates from first key. we should ideally get this from
* blender to handle deforming objects */
if (!motion) {
if (mesh->need_attribute(scene, ATTR_STD_GENERATED)) {
float3 loc, size;
mesh_texture_space(b_mesh, loc, size);
if (primitive == CURVE_TRIANGLES) {
Attribute *attr_generated = mesh->attributes.add(ATTR_STD_GENERATED);
float3 *generated = attr_generated->data_float3();
for (size_t i = vert_num; i < mesh->verts.size(); i++)
generated[i] = mesh->verts[i] * size - loc;
}
else {
Attribute *attr_generated = mesh->curve_attributes.add(ATTR_STD_GENERATED);
float3 *generated = attr_generated->data_float3();
for (size_t i = 0; i < mesh->num_curves(); i++) {
float3 co = mesh->curve_keys[mesh->get_curve(i).first_key];
generated[i] = co * size - loc;
}
}
}
}
/* create vertex color attributes */
if (!motion) {
BL::Mesh::vertex_colors_iterator l;
int vcol_num = 0;
for (b_mesh.vertex_colors.begin(l); l != b_mesh.vertex_colors.end(); ++l, vcol_num++) {
if (!mesh->need_attribute(scene, ustring(l->name().c_str())))
continue;
ObtainCacheParticleVcol(mesh, &b_mesh, &b_ob, &CData, !preview, vcol_num);
//.........这里部分代码省略.........