Changeset 7076 for code/branches/presentation3
- Timestamp:
- Jun 2, 2010, 12:39:46 AM (14 years ago)
- Location:
- code/branches/presentation3/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/modules/designtools/ScreenshotManager.cc
r7041 r7076 39 39 mWindowHeight = pRenderWindow->getHeight(); 40 40 //create temporary texture 41 mTempTex = Ogre::TextureManager::getSingleton().createManual("ScreenShotTex", 41 mTempTex = Ogre::TextureManager::getSingleton().createManual("ScreenShotTex", 42 42 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, 43 mWindowWidth, mWindowHeight,0, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET); 44 43 mWindowWidth, mWindowHeight,0, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET); 44 45 45 //get The current Render Target of the temp Texture 46 46 mRT = mTempTex->getBuffer()->getRenderTarget(); 47 47 48 //HardwarePixelBufferSharedPtr to the Buffer of the temp Texture 48 //HardwarePixelBufferSharedPtr to the Buffer of the temp Texture 49 49 mBuffer = mTempTex->getBuffer(); 50 50 … … 72 72 std::string fileName = PathConfig::getInstance().getLogPathString() + "screenshot_" + this->getTimestamp(); 73 73 74 //Remove all viewports, so the added Viewport(camera) ist the only 74 //Remove all viewports, so the added Viewport(camera) ist the only 75 75 mRT->removeAllViewports(); 76 76 mRT->addViewport(camera); 77 77 78 78 //set the viewport settings 79 79 Ogre::Viewport *vp = mRT->getViewport(0); 80 vp->setClearEveryFrame(true); 80 vp->setClearEveryFrame(true); 81 81 vp->setOverlaysEnabled(false); 82 82 … … 103 103 // set the original Frustum extents 104 104 camera->getFrustumExtents(originalFrustumLeft, originalFrustumRight, originalFrustumTop, originalFrustumBottom); 105 105 106 106 // compute the Stepsize for the drid 107 107 Ogre::Real frustumGridStepHorizontal = (originalFrustumRight * 2) / mGridSize; … … 110 110 // process each grid 111 111 Ogre::Real frustumLeft, frustumRight, frustumTop, frustumBottom; 112 for (unsigned int nbScreenshots = 0; nbScreenshots < mGridSize * mGridSize; nbScreenshots++) 113 { 114 int y = nbScreenshots / mGridSize; 115 int x = nbScreenshots - y * mGridSize; 116 112 for (unsigned int nbScreenshots = 0; nbScreenshots < mGridSize * mGridSize; nbScreenshots++) 113 { 114 int y = nbScreenshots / mGridSize; 115 int x = nbScreenshots - y * mGridSize; 116 117 117 // Shoggoth frustum extents setting 118 118 // compute the new frustum extents … … 121 121 frustumTop = originalFrustumTop - frustumGridStepVertical * y; 122 122 frustumBottom = frustumTop - frustumGridStepVertical; 123 123 124 124 // set the frustum extents value to the camera 125 125 camera->setFrustumExtents(frustumLeft, frustumRight, frustumTop, frustumBottom); … … 128 128 Ogre::Root::getSingletonPtr()->clearEventTimes(); 129 129 mRT->update(); //render 130 131 //define the current 130 131 //define the current 132 132 Ogre::Box subBox = Ogre::Box(x* mWindowWidth,y * mWindowHeight,x * mWindowWidth + mWindowWidth, y * mWindowHeight + mWindowHeight); 133 //copy the content from the temp buffer into the final picture PixelBox 133 //copy the content from the temp buffer into the final picture PixelBox 134 134 //Place the tempBuffer content at the right position 135 135 mBuffer->blitToMemory(mFinalPicturePB.getSubVolume(subBox)); 136 136 137 137 } 138 138 139 139 // set frustum extents to previous settings 140 140 camera->resetFrustumExtents(); 141 141 142 142 Ogre::Image finalImage; //declare the final Image Object 143 143 //insert the PixelBox data into the Image Object … … 145 145 // Save the Final image to a file 146 146 finalImage.save(fileName + "." + mFileExtension); 147 147 148 148 } 149 149 … … 163 163 pTime = localtime( &ctTime ); 164 164 std::ostringstream oss; 165 oss 165 oss << std::setw(2) << std::setfill('0') << (pTime->tm_mon + 1) 166 166 << std::setw(2) << std::setfill('0') << pTime->tm_mday 167 167 << std::setw(2) << std::setfill('0') << (pTime->tm_year + 1900) -
code/branches/presentation3/src/modules/designtools/ScreenshotManager.h
r7044 r7076 21 21 22 22 23 /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots. 23 /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots. 24 24 * pRenderWindow: Pointer to the render window. This could be "mWindow" from the ExampleApplication, 25 25 * the window automatically created obtained when calling … … 48 48 static void makeScreenshot_s() 49 49 { getInstance().makeScreenshot(); } 50 50 51 51 protected: 52 52 static std::string getTimestamp(); -
code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.cc
r7063 r7076 80 80 this->numberOf[killer]=0; 81 81 this->tutorial=true; 82 82 this->pointsPerTime=0.0f; 83 83 this->setHUDTemplate("DynamicmatchHUD"); 84 84 } … … 91 91 static ColourValue colours[] = 92 92 { 93 ColourValue(1.0f, 0.3f, 0.3f), 94 ColourValue(0.3f, 0.3f, 1.0f), 95 ColourValue(0.3f, 1.0f, 0.3f) 96 93 ColourValue(1.0f, 0.3f, 0.3f), //chasercolour 94 ColourValue(0.3f, 0.3f, 1.0f), //piggycolour 95 ColourValue(0.3f, 1.0f, 0.3f) //killercolour what about black: 0.0f, 0.0f, 0.0f 96 97 97 }; 98 98 static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue)); … … 102 102 103 103 bool Dynamicmatch::allowPawnDamage(Pawn* victim, Pawn* originator) 104 { 104 { //TODO: static and fading message for the "human" player's 105 105 if (!originator||!victim) 106 106 return false; … … 115 115 if (notEnoughPigs) 116 116 { 117 numberOf[target]--; 118 playerParty_[victim->getPlayer()]=piggy; 119 setPlayerColour(victim->getPlayer()); 120 numberOf[piggy]++; 121 122 if(tutorial) 117 numberOf[target]--; //decrease numberof victims's party 118 playerParty_[victim->getPlayer()]=piggy; //victim's new party: pig 119 setPlayerColour(victim->getPlayer()); //victim's new colour 120 numberOf[piggy]++; //party switch: number of players is not affected (decrease and increase) 121 122 if(tutorial) //announce party switch 123 123 { 124 124 std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(victim->getPlayer()); … … 129 129 } 130 130 } 131 if (notEnoughKillers) 131 if (notEnoughKillers) //reward the originator 132 132 { 133 numberOf[source]--; 134 playerParty_[originator->getPlayer()]=killer; 135 setPlayerColour(originator->getPlayer()); 133 numberOf[source]--; //decrease numberof originator's party 134 playerParty_[originator->getPlayer()]=killer; //originator's new party: killer 135 setPlayerColour(originator->getPlayer()); //originator's new colour 136 136 numberOf[killer]++; 137 137 138 if(tutorial) 138 if(tutorial) //announce party switch 139 139 { 140 140 std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer()); … … 146 146 } 147 147 } 148 evaluatePlayerParties(); 149 148 evaluatePlayerParties(); //check if the party change has to trigger futher party changes 149 150 150 //Give new pig boost 151 151 SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim); … … 161 161 else if (notEnoughKillers) 162 162 { 163 numberOf[source]--; 164 playerParty_[originator->getPlayer()]=killer; 165 setPlayerColour(originator->getPlayer()); 166 numberOf[killer]++; 167 168 169 if(tutorial) 163 numberOf[source]--; //decrease numberof originator's party 164 playerParty_[originator->getPlayer()]=killer; //originator's new party: killer 165 setPlayerColour(originator->getPlayer()); //originator colour 166 numberOf[killer]++; //party switch: number of players is not affected (decrease and increase) 167 168 169 if(tutorial) //announce party switch 170 170 { 171 171 std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer()); … … 176 176 } 177 177 } 178 evaluatePlayerParties(); 178 evaluatePlayerParties(); //check if the party change has to trigger futher party changes 179 179 } 180 180 //Case: notEnoughChasers: party change 181 181 else if (notEnoughChasers) 182 182 { 183 numberOf[target]--; 184 playerParty_[victim->getPlayer()]=chaser; 185 setPlayerColour(victim->getPlayer()); 186 numberOf[chaser]++; 187 188 if(tutorial) 183 numberOf[target]--; //decrease numberof victims's party 184 playerParty_[victim->getPlayer()]=chaser; //victim's new party: chaser 185 setPlayerColour(victim->getPlayer()); //victim colour 186 numberOf[chaser]++; //party switch: number of players is not affected (decrease and increase) 187 188 if(tutorial) //announce party switch 189 189 { 190 190 std::map<PlayerInfo*, Player>::iterator it3 = this->players_.find(originator->getPlayer()); … … 193 193 if (numberOf[killer]>0) 194 194 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it3->first->getClientID(),partyColours_[piggy]); 195 195 196 196 else 197 197 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it3->first->getClientID(),partyColours_[piggy]); … … 199 199 } 200 200 } 201 evaluatePlayerParties(); 201 evaluatePlayerParties(); //check if the party change has to trigger futher party changes 202 202 } 203 203 … … 224 224 playerParty_[originator->getPlayer()]=chaser; 225 225 226 //party switch -> colour switch 226 //party switch -> colour switch 227 227 setPlayerColour(victim->getPlayer()); //victim colour 228 228 setPlayerColour(originator->getPlayer());//originator colour 229 229 230 230 //Announce pary switch 231 231 if(tutorial) … … 233 233 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer()); 234 234 if (it != this->players_.end()) 235 { 235 { 236 236 if (numberOf[killer]>0) 237 237 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(), partyColours_[piggy]); … … 258 258 } 259 259 // killer vs piggy 260 else if (source==killer &&target==piggy) //party and colour switch260 else if (source==killer &&target==piggy) //party and colour switch 261 261 { 262 262 playerParty_[victim->getPlayer()]=killer; 263 263 playerParty_[originator->getPlayer()]=piggy; 264 264 265 setPlayerColour(victim->getPlayer()); 266 setPlayerColour(originator->getPlayer()); 265 setPlayerColour(victim->getPlayer()); //victim colour 266 setPlayerColour(originator->getPlayer()); //originator colour 267 267 268 268 if(tutorial) //Announce pary switch … … 298 298 299 299 bool Dynamicmatch::allowPawnDeath(Pawn* victim, Pawn* originator) 300 { 300 { 301 301 //killers can kill chasers and killers can be killed by chasers 302 302 if ((playerParty_[originator->getPlayer()] == killer && playerParty_[victim->getPlayer()] == chaser)||(playerParty_[victim->getPlayer()] == killer && 303 303 playerParty_[originator->getPlayer()] == chaser )) 304 304 { 305 if (playerParty_[originator->getPlayer()] == killer) 305 if (playerParty_[originator->getPlayer()] == killer) //reward the killer 306 306 { 307 307 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer()); 308 308 if (it != this->players_.end()) 309 309 { 310 it->second.frags_+=20; 310 it->second.frags_+=20; //value must be tested 311 311 } 312 312 } … … 315 315 else return false; 316 316 } 317 317 318 318 void Dynamicmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) //set party + colouring 319 319 { 320 320 if (!player) 321 321 return; 322 323 Dynamicmatch::setPlayerColour(player); 322 323 Dynamicmatch::setPlayerColour(player); //Set playercolour 324 324 evaluatePlayerParties(); 325 325 } … … 329 329 if (!player)// only for safety 330 330 return; 331 playerParty_[player]=chaser; 331 playerParty_[player]=chaser; //Set playerparty 332 332 numberOf[chaser]++; 333 333 Gametype::playerEntered(player); … … 351 351 COUT(0) << message << std::endl; 352 352 Host::Broadcast(message); 353 353 //remove player from map 354 354 playerParty_.erase (player); 355 355 //adjust player parties 356 356 evaluatePlayerParties(); 357 357 } … … 376 376 { 377 377 this->gameEnded_ = true; 378 this->end(); 379 } 380 378 this->end(); 379 } 380 if ( gameTime_ <= timesequence_ && gameTime_ > 0) 381 381 { 382 382 const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!"; … … 397 397 } 398 398 } 399 399 } 400 400 } 401 401 … … 433 433 } 434 434 } 435 435 } 436 436 437 437 void Dynamicmatch::evaluatePlayerParties() //manages the notEnough booleans (here the percentage of special players is implemented) … … 483 483 } 484 484 } 485 485 486 486 } 487 487 } … … 532 532 } 533 533 } 534 534 535 535 } 536 536 537 537 } 538 538 //chasers: there are more chasers than killers + pigs … … 582 582 } 583 583 } 584 584 585 585 } 586 } 586 } 587 587 } 588 588 … … 614 614 } 615 615 616 void Dynamicmatch::start() 617 { 616 void Dynamicmatch::start() 617 { 618 618 Gametype::start(); 619 619 if(!tutorial) … … 632 632 } 633 633 } 634 } 634 } 635 635 636 636 /*void Dynamicmatch::instructions() -
code/branches/presentation3/src/orxonox/gametypes/Dynamicmatch.h
r7063 r7076 43 43 Dynamicmatch(BaseObject* creator); 44 44 virtual ~Dynamicmatch() {} 45 45 46 46 bool notEnoughPigs; 47 47 bool notEnoughKillers; 48 48 bool notEnoughChasers; 49 49 50 //three different parties 50 //three different parties 51 51 int chaser; 52 52 int piggy; … … 57 57 void setPlayerColour(PlayerInfo* player);//own function 58 58 void setConfigValues();//done 59 59 60 60 bool friendlyfire; //goal: player can switch it on/off 61 61 bool tutorial; //goal: new players recieve messages how the new gametype works - later it can be switched off. 62 62 63 63 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //ok - score function and management of parties 64 64 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //ok - simple … … 69 69 virtual bool playerLeft(PlayerInfo* player); 70 70 virtual bool playerChangedName(PlayerInfo* player);//unchanged 71 71 72 72 /*virtual void instructions(); 73 73 virtual void furtherInstructions();*/ 74 74 virtual void rewardPig(); 75 void resetSpeedFactor(WeakPtr<Engine>* ptr); 75 void resetSpeedFactor(WeakPtr<Engine>* ptr); 76 76 void tick (float dt);// used to end the game 77 77 SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const; 78 78 79 79 protected: 80 80
Note: See TracChangeset
for help on using the changeset viewer.