Browse Source

new config files (not needed...) and some modifications

master
Joshua Moerman (@Kassalade) 14 years ago
parent
commit
218085a2c9
  1. 2
      Attractor.cpp
  2. 2
      AwesomeAttractorConfig.h
  3. 2
      AwesomeAttractorConfig.h.in
  4. 8
      CMakeLists.txt
  5. 9
      main.cpp

2
Attractor.cpp

@ -10,7 +10,7 @@
Attractor::Attractor() :
kernel(0), projector(0) {
stfu::node kernel_node;
switch(rand()%3){
switch(rand()%2+1){
case 0:
kernel_node.value("type") = "lorenz";
kernel_node.value("dimensions") = "3";

2
AwesomeAttractorConfig.h

@ -0,0 +1,2 @@

2
AwesomeAttractorConfig.h.in

@ -0,0 +1,2 @@

8
CMakeLists.txt

@ -1,5 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (AwesomeAttractor)
configure_file (
"AwesomeAttractorConfig.h.in"
"AwesomeAttractorConfig.h")
add_executable (AwesomeAttractor main.cpp Attractor.cpp AttractorKernel.cpp Canvas.cpp Projector.cpp stfu/stf.cpp canvae/PNG.cpp canvae/Raw.cpp projectors/Normalizer.cpp projectors/Projection.cpp pngwriter/pngwriter.cc)
target_link_libraries (AwesomeAttractor png)
target_link_libraries (AwesomeAttractor png)

9
main.cpp

@ -13,6 +13,7 @@
#include "ostream_helpers.h"
#include "defines.hpp"
#include "AwesomeAttractorConfig.h"
int verbose;
@ -37,6 +38,7 @@ void showHelpText() {
int main(int argc, char* argv[]) {
verbose = 0;
std::string attractorFile = "";
std::string output_path = "render/";
bool generate_random = false;
unsigned int iterations = DEFAULT_ITERATIONS;
unsigned int width = DEFAULT_WIDTH;
@ -64,6 +66,8 @@ int main(int argc, char* argv[]) {
height = atoi(argv[++i]);
} else if(strcmp(argv[i], "-I") == 0) {
iterations = atoi(argv[++i]);
} else if(strcmp(argv[i], "-P") == 0) {
output_path = argv[++i];
} else if(strcmp(argv[i], "-R") == 0) {
generate_random = true;
} else {
@ -97,6 +101,7 @@ int main(int argc, char* argv[]) {
myAttractor.iterate();
myAttractor.plot();
}
sleep(1);
if(verbose >= 0) {
std::cout << "\r" << j << " out of " << iterations << " done." << std::flush;
}
@ -109,11 +114,11 @@ int main(int argc, char* argv[]) {
LogMoreInfo("Average iterations per second: %f\n\n", totalIterations/totalTime);
// saving output
char filename[50];
char filename[256];
time_t t = time(0);
struct tm* lt = localtime(&t);
int r = rand() % 10;
sprintf(filename, "render/attractor_%04d-%02d-%02d_%02d-%02d-%02d-%01d", lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec, r);
sprintf(filename, (output_path+"attractor_%04d-%02d-%02d_%02d-%02d-%02d-%01d").c_str(), lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec, r);
start = clock();
myAttractor.projector->canvas->output_file(filename);