Skip to content

Commit

Permalink
Reset機能をつけてなんどもできるように
Browse files Browse the repository at this point in the history
  • Loading branch information
murawakimitsuhiro committed Aug 30, 2017
1 parent 4bd49c7 commit 0499928
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
Binary file not shown.
Binary file modified bin/Brain-Fu_kDebug.app/Contents/MacOS/Brain-Fu_kDebug
Binary file not shown.
12 changes: 9 additions & 3 deletions src/BrainController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ void BrainController::setup() {
setupOSCMessageReceive();
}

void BrainController::reload() {
}

//LINK OSC
void BrainController::setupOSCMessageReceive() {
/* /gain to gain */
Expand All @@ -32,18 +35,21 @@ void BrainController::update() {
models[i].update();
}

/*
if (wasStart == 0) {
return;
}
}*/

//decomposed by time
if (isLearning > 0 && nextDecomposeNum/* * 3*/ - int(ofGetElapsedTimef()) < 0) {
if ((nextDecomposeNum+decomposeCount*BrainModelData::modelNum) * 0.3 - int(ofGetElapsedTimef()) < 0) {
// if (isLearning > 0 && nextDecomposeNum/* * 3*/ - int(ofGetElapsedTimef()) < 0) {
models[nextDecomposeNum].startDecompose();

if (nextDecomposeNum == BrainModelData::modelNum - 10) {
nextDecomposeNum = 0;
decomposeCount++;
for (int i=0; i<BrainModelData::modelNum; i++) {
models[i].setStateSolid();
models[i].reset();
}
} else {
nextDecomposeNum++;
Expand Down
3 changes: 3 additions & 0 deletions src/BrainController.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class BrainController {
void update();
void draw();
void drawWithMesh(ofxAssimpModelLoader mesh);
void reload();

int decomposeCount = 0;
};

#endif /* BrainController_hpp */
13 changes: 11 additions & 2 deletions src/ofDecomposeModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ void ofDecomposeModel::startDecompose() {
}
}

void ofDecomposeModel::reset() {
setStateSolid();
decomposeBeginTime = 0;
vectors.clear();
speeds.clear();
colors.clear();
decomposeCount++;
}

void ofDecomposeModel::setStateSolid() {
state = solid;
}
Expand All @@ -46,7 +55,7 @@ void ofDecomposeModel::update() {
if (vectors[i].z > 70) {
speeds[i].x = ofRandom(-12, 12);
speeds[i].y = ofRandom(-12, 12);
speeds[i].z = 5.5;
speeds[i].z = 6.5;//5.5;

//float alpha = (vectors[i].z - 100) / 100;

Expand Down Expand Up @@ -105,6 +114,6 @@ void ofDecomposeModel::drawDecomposing() {
vbo.updateVertexData(vectorArray, vectors.size());
vbo.updateColorData(colorArray, colors.size());

glPointSize(1);
glPointSize(0.01);
vbo.draw(GL_POINTS, 0, vectors.size());
}
3 changes: 3 additions & 0 deletions src/ofDecomposeModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class ofDecomposeModel: public ofxAssimpModelLoader {
void draw();
void startDecompose();
void setStateSolid();

void reset();
int decomposeCount = 0;
};

#endif /* ofDisassemblyModel_hpp */
Expand Down

0 comments on commit 0499928

Please sign in to comment.