Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorover0219 <over0219@umn.edu>2020-06-10 22:46:02 +0300
committerover0219 <over0219@umn.edu>2020-06-10 22:46:02 +0300
commit2ace45220db036c448c223286926e1526165fc5d (patch)
treed12a297087cddbc846cb1feeaa3ec545b308f0e3 /intern
parent5df366870579a86edf975f97f4afa197d4071d47 (diff)
cache working but lots of copies
Diffstat (limited to 'intern')
-rw-r--r--intern/softbody/admmpd_api.cpp18
-rw-r--r--intern/softbody/admmpd_api.h18
2 files changed, 20 insertions, 16 deletions
diff --git a/intern/softbody/admmpd_api.cpp b/intern/softbody/admmpd_api.cpp
index 21e21c4cb9d..915b20b299a 100644
--- a/intern/softbody/admmpd_api.cpp
+++ b/intern/softbody/admmpd_api.cpp
@@ -84,11 +84,12 @@ void admmpd_dealloc(ADMMPDInterfaceData *iface)
delete iface->data;
}
- iface->data = NULL;
iface->in_verts = NULL;
iface->in_vel = NULL;
iface->in_faces = NULL;
iface->out_verts = NULL;
+ iface->out_vel = NULL;
+ iface->data = NULL;
}
int admmpd_init(ADMMPDInterfaceData *iface)
@@ -180,6 +181,19 @@ void admmpd_solve(ADMMPDInterfaceData *iface)
if (iface == NULL)
return;
+ // Whatever is in out_verts and out_vel needs
+ // to be mapped to internal data, as it's used as input
+ // when reading from cached data.
+ int nv = iface->out_totverts;
+ for (int i=0; i<nv; ++i)
+ {
+ for (int j=0; j<3; ++j)
+ {
+ iface->data->data->x(i,j) = iface->out_verts[i*3+j];
+ iface->data->data->v(i,j) = iface->out_vel[i*3+j];
+ }
+ }
+
try
{
admmpd::Solver().solve(iface->data->options,iface->data->data);
@@ -198,7 +212,7 @@ void admmpd_solve(ADMMPDInterfaceData *iface)
}
}
-void admmpd_map_vertices(ADMMPDInterfaceData *iface, float (*vertexCos)[3], int numVerts)
+void admmpd_get_vertices(ADMMPDInterfaceData *iface, float (*vertexCos)[3], int numVerts)
{
if (iface == NULL)
return;
diff --git a/intern/softbody/admmpd_api.h b/intern/softbody/admmpd_api.h
index bcfe37403c0..3ee43cd5948 100644
--- a/intern/softbody/admmpd_api.h
+++ b/intern/softbody/admmpd_api.h
@@ -21,15 +21,13 @@
* \ingroup admmpd
*/
-#ifndef __ADMMPD_API_H__
-#define __ADMMPD_API_H__
+#ifndef ADMMPD_API_H
+#define ADMMPD_API_H
#ifdef __cplusplus
extern "C" {
#endif
-//typedef struct Mesh Mesh_;
-
typedef struct ADMMPDInterfaceData {
float *in_verts;
float *in_vel;
@@ -51,18 +49,10 @@ void admmpd_dealloc(ADMMPDInterfaceData*);
int admmpd_init(ADMMPDInterfaceData*);
int admmpd_cache_valid(ADMMPDInterfaceData*, int numVerts);
void admmpd_solve(ADMMPDInterfaceData*);
-void admmpd_map_vertices(ADMMPDInterfaceData*, float (*vertexCos)[3], int numVerts);
-
-//void admmpd_solve(ADMMPDInterfaceData*);
-
-// Copies the results of the solve (pos, vel) into BodyPoint
-//void admmpd_to_bodypoint(
-// ADMMPD_Data *data,
-// BodyPoint *bp,
-// int numVerts);
+void admmpd_get_vertices(ADMMPDInterfaceData*, float (*vertexCos)[3], int numVerts);
#ifdef __cplusplus
}
#endif
-#endif /* __ADMMPD_API_H__ */
+#endif // ADMMPD_API_H