Skip to content

Commit

Permalink
lotsa updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Memo Akten authored and Memo Akten committed Oct 29, 2010
1 parent d6e0d86 commit a806223
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 13 deletions.
Expand Up @@ -41,7 +41,7 @@ void ParticleSystem::updateAndDraw( bool drawingFluid ){
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(3, GL_FLOAT, 0, colArray);

glDrawArrays(GL_LINES, 0, MAX_PARTICLES * 2);
glDrawArrays(GL_TRIANGLE_STRIP, 0, MAX_PARTICLES * 2);

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
Expand Down
Expand Up @@ -32,9 +32,9 @@ void msaFluidParticlesApp::setup() {
#ifdef USE_GUI
gui.addSlider("fluidCellsX", fluidCellsX, 20, 400);
gui.addButton("resizeFluid", resizeFluid);
gui.addSlider("fs.viscocity", fluidSolver.viscocity, 0.0, 0.01, 0.5);
gui.addSlider("fs.colorDiffusion", fluidSolver.colorDiffusion, 0.0, 0.0003, 0.5);
gui.addSlider("fs.fadeSpeed", fluidSolver.fadeSpeed, 0.0, 0.1, 0.5);
gui.addSlider("fs.viscocity", fluidSolver.viscocity, 0.0, 0.01);
gui.addSlider("fs.colorDiffusion", fluidSolver.colorDiffusion, 0.0, 0.0003);
gui.addSlider("fs.fadeSpeed", fluidSolver.fadeSpeed, 0.0, 0.1);
gui.addSlider("fs.solverIterations", fluidSolver.solverIterations, 1, 50);
gui.addSlider("fs.deltaT", fluidSolver.deltaT, 0.1, 5);
gui.addComboBox("fd.drawMode", (int&)fluidDrawer.drawMode, kFluidDrawCount, (string*)FluidDrawerGl::drawOptionTitles);
Expand Down
9 changes: 5 additions & 4 deletions MSAFluid/src/MSAFluidDrawerBase.cpp
Expand Up @@ -56,6 +56,7 @@ namespace MSA {
brightness = 1;
doInvert = false;
velDrawMult = 1;
vectorSkipCount = 0;

enableAlpha(false);

Expand Down Expand Up @@ -322,10 +323,10 @@ namespace MSA {
float vt = velDrawThreshold * _fluidSolver->getInvWidth() * _fluidSolver->getInvHeight();
vt *= vt;

for (int j=0; j<fh-2; j++ ){
for (int i=0; i<fw-2; i++ ){
_fluidSolver->getInfoAtCell(i+1, j+1, &vel, NULL);
float d2 = vel.x * vel.x + vel.y * vel.y;
for (int j=0; j<fh-2; j+=vectorSkipCount+1 ){
for (int i=0; i<fw-2; i+=vectorSkipCount+1 ){
vel = _fluidSolver->getVelocityAtCell(i+1, j+1);
float d2 = vel.lengthSquared();
if(d2>vt) {
if(d2 > maxVel * maxVel) {
float mult = maxVel * maxVel/ d2;
Expand Down
1 change: 1 addition & 0 deletions MSAFluid/src/MSAFluidDrawerBase.h
Expand Up @@ -61,6 +61,7 @@ namespace MSA {
float brightness;
float velDrawThreshold;
float velDrawMult;
int vectorSkipCount;

FluidDrawMode drawMode;

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions ofxMSADirManager/src/ofxMSADirManager.h
Expand Up @@ -33,23 +33,25 @@

#include "ofxDirList.h"
#include "MSADataProtector.h"
#include "ofxMSAImage.h"

namespace MSA {

template <typename T> class DirManager {
public:
ofxDirList DIR;

void setup(string path, const char *ext = NULL, string* md5 = NULL) {
currentIndex = 0;
ofxDirList DIR;
if(ext) DIR.allowExt(ext);
int numFiles = DIR.listDir(path);

ofLog(OF_LOG_VERBOSE, "DirManager::setup( " + path + " ) | " + ofToString(numFiles) + " files loaded");
for(int i = 0; i < numFiles; i++) {
if(md5) {
CheckFileMD5(DIR.getPath(i), md5[i], true);
checkFileMD5(DIR.getPath(i), md5[i], true);
} else {
CheckFileMD5(DIR.getPath(i), "", false);
checkFileMD5(DIR.getPath(i), "", false);
}
string filename = DIR.getPath(i);
ofLog(OF_LOG_VERBOSE, " loading " + filename);
Expand Down Expand Up @@ -96,7 +98,7 @@ namespace MSA {
return getCurrent();
}

int count() {
int size() {
return resources.size();
}

Expand All @@ -108,7 +110,7 @@ namespace MSA {


//---------------------------
class ImageDirManager : public DirManager<ofImage> {
class ImageDirManager : public DirManager<Image> {
public:
void loadResource(string filename) {
resources.back().loadImage(filename);
Expand Down
23 changes: 23 additions & 0 deletions ofxMSAImage/src/ofxMSAImage.h
@@ -0,0 +1,23 @@
/*
* ofxMSAImage.h
* UK Summer Games v2
*
* Created by Memo Akten on 27/08/2010.
* Copyright 2010 MSA Visuals Ltd. All rights reserved.
*
*/

#pragma once


#include "MSACore.h"
#include "ofMain.h"

namespace MSA {
class Image : public ofImage {
public:
ofPixels& getMyPixels() {
return myPixels;
}
};
}

0 comments on commit a806223

Please sign in to comment.