almost finished with copy safe q variables

git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@403 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
w1z7ard
2007-09-05 04:28:16 +00:00
parent c2ca5f15d6
commit e810879d5f
7 changed files with 114 additions and 9 deletions

View File

@ -169,6 +169,7 @@ CustomShape::CustomShape ( int id ) : imageUrl("")
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "t1", P_FLAG_TVAR, &this->t1, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
@ -210,6 +211,47 @@ CustomShape::CustomShape ( int id ) : imageUrl("")
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q1", P_FLAG_QVAR, &this->q1, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q2", P_FLAG_QVAR, &this->q2, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q3", P_FLAG_QVAR, &this->q3, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q4", P_FLAG_QVAR, &this->q4, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q5", P_FLAG_QVAR, &this->q5, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q6", P_FLAG_QVAR, &this->q6, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q7", P_FLAG_QVAR, &this->q7, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q8", P_FLAG_QVAR, &this->q8, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_string ( "imageurl", P_FLAG_NONE, &this->imageUrl);
if ( ParamUtils::insert ( param, &this->text_properties_tree ) < 0 )
{
@ -235,7 +277,6 @@ void CustomShape::loadUnspecInitConds()
// NOTE: This is verified to be same behavior as trunk
InitCondUtils::LoadUnspecInitCond fun ( this->init_cond_tree, this->per_frame_init_eqn_tree );
traverse ( param_tree, fun );
}

View File

@ -87,6 +87,15 @@ public:
float t7;
float t8;
/* stupider q variables */
float q1;
float q2;
float q3;
float q4;
float q5;
float q6;
float q7;
float q8;
// projectM exclusive parameter to load textures over a shape
std::string imageUrl;

View File

@ -426,6 +426,47 @@ CustomWave::CustomWave(int _id):
abort();
}
param = Param::new_param_float ( "q1", P_FLAG_QVAR, &this->q1, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q2", P_FLAG_QVAR, &this->q2, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q3", P_FLAG_QVAR, &this->q3, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q4", P_FLAG_QVAR, &this->q4, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q5", P_FLAG_QVAR, &this->q5, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q6", P_FLAG_QVAR, &this->q6, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q7", P_FLAG_QVAR, &this->q7, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
param = Param::new_param_float ( "q8", P_FLAG_QVAR, &this->q8, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0 );
if ( ParamUtils::insert ( param, &this->param_tree ) < 0 )
{
DWRITE ( "%s\n", "failed to insert param!" );
}
/* End of parameter loading. Note that the read only parameters associated
with custom waves (ie, sample) are variables stored in PresetFrameIO.hpp,
and not specific to the custom wave datastructure. */

View File

@ -107,6 +107,18 @@ public:
float t6;
float t7;
float t8;
/* stupider q variables */
float q1;
float q2;
float q3;
float q4;
float q5;
float q6;
float q7;
float q8;
float v1,v2;
/* Data structures to hold per frame and per point equations */

View File

@ -30,12 +30,12 @@ inline void LoadUnspecInitCond::operator() (Param * param) {
/* Don't count these parameters as initial conditions */
if (param->flags & P_FLAG_READONLY)
return;
if (param->flags & P_FLAG_QVAR)
return;
if (param->flags & P_FLAG_TVAR)
return;
if (param->flags & P_FLAG_USERDEF)
return;
// if (param->flags & P_FLAG_QVAR)
// return;
// if (param->flags & P_FLAG_TVAR)
// return;
// if (param->flags & P_FLAG_USERDEF)
// return;
/* If initial condition was not defined by the preset file, force a default one
with the following code */

View File

@ -2162,7 +2162,7 @@ int Parser::parse_shape_per_frame_init_eqn(std::istream & fs, CustomShape * cus
return PROJECTM_SUCCESS;
}
int Parser::parse_shape_per_frame_eqn(std::istream & fs, CustomShape * custom_shape, Preset * preset) {
int Parser::parse_shape_per_frame_eqn(std::istream & fs, CustomShape * custom_shape, Preset * preset) {
Param * param;
GenExpr * gen_expr;
@ -2187,7 +2187,7 @@ if (PARSE_DEBUG) printf("parse_shape (per_frame): [start] (custom shape id = %d)
/* Make sure parameter is writable */
if (param->flags & P_FLAG_READONLY) {
if (PARSE_DEBUG) printf("parse_shape (per_frame): parameter %s is marked as read only (LINE %d)\n", param->name.c_str(), line_count);
return PROJECTM_FAILURE;
return PROJECTM_PARSE_ERROR;
}
/* Parse right side of equation as an expression */

View File

@ -223,6 +223,7 @@ void Preset::evalCustomShapePerFrameEquations()
assert(_pos->second);
_pos->second->evaluate();
}
std::map<int, PerFrameEqn*> & per_frame_eqn_tree = (*pos)->per_frame_eqn_tree;
for (std::map<int, PerFrameEqn*>::iterator _pos = per_frame_eqn_tree.begin(); _pos != per_frame_eqn_tree.end(); ++_pos)
{
@ -339,6 +340,7 @@ void Preset::loadBuiltinParamsUnspecInitConds() {
InitCondUtils::LoadUnspecInitCond loadUnspecInitCond(this->init_cond_tree, this->per_frame_init_eqn_tree);
this->builtinParams.traverse(loadUnspecInitCond);
Algorithms::traverse(user_param_tree, loadUnspecInitCond);
}