40 const size_t object_index,
46 const array<int> &mesh_shaders = mesh->get_shader();
47 const array<Node *> &mesh_used_shaders = mesh->get_used_shaders();
50 const int num_verts = mesh_verts.
size();
54 for (
int i = 0; i < num_triangles; i++) {
56 int shader_index = mesh_shaders[i];
57 Shader *shader = (shader_index < mesh_used_shaders.
size()) ?
58 static_cast<Shader *
>(mesh_used_shaders[shader_index]) :
65 for (
int j = 0; j < 3; j++) {
73 int object = object_index;
98 d_input_data[d_input_size++] = in;
110 const array<int> &mesh_shaders = mesh->get_shader();
111 const array<Node *> &mesh_used_shaders = mesh->get_used_shaders();
114 const int num_verts = mesh_verts.
size();
115 const int num_motion_steps = mesh->get_motion_steps();
118 const float *d_output_data = d_output.
data();
119 int d_output_index = 0;
123 for (
int i = 0; i < num_triangles; i++) {
125 int shader_index = mesh_shaders[i];
126 Shader *shader = (shader_index < mesh_used_shaders.
size()) ?
127 static_cast<Shader *
>(mesh_used_shaders[shader_index]) :
134 for (
int j = 0; j < 3; j++) {
138 d_output_data[d_output_index + 1],
139 d_output_data[d_output_index + 2]);
144 mesh_verts[t.
v[j]] += off;
145 if (attr_mP !=
NULL) {
146 for (
int step = 0; step < num_motion_steps - 1; step++) {
163 const size_t num_verts = mesh->verts.size();
166 if (num_triangles == 0) {
176 for (
size_t i = 0; i < scene->
objects.size(); i++) {
177 if (scene->
objects[i]->get_geometry() == mesh) {
195 unordered_set<int> stitch_keys;
196 for (pair<int, int> i : mesh->vert_to_stitching_key_map) {
197 stitch_keys.insert(i.second);
200 typedef unordered_multimap<int, int>::iterator map_it_t;
202 for (
int key : stitch_keys) {
203 pair<map_it_t, map_it_t>
verts = mesh->vert_stitching_map.equal_range(key);
209 int vert =
v->second;
211 pos += mesh->verts[vert];
222 mesh->verts[
v->second] =
pos;
233 bool need_recompute_vertex_normals =
false;
235 foreach (
Node *node, mesh->get_used_shaders()) {
238 need_recompute_vertex_normals =
true;
243 if (need_recompute_vertex_normals) {
247 for (
size_t i = 0; i < num_triangles; i++) {
248 int shader_index = mesh->shader[i];
249 Shader *shader = (shader_index < mesh->used_shaders.size()) ?
250 static_cast<Shader *
>(mesh->used_shaders[shader_index]) :
269 for (
size_t i = 0; i < num_triangles; i++) {
270 if (tri_has_true_disp[i]) {
271 for (
size_t j = 0; j < 3; j++) {
278 for (
size_t i = 0; i < num_triangles; i++) {
279 if (tri_has_true_disp[i]) {
280 for (
size_t j = 0; j < 3; j++) {
285 if (stitch_keys.size()) {
286 map_it_t key = mesh->vert_to_stitching_key_map.find(vert);
288 if (key != mesh->vert_to_stitching_key_map.end()) {
289 pair<map_it_t, map_it_t>
verts = mesh->vert_stitching_map.equal_range(key->second);
292 if (
v->second == vert) {
296 vN[
v->second] += fN[i];
307 for (
size_t i = 0; i < num_triangles; i++) {
308 if (tri_has_true_disp[i]) {
309 for (
size_t j = 0; j < 3; j++) {
318 vN[vert] = -vN[vert];
331 for (
int step = 0; step < mesh->motion_steps - 1; step++) {
338 for (
size_t i = 0; i < num_triangles; i++) {
339 if (tri_has_true_disp[i]) {
340 for (
size_t j = 0; j < 3; j++) {
347 for (
size_t i = 0; i < num_triangles; i++) {
348 if (tri_has_true_disp[i]) {
349 for (
size_t j = 0; j < 3; j++) {
355 if (stitch_keys.size()) {
356 map_it_t key = mesh->vert_to_stitching_key_map.find(vert);
358 if (key != mesh->vert_to_stitching_key_map.end()) {
359 pair<map_it_t, map_it_t>
verts = mesh->vert_stitching_map.equal_range(
363 if (
v->second == vert) {
378 for (
size_t i = 0; i < num_triangles; i++) {
379 if (tri_has_true_disp[i]) {
380 for (
size_t j = 0; j < 3; j++) {
389 mN[vert] = -mN[vert];
bool eval(const ShaderEvalType type, const int max_num_inputs, const int num_channels, const function< int(device_vector< KernelShaderEvalInput > &)> &fill_input, const function< void(device_vector< float > &)> &read_output)