[Bf-blender-cvs] [a52d9b4bac2] functions: actually deform something
Jacques Lucke
noreply at git.blender.org
Sun Feb 10 20:25:16 CET 2019
Commit: a52d9b4bac2871dd9423313f889d1785042fc2a3
Author: Jacques Lucke
Date: Wed Jan 23 17:10:17 2019 +0100
Branches: functions
https://developer.blender.org/rBa52d9b4bac2871dd9423313f889d1785042fc2a3
actually deform something
===================================================================
M source/blender/functions/FN_functions.h
M source/blender/functions/intern/c_wrapper.cpp
M source/blender/modifiers/intern/MOD_functiondeform.c
===================================================================
diff --git a/source/blender/functions/FN_functions.h b/source/blender/functions/FN_functions.h
index 1a6b708e90d..603f26a4548 100644
--- a/source/blender/functions/FN_functions.h
+++ b/source/blender/functions/FN_functions.h
@@ -63,7 +63,7 @@ FnTypeRef FN_type_get_int32(void);
FnTypeRef FN_type_get_float_vector_3d(void);
FunctionRef FN_get_add_const_function(int value);
-FunctionRef FN_get_deform_function();
+FunctionRef FN_get_deform_function(void);
#ifdef __cplusplus
}
diff --git a/source/blender/functions/intern/c_wrapper.cpp b/source/blender/functions/intern/c_wrapper.cpp
index 5d11316e1bf..d7703c13b11 100644
--- a/source/blender/functions/intern/c_wrapper.cpp
+++ b/source/blender/functions/intern/c_wrapper.cpp
@@ -97,7 +97,7 @@ public:
float result[3];
result[0] = vec[0] * control;
- result[1] = vec[1] + std::sin(control);
+ result[1] = vec[1];
result[2] = vec[2];
fn_out.set(0, result);
diff --git a/source/blender/modifiers/intern/MOD_functiondeform.c b/source/blender/modifiers/intern/MOD_functiondeform.c
index ed0be4b69ab..a62f2ec2ed3 100644
--- a/source/blender/modifiers/intern/MOD_functiondeform.c
+++ b/source/blender/modifiers/intern/MOD_functiondeform.c
@@ -50,28 +50,29 @@
static void deformVerts(
ModifierData *md,
- const ModifierEvalContext *ctx,
+ const ModifierEvalContext *UNUSED(ctx),
Mesh *UNUSED(mesh),
float (*vertexCos)[3],
int numVerts)
{
+ FunctionDeformModifierData *fdmd = (FunctionDeformModifierData *)md;
+
FunctionRef fn = FN_get_deform_function();
FnInputsRef fn_in = FN_inputs_new(fn);
FnOutputsRef fn_out = FN_outputs_new(fn);
- float input[3] = {1, 2, 3};
- float control = 10;
- FN_inputs_set_index(fn_in, 0, input);
- FN_inputs_set_index(fn_in, 1, &control);
-
- FN_function_call(fn, fn_in, fn_out);
+ FN_inputs_set_index(fn_in, 1, &fdmd->control1);
- float result[3];
- FN_outputs_get_index(fn_out, 0, result);
+ clock_t start = clock();
- printf("Result: %f %f %f\n", result[0], result[1], result[2]);
+ for (int i = 0; i < numVerts; i++) {
+ FN_inputs_set_index(fn_in, 0, vertexCos + i);
+ FN_function_call(fn, fn_in, fn_out);
+ FN_outputs_get_index(fn_out, 0, vertexCos + i);
+ }
- printf("Finished\n");
+ clock_t end = clock();
+ printf("Time taken: %f s\n", (float)(end - start) / (float)CLOCKS_PER_SEC);
}
More information about the Bf-blender-cvs
mailing list