Permalink
Browse files

Small bug fixes

  • Loading branch information...
betajippity committed Feb 22, 2014
1 parent 3ceeedb commit e4b638030473e9071baee071cc84ce2a215891c6
Showing with 26 additions and 10 deletions.
  1. +1 −1 src/scene/sceneloader.cpp
  2. +23 −8 src/viewer/viewer.cpp
  3. +2 −1 src/viewer/viewer.hpp
@@ -125,7 +125,7 @@ void sceneloader::loadCamera(const Json::Value& jsoncamera){
}
//load camera fov
if(jsoncamera.isMember("fovx")){
- camera_fov[0] = jsoncamera["fovx"].asFloat();
+ camera_fov[0] = jsoncamera["fovx"].asFloat()/2.0f;
float xscaled = tan(camera_fov.x*(PI/180));
float yscaled = (xscaled * camera_resolution.y)/camera_resolution.x;
camera_fov.y = (atan(xscaled)*180)/PI;
View
@@ -40,6 +40,7 @@ void viewer::load(fluidCore::flipsim* sim, bool retina, vec2 resolution,
siminitialized = false;
drawobjects = true;
+ drawInvalid = false;
dumpFramebuffer = false;
dumpReady = false;
@@ -139,14 +140,18 @@ void viewer::mainLoop(){
for(int j=0; j<psize; j++){
if(particles->operator[](j)->type==FLUID){
- vertexData.push_back(particles->operator[](j)->p*maxd);
- float c = length(particles->operator[](j)->u)/3.0f;
- c = glm::max(c, 1.0f*glm::max((.7f - particles->operator[](j)->density),0.0f));
- bool invalid = particles->operator[](j)->invalid;
- if(invalid){
- colorData.push_back(vec4(1,0,0,0));
- }else{
- colorData.push_back(vec4(c,c,1,0));
+ if(!particles->operator[](j)->invalid ||
+ (particles->operator[](j)->invalid && drawInvalid)){
+ vertexData.push_back(particles->operator[](j)->p*maxd);
+ float c = length(particles->operator[](j)->u)/3.0f;
+ c = glm::max(c,
+ 1.0f*glm::max((.7f-particles->operator[](j)->density),0.0f));
+ bool invalid = particles->operator[](j)->invalid;
+ if(invalid){
+ colorData.push_back(vec4(1,0,0,0));
+ }else{
+ colorData.push_back(vec4(c,c,1,0));
+ }
}
}
}
@@ -364,6 +369,16 @@ void viewer::updateInputs(){
cout << "\nPARTIO Export OFF.\n" << endl;
}
}
+ }else if(glfwGetKey(window, GLFW_KEY_I) == GLFW_PRESS){
+ if(cam.currentKey!=GLFW_KEY_I){
+ drawInvalid = !drawInvalid;
+ cam.currentKey = GLFW_KEY_I;
+ if(drawInvalid){
+ cout << "\nDraw out of bound particles ON.\n" << endl;
+ }else{
+ cout << "\nDraw out of bound particles OFF.\n" << endl;
+ }
+ }
}else{
cam.currentKey = 0;
}
View
@@ -110,7 +110,8 @@ class viewer{
fluidCore::flipsim* sim;
bool siminitialized;
bool drawobjects;
-
+ bool drawInvalid;
+
unsigned char* bitmapData;
bool dumpFramebuffer;
bool dumpReady;

0 comments on commit e4b6380

Please sign in to comment.