Advertisement
iMackshun

Render Function

Jan 16th, 2019
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.72 KB | None | 0 0
  1. //Called once per frame, containing the time since the last frame, or delta time.
  2. void GraphicsTestScreen3D::Render(float delta)
  3. {
  4.     //Handle the controls.
  5.     CheckControls();
  6.     //Render everything.
  7.     C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
  8.     //Clear the screen.
  9.     C3D_RenderTargetClear(topRenderTarget, C3D_CLEAR_ALL, CLEAR_COLOR, 0);
  10.     //Set the target for drawing on.
  11.     C3D_FrameDrawOn(topRenderTarget);
  12.     //Update the camera.
  13.     perspectiveCamera.Update();
  14.     //Draw All of the 3D elements.
  15.     _yuModel.Render(delta, &perspectiveCamera);
  16.     //Draw armature, if possible.
  17.     _yuModel.RenderArmature(&perspectiveCamera);
  18.     //Update the camera.
  19.     orthographicCamera.Update();
  20.     //Draw all of the 2D elements.
  21.     _spriteBatch.Begin();
  22.     if (_enableUI){
  23.         //Update the strings of some text.
  24.         _fpsLabel._labelText = "FPS: " + std::to_string(_displayManager->_frameRate);
  25.         _fpsLabel.GenerateSprites();
  26.         if (_yuModel._animationManager._enabled){
  27.             _animationFrameLabel._labelText = "Frame: " + std::to_string(_yuModel._animationManager._animations.at(_yuModel._animationManager._currentAnimationIndex).currentFrame);
  28.             _animationFrameLabel.GenerateSprites();
  29.         }
  30.         //Draw all of the sprites.
  31.         _fpsLabel.AddToBatch(&_spriteBatch);
  32.         _vertexCountLabel.AddToBatch(&_spriteBatch);
  33.         _faceCountLabel.AddToBatch(&_spriteBatch);
  34.         _materialCountLabel.AddToBatch(&_spriteBatch);
  35.         _boneCountLabel.AddToBatch(&_spriteBatch);
  36.         _selectedAnimationLabel.AddToBatch(&_spriteBatch);
  37.         _cameraMovementLabel.AddToBatch(&_spriteBatch);
  38.         _animationChangeLabel.AddToBatch(&_spriteBatch);
  39.         _animationFrameLabel.AddToBatch(&_spriteBatch);
  40.         _uiDisableLabel.AddToBatch(&_spriteBatch);
  41.         _exitLabel.AddToBatch(&_spriteBatch);
  42.     }
  43.     _spriteBatch.End();
  44.     C3D_FrameEnd(0);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement