virtual void keyPressed(const KeyEventPtr e)
 {
     if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_COMMAND)
     {
          TutorialWindowEventProducer->closeWindow();
     }
     switch(e->getKey())
     {
     case KeyEvent::KEY_S:
          {
              buildSphere();
          }
          break;
     case KeyEvent::KEY_B:
          {
              buildBox();
          }
          break;
     case KeyEvent::KEY_Z:
          {
              //SceneFileHandler::the().write(rootNode, "scene.osb");
          }
          break;
     case KeyEvent::KEY_T:
          {
              buildTriMesh();
          }
          break;
     }
 }
 virtual void keyPressed(const KeyEventPtr e)
 {
     if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_CONTROL)
     {
          TutorialWindowEventProducer->closeWindow();
     }
 }
   virtual void keyPressed(const KeyEventPtr e)
   {
       if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_COMMAND)
       {
            TutorialWindowEventProducer->closeWindow();
       }

	   switch(e->getKey())
	   {
       case KeyEvent::KEY_T:
           break;
	   }
   }
   virtual void keyPressed(const KeyEventPtr e)
   {
       if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_CONTROL)
       {
           TutorialWindowEventProducer->closeWindow();
       }

       if(e->getKey() == KeyEvent::KEY_T)
       {
	 std::cout << "toggling" << std::endl;
	 //TheAnimcationAdvancer->stop();
	 
       }
   }
Beispiel #5
0
   virtual void keyPressed(const KeyEventPtr e)
   {
       if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_CONTROL)
       {
            TutorialWindowEventProducer->closeWindow();
       }

	   switch(e->getKey())
	   {
	   case KeyEvent::KEY_S:
		   statFlag = !statFlag;
		   mgr->setStatistics(statFlag);
		   break;
       case KeyEvent::KEY_EQUALS:
           {
               Vec3f Translation;
               Quaternion Rotation;
               Vec3f Scale;
               Quaternion ScaleOrient;
               Matrix ThePointLightMat = ThePointLightBeaconTransform->getMatrix();
               ThePointLightMat.getTransform(Translation,Rotation,Scale,ScaleOrient);
               Translation = Translation + Vec3f(0.0,10.0,0.0);
               ThePointLightMat.setTranslate(Translation);
               beginEditCP(ThePointLightBeaconTransform);
                   ThePointLightBeaconTransform->setMatrix(ThePointLightMat);
               endEditCP(ThePointLightBeaconTransform);
           }
           break;
       case KeyEvent::KEY_MINUS:
           {
               Vec3f Translation;
               Quaternion Rotation;
               Vec3f Scale;
               Quaternion ScaleOrient;
               Matrix ThePointLightMat = ThePointLightBeaconTransform->getMatrix();
               ThePointLightMat.getTransform(Translation,Rotation,Scale,ScaleOrient);
               Translation = Translation + Vec3f(0.0,-10.0,0.0);
               ThePointLightMat.setTranslate(Translation);
               beginEditCP(ThePointLightBeaconTransform);
                   ThePointLightBeaconTransform->setMatrix(ThePointLightMat);
               endEditCP(ThePointLightBeaconTransform);
           }
           break;
       case KeyEvent::KEY_T:
            beginEditCP(TheBlinnMat, BlinnMaterial::DiffuseTextureFieldMask);
            endEditCP(TheBlinnMat, BlinnMaterial::DiffuseTextureFieldMask);
           break;
	   }
   }
   virtual void keyPressed(const KeyEventPtr e)
   {
       if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_COMMAND)
       {
            TutorialWindowEventProducer->closeWindow();
       }

	   float TranslateAmount(0.05f);
	   float RotateAmount(0.1f);

	   switch(e->getKey())
	   {
	   default:
		   break;
	   }
   }
   virtual void keyPressed(const KeyEventPtr e)
   {
       if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_COMMAND)
       {
           TutorialWindowEventProducer->closeWindow();
       }
       if(e->getKey() == KeyEvent::KEY_S && e->getModifiers() & KeyEvent::KEY_MODIFIER_COMMAND)
       {
           TutorialStat = !TutorialStat;
           mgr->setStatistics(TutorialStat);
       }

	   //Toggle animation
	   if(e->getKey() == KeyEvent::KEY_SPACE)
	   {
		   if(animationPaused)
			   animationPaused = false;
		   else
			   animationPaused = true;
	   }


	   //Toggle bind pose
	   if(e->getKey() == KeyEvent::KEY_B)
	   {
		   if(e->getModifiers() & KeyEvent::KEY_MODIFIER_SHIFT)
		   {
			   //Toggle mesh
			   for(int i(0); i < UnboundGeometries.size(); ++i)
			   {
				   if(UnboundGeometries[i]->getTravMask() == 0)
				   {
					   beginEditCP(UnboundGeometries[i], Node::TravMaskFieldMask);
							UnboundGeometries[i]->setTravMask(1);
						endEditCP(UnboundGeometries[i], Node::TravMaskFieldMask);
				   } 
				   else
				   {
					   beginEditCP(UnboundGeometries[i], Node::TravMaskFieldMask);
							UnboundGeometries[i]->setTravMask(0);
						endEditCP(UnboundGeometries[i], Node::TravMaskFieldMask);
				   }
			   }
		   }
		   else
		   {
			   //Toggle skeleton
			   for(int i(0); i < SkeletonNodes.size(); ++i)
			   {
				   if(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->getDrawBindPose() == false)
				   {
					   beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
						 SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->setDrawBindPose(true);
						endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
				   } 
				   else
				   {
					   beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
						 SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->setDrawBindPose(false);
						endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
				   }
			   }
		   }
	   }

	   //Toggle current pose
	   if(e->getKey() == KeyEvent::KEY_P)
	   {
		   if(e->getModifiers() & KeyEvent::KEY_MODIFIER_SHIFT)
		   {
			   //Toggle mesh
			   for(int i(0); i < MeshNodes.size(); ++i)
			   {
				   if(MeshNodes[i]->getTravMask() == 0)
				   {
					   beginEditCP(MeshNodes[i], Node::TravMaskFieldMask);
							MeshNodes[i]->setTravMask(1);
						endEditCP(MeshNodes[i], Node::TravMaskFieldMask);
				   } 
				   else
				   {
					   beginEditCP(MeshNodes[i], Node::TravMaskFieldMask);
							MeshNodes[i]->setTravMask(0);
						endEditCP(MeshNodes[i], Node::TravMaskFieldMask);
				   }
			   }
		   }
		   else
		   {
			   //Toggle skeleton
			   for(int i(0); i < SkeletonNodes.size(); ++i)
			   {
				   if(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->getDrawPose() == false)
				   {
					   beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawPoseFieldMask);
						 SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->setDrawPose(true);
						endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawPoseFieldMask);
				   } 
				   else
				   {
					   beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawPoseFieldMask);
						 SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->setDrawPose(false);
						endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawPoseFieldMask);
				   }
			   }
		   }
	   }

	   //Toggle axes
	   if(e->getKey() == KeyEvent::KEY_A)
	   {
		   if(Axes->getTravMask() == 0)
			   Axes->setTravMask(1);
		   else
			   Axes->setTravMask(0);
	   }

	   //Toggle grid
	   if(e->getKey() == KeyEvent::KEY_G)
	   {
			if(Grid->getTravMask() == 0)
			   Grid->setTravMask(1);
			else
			   Grid->setTravMask(0);
	   }
   }
   virtual void keyPressed(const KeyEventPtr e)
   {
       //Exit
       if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_COMMAND)
       {
           TutorialWindowEventProducer->closeWindow();
       }

       //Toggle animation
       if(e->getKey() == KeyEvent::KEY_SPACE)
       {
           if(animationPaused)
               animationPaused = false;
           else
               animationPaused = true;
       }


       //Toggle bind pose
       if(e->getKey() == KeyEvent::KEY_B)
       {
           if(e->getModifiers() & KeyEvent::KEY_MODIFIER_SHIFT)
           {
               //Toggle mesh
               for(int i(0); i < UnboundGeometries.size(); ++i)
               {
                   if(UnboundGeometries[i]->getTravMask() == 0)
                   {
                       beginEditCP(UnboundGeometries[i], Node::TravMaskFieldMask);
                            UnboundGeometries[i]->setTravMask(1);
                        endEditCP(UnboundGeometries[i], Node::TravMaskFieldMask);
                   } 
                   else
                   {
                       beginEditCP(UnboundGeometries[i], Node::TravMaskFieldMask);
                            UnboundGeometries[i]->setTravMask(0);
                        endEditCP(UnboundGeometries[i], Node::TravMaskFieldMask);
                   }
               }
           }
           else
           {
               //Toggle skeleton
               for(int i(0); i < SkeletonNodes.size(); ++i)
               {
                   if(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->getDrawBindPose() == false)
                   {
                       beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
                         SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->setDrawBindPose(true);
                        endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
                   } 
                   else
                   {
                       beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
                         SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->setDrawBindPose(false);
                        endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
                   }
               }
           }
       }

       //Toggle current pose
       if(e->getKey() == KeyEvent::KEY_P)
       {
           if(e->getModifiers() & KeyEvent::KEY_MODIFIER_SHIFT)
           {
               //Toggle mesh
               for(int i(0); i < MeshNodes.size(); ++i)
               {
                   if(MeshNodes[i]->getTravMask() == 0)
                   {
                       beginEditCP(MeshNodes[i], Node::TravMaskFieldMask);
                            MeshNodes[i]->setTravMask(1);
                        endEditCP(MeshNodes[i], Node::TravMaskFieldMask);
                   } 
                   else
                   {
                       beginEditCP(MeshNodes[i], Node::TravMaskFieldMask);
                            MeshNodes[i]->setTravMask(0);
                        endEditCP(MeshNodes[i], Node::TravMaskFieldMask);
                   }
               }
           }
           else
           {
               //Toggle skeleton
               for(int i(0); i < SkeletonNodes.size(); ++i)
               {
                   if(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->getDrawPose() == false)
                   {
                       beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawPoseFieldMask);
                         SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->setDrawPose(true);
                        endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawPoseFieldMask);
                   } 
                   else
                   {
                       beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawPoseFieldMask);
                         SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore())->setDrawPose(false);
                        endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNodes[i]->getCore()), SkeletonDrawable::DrawPoseFieldMask);
                   }
               }
           }
       }

       //Toggle override status on second animation
       if(e->getKey() == KeyEvent::KEY_O)
       {
           if(TheSkeletonBlendedAnimation->getOverrideStatus(1))
           {
               TheSkeletonBlendedAnimation->setOverrideStatus(1, false);
           }
           else
           {
               TheSkeletonBlendedAnimation->setOverrideStatus(1, true);
           }
       }
   }
Beispiel #9
0
   virtual void keyPressed(const KeyEventPtr e)
   {
       if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_CONTROL)
       {
            TutorialWindowEventProducer->closeWindow();
       }
       switch(e->getKey())
       {
            case KeyEvent::KEY_UP:
                {
                    Color4f Col(TheLight->getDiffuse());
                    Col += Color4f(0.2,0.2,0.2,0.0);

                    std::cout << "Diffuse Color : " << Col  << std::endl;

                    beginEditCP(TheLight);
                        TheLight->setAmbient(Col*0.1);
                        TheLight->setDiffuse(Col);
                        TheLight->setSpecular(Col);
                    endEditCP(TheLight);

                    MaxLuminance =  Col.red();
                    std::cout << "MaxLuminance : " << MaxLuminance  << std::endl;
                    HDRTextureFilter->setUniformParameter("MaxLuminance", MaxLuminance);
                }
                break;
            case KeyEvent::KEY_DOWN:
                {
                    Color4f Col(TheLight->getDiffuse());
                    Col -= Color4f(0.2,0.2,0.2,0.0);
                    std::cout << "Diffuse Color : " << Col  << std::endl;

                    beginEditCP(TheLight);
                        TheLight->setDiffuse(Col);
                    endEditCP(TheLight);

                    MaxLuminance =  Col.red() + 1.0f;
                    std::cout << "MaxLuminance : " << MaxLuminance  << std::endl;
                    HDRTextureFilter->setUniformParameter("MaxLuminance", MaxLuminance);
                }
                break;
            case KeyEvent::KEY_RIGHT:
                {
                    Exposure +=  0.1f;
                    std::cout << "Exposure : " << Exposure  << std::endl;
                    HDRTextureFilter->setUniformParameter("Exposure", Exposure);
                }
                break;
            case KeyEvent::KEY_LEFT:
                {
                    Exposure -=  0.1f;
                    std::cout << "Exposure : " << Exposure  << std::endl;
                    HDRTextureFilter->setUniformParameter("Exposure", Exposure);
                }
                break;
            case KeyEvent::KEY_8:
                {
                    Gamma +=  0.05f;
                    std::cout << "Gamma : " << Gamma  << std::endl;
                    HDRTextureFilter->setUniformParameter("Gamma", Gamma);
                }
                break;
            case KeyEvent::KEY_7:
                {
                    Gamma -=  0.05f;
                    std::cout << "Gamma : " << Gamma  << std::endl;
                    HDRTextureFilter->setUniformParameter("Gamma", Gamma);
                }
                break;
       }
   }
   virtual void keyPressed(const KeyEventPtr e)
   {
	   //Exit
       if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_COMMAND)
       {
           TutorialWindowEventProducer->closeWindow();
       }

	   //Toggle animation
	   if(e->getKey() == KeyEvent::KEY_SPACE)
	   {
		   if(animationPaused)
			   animationPaused = false;
		   else
			   animationPaused = true;
	   }

	   //Toggle bind pose
	   if(e->getKey() == KeyEvent::KEY_B)
	   {
		   if(e->getModifiers() & KeyEvent::KEY_MODIFIER_SHIFT)
		   {
			   //Toggle mesh
			   if(UnboundGeometry->getTravMask() == 0)
			   {

				   beginEditCP(UnboundGeometry, Node::TravMaskFieldMask);
						UnboundGeometry->setTravMask(1);
					endEditCP(UnboundGeometry, Node::TravMaskFieldMask);
			   } 
			   else
			   {
				   beginEditCP(UnboundGeometry, Node::TravMaskFieldMask);
						UnboundGeometry->setTravMask(0);
					endEditCP(UnboundGeometry, Node::TravMaskFieldMask);
			   }
		   }
		   else
		   {
				//Toggle skeleton
			   if(SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore())->getDrawBindPose() == false)
			   {
				   beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
					 SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore())->setDrawBindPose(true);
					endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
			   } 
			   else
			   {
				   beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
					 SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore())->setDrawBindPose(false);
					endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore()), SkeletonDrawable::DrawBindPoseFieldMask);
			   }
		   }
	   }

	   //Toggle current pose
	   if(e->getKey() == KeyEvent::KEY_P)
	   {
		   if(e->getModifiers() & KeyEvent::KEY_MODIFIER_SHIFT)
		   {
			   //Toggle mesh
			   if(MeshNode->getTravMask() == 0)
			   {
				   beginEditCP(MeshNode, Node::TravMaskFieldMask);
						MeshNode->setTravMask(1);
					endEditCP(MeshNode, Node::TravMaskFieldMask);
			   } 
			   else
			   {
				   beginEditCP(MeshNode, Node::TravMaskFieldMask);
						MeshNode->setTravMask(0);
					endEditCP(MeshNode, Node::TravMaskFieldMask);
			   }
		   }
		   else
		   {
			   //Toggle skeleton
			   if(SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore())->getDrawPose() == false)
			   {
				   beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore()), SkeletonDrawable::DrawPoseFieldMask);
					 SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore())->setDrawPose(true);
					endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore()), SkeletonDrawable::DrawPoseFieldMask);
			   } 
			   else
			   {
				   beginEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore()), SkeletonDrawable::DrawPoseFieldMask);
					 SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore())->setDrawPose(false);
					endEditCP(SkeletonDrawable::Ptr::dcast(SkeletonNode->getCore()), SkeletonDrawable::DrawPoseFieldMask);
			   }
		   }
	   }
   }