Change subdiv from global to cut face, this makes the final result far much better

master
Jeremy Hu 2018-04-16 08:58:04 +08:00
parent e9d0696be6
commit a201d09535
7 changed files with 7 additions and 1 deletions

View File

@ -121,7 +121,10 @@ void MeshGenerator::process()
bool isDisabled = isTrueValueString(disabledString); bool isDisabled = isTrueValueString(disabledString);
if (isDisabled) if (isDisabled)
continue; continue;
bool subdived = isTrueValueString(valueOfKeyInMapOrEmpty(part->second, "subdived"));
int bmeshId = meshlite_bmesh_create(meshliteContext); int bmeshId = meshlite_bmesh_create(meshliteContext);
if (subdived)
meshlite_bmesh_set_cut_subdiv_count(meshliteContext, bmeshId, 1);
if (MeshGenerator::enableDebug) if (MeshGenerator::enableDebug)
meshlite_bmesh_enable_debug(meshliteContext, bmeshId, 1); meshlite_bmesh_enable_debug(meshliteContext, bmeshId, 1);
partBmeshMap[partIdIt] = bmeshId; partBmeshMap[partIdIt] = bmeshId;
@ -220,7 +223,8 @@ void MeshGenerator::process()
zMirroredMeshId = meshlite_mirror_in_z(meshliteContext, meshId, 0); zMirroredMeshId = meshlite_mirror_in_z(meshliteContext, meshId, 0);
} }
} }
bool subdived = isTrueValueString(valueOfKeyInMapOrEmpty(part->second, "subdived")); //bool subdived = isTrueValueString(valueOfKeyInMapOrEmpty(part->second, "subdived"));
bool subdived = false;
if (m_requirePartPreviewMap.find(partIdIt) != m_requirePartPreviewMap.end()) { if (m_requirePartPreviewMap.find(partIdIt) != m_requirePartPreviewMap.end()) {
ModelOfflineRender *render = m_partPreviewRenderMap[partIdIt]; ModelOfflineRender *render = m_partPreviewRenderMap[partIdIt];
int trimedMeshId = meshlite_trim(meshliteContext, meshId, 1); int trimedMeshId = meshlite_trim(meshliteContext, meshId, 1);

View File

@ -32,6 +32,7 @@ int meshlite_get_halfedge_index_array(void *context, int mesh_id, int *buffer, i
int meshlite_get_halfedge_normal_array(void *context, int mesh_id, float *buffer, int max_buffer_len); int meshlite_get_halfedge_normal_array(void *context, int mesh_id, float *buffer, int max_buffer_len);
int meshlite_build(void *context, float *vertex_position_buffer, int vertex_count, int *face_index_buffer, int face_index_buffer_len); int meshlite_build(void *context, float *vertex_position_buffer, int vertex_count, int *face_index_buffer, int face_index_buffer_len);
int meshlite_bmesh_create(void *context); int meshlite_bmesh_create(void *context);
int meshlite_bmesh_set_cut_subdiv_count(void *context, int bmesh_id, int subdiv_count);
int meshlite_bmesh_enable_debug(void *context, int bmesh_id, int enable); int meshlite_bmesh_enable_debug(void *context, int bmesh_id, int enable);
int meshlite_bmesh_add_node(void *context, int bmesh_id, float x, float y, float z, float radius); int meshlite_bmesh_add_node(void *context, int bmesh_id, float x, float y, float z, float radius);
int meshlite_bmesh_add_edge(void *context, int bmesh_id, int first_node_id, int second_node_id); int meshlite_bmesh_add_edge(void *context, int bmesh_id, int first_node_id, int second_node_id);

View File

@ -32,6 +32,7 @@ int meshlite_get_halfedge_index_array(void *context, int mesh_id, int *buffer, i
int meshlite_get_halfedge_normal_array(void *context, int mesh_id, float *buffer, int max_buffer_len); int meshlite_get_halfedge_normal_array(void *context, int mesh_id, float *buffer, int max_buffer_len);
int meshlite_build(void *context, float *vertex_position_buffer, int vertex_count, int *face_index_buffer, int face_index_buffer_len); int meshlite_build(void *context, float *vertex_position_buffer, int vertex_count, int *face_index_buffer, int face_index_buffer_len);
int meshlite_bmesh_create(void *context); int meshlite_bmesh_create(void *context);
int meshlite_bmesh_set_cut_subdiv_count(void *context, int bmesh_id, int subdiv_count);
int meshlite_bmesh_enable_debug(void *context, int bmesh_id, int enable); int meshlite_bmesh_enable_debug(void *context, int bmesh_id, int enable);
int meshlite_bmesh_add_node(void *context, int bmesh_id, float x, float y, float z, float radius); int meshlite_bmesh_add_node(void *context, int bmesh_id, float x, float y, float z, float radius);
int meshlite_bmesh_add_edge(void *context, int bmesh_id, int first_node_id, int second_node_id); int meshlite_bmesh_add_edge(void *context, int bmesh_id, int first_node_id, int second_node_id);