Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/mesh.cpp
| Show First 20 Lines • Show All 658 Lines • ▼ Show 20 Lines | void Mesh::add_undisplaced() | ||||
| /* don't compute if already there */ | /* don't compute if already there */ | ||||
| if (attrs.find(ATTR_STD_POSITION_UNDISPLACED)) { | if (attrs.find(ATTR_STD_POSITION_UNDISPLACED)) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* get attribute */ | /* get attribute */ | ||||
| Attribute *attr = attrs.add(ATTR_STD_POSITION_UNDISPLACED); | Attribute *attr = attrs.add(ATTR_STD_POSITION_UNDISPLACED); | ||||
| attr->flags |= ATTR_SUBDIVIDED; | attr->get_flags() |= ATTR_SUBDIVIDED; | ||||
| float3 *data = attr->data_float3(); | float3 *data = attr->data_float3(); | ||||
| /* copy verts */ | /* copy verts */ | ||||
| size_t size = attr->buffer_size(this, ATTR_PRIM_GEOMETRY); | size_t size = attr->buffer_size(this, ATTR_PRIM_GEOMETRY); | ||||
| /* Center points for ngons aren't stored in Mesh::verts but are included in size since they will | /* Center points for ngons aren't stored in Mesh::verts but are included in size since they will | ||||
| * be calculated later, we subtract them from size here so we don't have an overflow while | * be calculated later, we subtract them from size here so we don't have an overflow while | ||||
| Show All 16 Lines | void Mesh::pack_shaders(Scene *scene, uint *tri_shader) | ||||
| int *shader_ptr = shader.data(); | int *shader_ptr = shader.data(); | ||||
| for (size_t i = 0; i < triangles_size; i++) { | for (size_t i = 0; i < triangles_size; i++) { | ||||
| if (shader_ptr[i] != last_shader || last_smooth != smooth[i]) { | if (shader_ptr[i] != last_shader || last_smooth != smooth[i]) { | ||||
| last_shader = shader_ptr[i]; | last_shader = shader_ptr[i]; | ||||
| last_smooth = smooth[i]; | last_smooth = smooth[i]; | ||||
| Shader *shader = (last_shader < used_shaders.size()) ? | Shader *shader = (last_shader < used_shaders.size()) ? | ||||
| static_cast<Shader *>(used_shaders[last_shader]) : | static_cast<Shader *>(used_shaders[last_shader]) : | ||||
| scene->default_surface; | scene->get_default_surface(); | ||||
| shader_id = scene->shader_manager->get_shader_id(shader, last_smooth); | shader_id = scene->get_shader_manager()->get_shader_id(shader, last_smooth); | ||||
| } | } | ||||
| tri_shader[i] = shader_id; | tri_shader[i] = shader_id; | ||||
| } | } | ||||
| } | } | ||||
| void Mesh::pack_normals(float4 *vnormal) | void Mesh::pack_normals(float4 *vnormal) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines | |||||