Merge branch 'master' into blender2.8
This commit is contained in:
@@ -204,7 +204,7 @@ static void xml_read_camera(XMLReadState& state, xml_node node)
|
||||
cam->matrix = state.tfm;
|
||||
|
||||
cam->need_update = true;
|
||||
cam->update();
|
||||
cam->update(state.scene);
|
||||
}
|
||||
|
||||
/* Shader */
|
||||
@@ -515,7 +515,7 @@ static void xml_read_mesh(const XMLReadState& state, xml_node node)
|
||||
xml_read_float(&sdparams.dicing_rate, node, "dicing_rate");
|
||||
sdparams.dicing_rate = std::max(0.1f, sdparams.dicing_rate);
|
||||
|
||||
state.scene->camera->update();
|
||||
state.scene->camera->update(state.scene);
|
||||
sdparams.camera = state.scene->camera;
|
||||
sdparams.objecttoworld = state.tfm;
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ if(NOT CYCLES_STANDALONE_REPOSITORY)
|
||||
set(GLEW_INCLUDE_DIR "${GLEW_INCLUDE_PATH}")
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
|
||||
if(WITH_CYCLES_STANDALONE)
|
||||
set(CYCLES_APP_GLEW_LIBRARY ${BLENDER_GLEW_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
@@ -561,8 +561,9 @@ void Mesh::clear(bool preserve_voxel_data)
|
||||
subd_attributes.clear();
|
||||
attributes.clear(preserve_voxel_data);
|
||||
|
||||
used_shaders.clear();
|
||||
|
||||
if(!preserve_voxel_data) {
|
||||
used_shaders.clear();
|
||||
geometry_flags = GEOMETRY_NONE;
|
||||
}
|
||||
|
||||
|
@@ -393,9 +393,6 @@ void VolumeMeshBuilder::convert_quads_to_tris(const vector<QuadData> &quads,
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
/* For debugging: render the created mesh using the default diffuse shader. */
|
||||
//#define RENDER_DIFFUSE
|
||||
|
||||
struct VoxelAttributeGrid {
|
||||
float *data;
|
||||
int channels;
|
||||
@@ -443,6 +440,8 @@ void MeshManager::create_volume_mesh(Scene *scene,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Compute padding. */
|
||||
Shader *volume_shader = NULL;
|
||||
int pad_size = 0;
|
||||
|
||||
foreach(Shader *shader, mesh->used_shaders) {
|
||||
@@ -450,12 +449,20 @@ void MeshManager::create_volume_mesh(Scene *scene,
|
||||
continue;
|
||||
}
|
||||
|
||||
volume_shader = shader;
|
||||
|
||||
if(shader->volume_interpolation_method == VOLUME_INTERPOLATION_LINEAR) {
|
||||
pad_size = max(1, pad_size);
|
||||
}
|
||||
else if(shader->volume_interpolation_method == VOLUME_INTERPOLATION_CUBIC) {
|
||||
pad_size = max(2, pad_size);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if(!volume_shader) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Compute start point and cell size from transform. */
|
||||
@@ -477,6 +484,7 @@ void MeshManager::create_volume_mesh(Scene *scene,
|
||||
volume_params.cell_size = cell_size;
|
||||
volume_params.pad_size = pad_size;
|
||||
|
||||
/* Build bounding mesh around non-empty volume cells. */
|
||||
VolumeMeshBuilder builder(&volume_params);
|
||||
const float isovalue = mesh->volume_isovalue;
|
||||
|
||||
@@ -540,26 +548,22 @@ void MeshManager::create_volume_mesh(Scene *scene,
|
||||
}
|
||||
}
|
||||
|
||||
/* Create mesh. */
|
||||
vector<float3> vertices;
|
||||
vector<int> indices;
|
||||
vector<float3> face_normals;
|
||||
builder.create_mesh(vertices, indices, face_normals);
|
||||
|
||||
#ifdef RENDER_DIFFUSE
|
||||
int shader = mesh->used_shaders[0]->id;
|
||||
#else
|
||||
int shader = mesh->shader[0];
|
||||
#endif
|
||||
|
||||
mesh->clear(true);
|
||||
mesh->reserve_mesh(vertices.size(), indices.size()/3);
|
||||
mesh->used_shaders.push_back(volume_shader);
|
||||
|
||||
for(size_t i = 0; i < vertices.size(); ++i) {
|
||||
mesh->add_vertex(vertices[i]);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < indices.size(); i += 3) {
|
||||
mesh->add_triangle(indices[i], indices[i + 1], indices[i + 2], shader, false);
|
||||
mesh->add_triangle(indices[i], indices[i + 1], indices[i + 2], 0, false);
|
||||
}
|
||||
|
||||
Attribute *attr_fN = mesh->attributes.add(ATTR_STD_FACE_NORMAL);
|
||||
@@ -569,6 +573,7 @@ void MeshManager::create_volume_mesh(Scene *scene,
|
||||
fN[i] = face_normals[i];
|
||||
}
|
||||
|
||||
/* Print stats. */
|
||||
VLOG(1) << "Memory usage volume mesh: "
|
||||
<< ((vertices.size() + face_normals.size())*sizeof(float3) + indices.size()*sizeof(int))/(1024.0*1024.0)
|
||||
<< "Mb.";
|
||||
|
@@ -3489,17 +3489,25 @@ void DM_draw_attrib_vertex_uniforms(const DMVertexAttribs *attribs)
|
||||
{
|
||||
int i;
|
||||
if (attribs->totorco) {
|
||||
glUniform1i(attribs->orco.gl_info_index, 0);
|
||||
if (attribs->orco.gl_info_index != -1) {
|
||||
glUniform1i(attribs->orco.gl_info_index, 0);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < attribs->tottface; i++) {
|
||||
glUniform1i(attribs->tface[i].gl_info_index, 0);
|
||||
if (attribs->tface[i].gl_info_index != -1) {
|
||||
glUniform1i(attribs->tface[i].gl_info_index, 0);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < attribs->totmcol; i++) {
|
||||
glUniform1i(attribs->mcol[i].gl_info_index, GPU_ATTR_INFO_SRGB);
|
||||
if (attribs->mcol[i].gl_info_index != -1) {
|
||||
glUniform1i(attribs->mcol[i].gl_info_index, GPU_ATTR_INFO_SRGB);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < attribs->tottang; i++) {
|
||||
glUniform1i(attribs->tang[i].gl_info_index, 0);
|
||||
if (attribs->tang[i].gl_info_index != -1) {
|
||||
glUniform1i(attribs->tang[i].gl_info_index, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user