Skip to content

Commit

Permalink
alloc mesh as one memory block
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-matthewb committed May 20, 2018
1 parent 59ee738 commit 17942b7
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 252 deletions.
12 changes: 2 additions & 10 deletions src/libprojectM/MilkdropPresetFactory/Param.cpp
Expand Up @@ -65,26 +65,18 @@ Param::Param(std::string _name) :
matrix(0)
{

engine_val = new float();
engine_val = (float *)&local_value;

default_init_val.float_val = DEFAULT_DOUBLE_IV;
upper_bound.float_val = DEFAULT_DOUBLE_UB;
lower_bound.float_val = DEFAULT_DOUBLE_LB;

/// @note may have fixed a recent bug. testing
*((float*)engine_val) = default_init_val.float_val;


}
}

/* Free's a parameter type */
Param::~Param() {

// I hate this, but will let it be for now
if (flags & P_FLAG_USERDEF) {
delete((double*)engine_val);
}

if (PARAM_DEBUG) printf("~Param: freeing \"%s\".\n", name.c_str());
}

Expand Down
5 changes: 5 additions & 0 deletions src/libprojectM/MilkdropPresetFactory/Param.hpp
Expand Up @@ -58,6 +58,8 @@ class InitCond;
class Param;
class Preset;
//#include <map>
#include <immintrin.h>


/* Parameter Type */
class Param {
Expand All @@ -72,6 +74,9 @@ class Param {
CValue upper_bound; /* this parameter's upper bound */
CValue lower_bound; /* this parameter's lower bound */

// for a local variable, engine_val can point here
float local_value;

/// Create a new parameter
Param(std::string name, short int type, short int flags,
void * eqn_val, void *matrix,
Expand Down

0 comments on commit 17942b7

Please sign in to comment.