various touch ups, minor bug fix.

git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/personal/carm/dev-1.0@291 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
psperl
2007-08-05 05:04:35 +00:00
parent e961872101
commit f7fee506c9
11 changed files with 546 additions and 495 deletions

View File

@ -80,6 +80,7 @@ extern FILE *fmemopen(void *buf, size_t len, const char *pMode);
#endif /** WIN32 */
inline void DWRITE( char *fmt, ... ) {
return;
va_list args;
va_start( args, fmt );
//#ifdef DEBUG

View File

@ -57,8 +57,7 @@ Param::Param( std::string _name, short int _type, short int _flags, void * _engi
/** @@FIX THIS */
/// @bug listen to above's advice!
/// @NOTE this is a hack, but will probably work fine
this->gx = projectM::currentEngine->presetInputs.gx;
this->gy = projectM::currentEngine->presetInputs.gy;
projectM::currentEngine->getCurrentMeshSize(this->gx, this->gy);
}
@ -78,12 +77,12 @@ Param::Param(std::string _name) :
upper_bound.float_val = DEFAULT_DOUBLE_UB;
lower_bound.float_val = DEFAULT_DOUBLE_LB;
/** @@FIX THIS */
/// @bug listen to above's advice!
/// @NOTE this is a hack, but will probably work fine
this->gx = projectM::currentEngine->presetInputs.gx;
this->gy = projectM::currentEngine->presetInputs.gy;
projectM::currentEngine->getCurrentMeshSize(this->gx, this->gy);
}
/* Free's a parameter type */

View File

@ -40,9 +40,18 @@ Preset::Preset(const std::string & filename, const PresetInputs & presetInputs,
builtinParams(presetInputs, presetOutputs),
customWaves(&presetOutputs.customWaves),
customShapes(&presetOutputs.customShapes),
m_presetOutputs(presetOutputs)
m_presetOutputs(presetOutputs) {
{
m_presetOutputs.zoom_is_mesh = false;
m_presetOutputs.zoomexp_is_mesh =false;
m_presetOutputs.rot_is_mesh =false;
m_presetOutputs.sx_is_mesh =false;
m_presetOutputs.sy_is_mesh = false;
m_presetOutputs.dx_is_mesh = false;
m_presetOutputs.dy_is_mesh =false;
m_presetOutputs.cx_is_mesh = false;
m_presetOutputs.cy_is_mesh = false;
initialize(filename);
@ -51,12 +60,7 @@ Preset::Preset(const std::string & filename, const PresetInputs & presetInputs,
Preset::~Preset()
{
#if defined(PRESET_DEBUG) && defined(DEBUG)
DWRITE( "~preset(): in\n" );
#endif
std::cout << "Preset destructor!" << std::endl;
Algorithms::traverse<Algorithms::TraverseFunctors::DeleteFunctor<InitCond> >(init_cond_tree);
@ -75,12 +79,6 @@ Preset::~Preset()
for (PresetOutputs::cshape_container::iterator pos = customShapes->begin(); pos != customShapes->end(); ++pos)
delete(pos->second);
#if defined(PRESET_DEBUG) && defined(DEBUG)
DWRITE( "~Preset(): out\n" );
#endif
}
/* Adds a per pixel equation according to its string name. This
will be used only by the parser */

View File

@ -5,6 +5,7 @@
#include <iostream>
PresetInputs::PresetInputs()
{
}
void PresetInputs::Initialize(int gx, int gy)
@ -23,8 +24,7 @@ void PresetInputs::Initialize(int gx, int gy)
this->y_mesh=(float **)wipemalloc(gx * sizeof(float *));
for(x = 0; x < gx; x++)
{
this->y_mesh[x] = (float *)wipemalloc(gy * sizeof(float));
this->y_mesh[x] = (float *)wipemalloc(gy * sizeof(float));
}
this->rad_mesh=(float **)wipemalloc(gx * sizeof(float *));
for(x = 0; x < gx; x++)
@ -79,6 +79,7 @@ PresetOutputs::PresetOutputs()
void PresetOutputs::Initialize(int gx, int gy)
{
int x;
this->sx_mesh=(float **)wipemalloc(gx * sizeof(float *));
for(x = 0; x < gx; x++)
@ -125,8 +126,8 @@ void PresetOutputs::Initialize(int gx, int gy)
{
this->rot_mesh[x] = (float *)wipemalloc(gy * sizeof(float));
}
zoom_is_mesh = false;
zoomexp_is_mesh =false;
zoom_is_mesh = false;
zoomexp_is_mesh =false;
rot_is_mesh =false;
sx_is_mesh =false;

View File

@ -103,7 +103,7 @@ Preset * PresetLoader::loadPreset(unsigned int index, const PresetInputs & prese
assert(index >= 0);
assert(index < m_entries.size());
// Return a new auto pointer to a present
// Return a new pointer to a present
return new Preset(m_entries[index], presetInputs, presetOutputs);
}
@ -119,7 +119,7 @@ void PresetLoader::handleDirectoryError()
case ENOMEM:
std::cerr << "[PresetLoader] out of memory! Are you running Windows?" << std::endl;
abort();
case ENOTDIR:
case ENOTDIR:
std::cerr << "[PresetLoader] directory specified is not a preset directory! Cannot continue." << std::endl;
break;
case ENFILE:

View File

@ -408,12 +408,13 @@ void Renderer::PerPixelMath(PresetOutputs *presetOutputs, PresetInputs *presetIn
{
for (x=0;x<this->gx;x++){
for(y=0;y<this->gy;y++){
presetOutputs->zoomexp_mesh[x][y]=presetOutputs->zoomexp;
}}
presetOutputs->zoomexp_mesh[x][y]=presetOutputs->zoomexp;
}
}
}
if(!presetOutputs->rot_is_mesh)
{
{
for (x=0;x<this->gx;x++){
for(y=0;y<this->gy;y++){
presetOutputs->rot_mesh[x][y]=presetOutputs->rot;

View File

@ -32,7 +32,7 @@
#include "event.h"
#include "BeatDetect.hpp"
#include "PresetChooser.hpp"
#include <iostream>
interface_t current_interface = DEFAULT_INTERFACE;
@ -155,35 +155,35 @@ void projectM::default_key_handler( projectMEvent event, projectMKeycode keycode
case PROJECTM_K_b:
break;
case PROJECTM_K_n:
// paranoia but could be useful if directory is empty
/// @bug implement == operator
if (!(*m_presetPos != m_presetChooser->end()))
return;
m_presetChooser->getNumPresets();
if ((*m_presetPos == m_presetChooser->end()))
break;
++(*m_presetPos);
/// @bug implement == operator
if (!((*m_presetPos) != m_presetChooser->end()))
if (((*m_presetPos) == m_presetChooser->end())) {
--(*m_presetPos);
delete(m_activePreset);
m_activePreset = m_presetPos->allocate(this->presetInputs, this->presetOutputs );
break;
case PROJECTM_K_r:
// if (PresetSwitcher::switchPreset(RANDOM_NEXT, HARD_CUT) < 0) {
printf("WARNING: Bad preset file, loading idle preset\n");
abort();
// }
break;
case PROJECTM_K_p:
if (*m_presetPos != m_presetChooser->begin()) {
--(*m_presetPos);
// ...mroe
break;
}
// if ((PresetSwitcher::switchPreset(ALPHA_PREVIOUS, HARD_CUT)) < 0){
printf("WARNING: Bad preset file, loading idle preset\n");
abort();
// }
if (m_activePreset)
delete(m_activePreset);
m_activePreset = m_presetPos->allocate(this->presetInputs, this->presetOutputs );
break;
case PROJECTM_K_r:
std::cout << "Warning: random unimplemented" << std::endl;
break;
case PROJECTM_K_p:
if (*m_presetPos != m_presetChooser->begin()) {
--(*m_presetPos);
if (m_activePreset)
delete(m_activePreset);
m_activePreset = m_presetPos->allocate(this->presetInputs, this->presetOutputs );
// ...mroe
}
break;
case PROJECTM_K_l:
if (renderer->noSwitch==0)renderer->noSwitch=1; else renderer->noSwitch=0;

File diff suppressed because it is too large Load Diff

View File

@ -172,16 +172,9 @@ public:
/* PER_FRAME CONSTANTS END */
/** Beat detection engine */
BeatDetect *beatDetect;
BeatDetect * beatDetect;
/** All readonly variables
* which are passed as inputs
* to presets. See struct definitition above */
PresetInputs presetInputs;
/** The presets modify these values. For now this is declared on stack
* but might be better on heap for sake of smooth preset switching */
PresetOutputs presetOutputs;
/** Functions */
DLLEXPORT projectM();
@ -223,7 +216,7 @@ public:
/// Deinitialize all preset related tools. Usually done before projectM cleanup
void destroyPresetTools();
void getCurrentMeshSize(int & x, int &y);
private:
// The current position of the directory iterator
@ -237,5 +230,14 @@ public:
// Currently loaded preset- will be fancier when smooth preset switching
Preset * m_activePreset;
/** All readonly variables
* which are passed as inputs
* to presets. See struct definitition above */
PresetInputs presetInputs;
/** The presets modify these values. For now this is declared on stack
* but might be better on heap for sake of smooth preset switching */
PresetOutputs presetOutputs;
};
#endif

View File

@ -841,6 +841,8 @@ IMPEXP OSStatus MAIN (OSType message, PluginMessageInfo *messageInfo, void *refC
#endif
/** Initialise projectM */
if (globalPM != 0)
delete(globalPM);
globalPM = new projectM();
globalPM->projectM_reset();

View File

@ -106,7 +106,7 @@ SDL_Surface *screen;
//SDL_RenderTarget *RenderTarget = NULL;
//GLuint RenderTargetTextureID;
projectM *globalPM = NULL;
static projectM * globalPM = NULL;
int maxsamples=512;