- Prepare flow for multithreading support - Optimize memory access of vertices - More efficient back-face culling computation - Added option to disable gprof in Cmake
53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <SFML/Graphics/RenderTexture.hpp>
|
|
#include <SFML/System/Vector2.hpp>
|
|
|
|
#include "Camera.hpp"
|
|
#include "../Utils/MeshHelper.hpp"
|
|
#include "../World/WorldObject.hpp"
|
|
|
|
|
|
typedef enum eCameraMovementType {
|
|
CAMERA_MOVE_WALK,
|
|
CAMERA_MOVE_STRAFE,
|
|
CAMERA_MOVE_FLY,
|
|
CAMERA_MOVE_PITCH,
|
|
CAMERA_MOVE_YAW
|
|
} CAMERA_MOVE;
|
|
|
|
class Graphic3DRenderer final {
|
|
public:
|
|
Graphic3DRenderer();
|
|
~Graphic3DRenderer();
|
|
|
|
Graphic3DRenderer(Graphic3DRenderer&&) = default;
|
|
Graphic3DRenderer& operator= (Graphic3DRenderer&&) = default;
|
|
Graphic3DRenderer(Graphic3DRenderer const&) = delete;
|
|
Graphic3DRenderer& operator= (Graphic3DRenderer const&) = delete;
|
|
|
|
const sf::Vector2f& GetRTSize() const noexcept { return mRTSize; }
|
|
void SetRTSize(unsigned int w, unsigned int h);
|
|
|
|
void UpdateCamera(CAMERA_MOVE type, const float value);
|
|
void Draw(sf::RenderTexture& context);
|
|
|
|
// Debug datas
|
|
const unsigned int GetDrawTriCount() const noexcept { return drawnTriCount; }
|
|
|
|
private:
|
|
std::unique_ptr<Camera> mMainCamera; // Default player view
|
|
sf::Vector2f mRTSize;
|
|
|
|
std::vector<std::shared_ptr<WorldObject>> mWorldObjsList; // List of elements to be rendered next frame
|
|
|
|
void UpdateInternalTestObjects();
|
|
float ComputeSGRatio();
|
|
|
|
void DrawBackground(sf::RenderTexture& context);
|
|
void DrawSceneObjects(sf::RenderTexture& context);
|
|
|
|
// Debug datas
|
|
unsigned int drawnTriCount = 0;
|
|
|
|
}; |