3#include <Engine/RaEngine.hpp>
12#include <Core/Utils/Color.hpp>
13#include <Core/Utils/Timer.hpp>
14#include <Engine/Data/DisplayableObject.hpp>
25struct ViewingParameters;
27class ShaderProgramManager;
38class RenderObjectManager;
86 Core::Vector2 m_screenCoords;
118 inline void reserve(
size_t s );
121 inline void removeDuplicatedIndices()
const;
126 inline void setRoIdx( Core::Utils::Index idx );
127 inline Core::Utils::Index getRoIdx()
const;
134 inline Scalar getDepth()
const;
135 inline void setDepth( Scalar depth );
139 PickingMode m_mode { Engine::Rendering::Renderer::RO };
141 Core::Utils::Index m_roIdx { Core::Utils::Index::Invalid() };
166 inline const TimerData& getTimerData()
const;
177 inline void lockRendering();
182 inline void unlockRendering();
187 inline void toggleWireframe();
193 inline void enableWireframe(
bool enabled );
198 inline void toggleDrawDebug();
204 inline void enableDebugDraw(
bool enabled );
210 inline void enablePostProcess(
bool enabled );
237 void initialize( uint width, uint height );
248 void resize( uint width, uint height );
254 inline void addPickingRequest(
const PickingQuery& query );
272 inline void setMousePosition(
const Core::Vector2& pos );
274 inline void setBrushRadius( Scalar brushRadius );
277 bool hasLight()
const;
295 virtual void reloadShaders();
308 virtual void displayTexture(
const std::string& texName );
334 int buildAllRenderTechniques()
const;
403 void saveExternalFBOInternal();
404 void restoreExternalFBOInternal();
423 void drawScreenInternal();
426 void notifyRenderObjectsRenderingInternal();
442 RenderObjectManager* m_renderObjectManager {
nullptr };
457 bool m_renderQueuesUpToDate {
false };
467 bool m_drawDebug {
true };
468 bool m_wireframe {
false };
469 bool m_postProcessEnabled {
true };
486 Ra::Core::Vector2 m_mousePosition;
487 float m_brushRadius { 0 };
491 static const int NoPickingRenderMode = Data::Displayable::PickingRenderMode::NO_PICKING;
505 bool m_initialized {
false };
517 m_indices.reserve( s );
521 std::sort( m_indices.begin(), m_indices.end() );
522 m_indices.erase(
std::unique( m_indices.begin(), m_indices.end() ), m_indices.end() );
527 m_roIdx = Core::Utils::Index::Invalid();
531inline void Renderer::PickingResult::setRoIdx( Core::Utils::Index idx ) {
535inline Core::Utils::Index Renderer::PickingResult::getRoIdx()
const {
551inline void Renderer::PickingResult::setDepth( Scalar depth ) {
564 m_renderMutex.
lock();
572 m_wireframe = !m_wireframe;
576 m_wireframe = enabled;
580 m_drawDebug = !m_drawDebug;
584 m_drawDebug = enabled;
588 m_postProcessEnabled = enabled;
592 m_pickingQueries.push_back( query );
596 return m_pickingResults;
600 return m_lastFramePickingQueries;
603inline void Renderer::setMousePosition(
const Core::Vector2& pos ) {
604 m_mousePosition[0] = pos[0];
605 m_mousePosition[1] = m_height - pos[1];
608inline void Renderer::setBrushRadius( Scalar brushRadius ) {
609 m_brushRadius = brushRadius;
613 m_backgroundColor = color;
617 return m_backgroundColor;
Represent a Texture of the engine.
Result of a PickingQuery.
void addIndex(const std::tuple< int, int, int > &idx)
Add new ids to the result.
void clear()
Reset query to default.
void reserve(size_t s)
Reserve size of ids container.
const std::vector< std::tuple< int, int, int > > & getIndices() const
Read access to the collected ids.
void removeDuplicatedIndices() const
Remove duplicates in m_indices.
const TimerData & getTimerData() const
void addPickingRequest(const PickingQuery &query)
virtual std::string getRendererName() const =0
Get the name of the renderer, e.g to be displayed in the UI.
virtual void debugInternal(const Data::ViewingParameters &renderData)=0
Add the debug layer with useful informations.
void enableDebugDraw(bool enabled)
void enablePostProcess(bool enabled)
std::vector< Ra::Engine::Scene::LightManager * > m_lightmanagers
virtual void postProcessInternal(const Data::ViewingParameters &renderData)=0
Do all post processing stuff. If you override this method, be careful to fill.
Data::Texture * getDisplayTexture() const
virtual bool buildRenderTechnique(RenderObject *ro) const =0
std::unique_ptr< Data::Texture > m_fancyTexture
Final color texture : might be attached to the main framebuffer.
void setBackgroundColor(const Core::Utils::Color &color)
Update the background color (does not trigger a redraw)
Data::Texture * m_displayedTexture
The texture that will be displayed on screen. If no call to.
@ C_VERTEX
Picks all vertices of a mesh within a screen space circle.
@ C_TRIANGLE
Picks all triangles of a mesh within a screen space circle.
@ C_EDGE
Picks all edges of a mesh within a screen space circle.
@ TRIANGLE
Pick a triangle of a mesh.
@ EDGE
Pick an edge of a mesh.
@ VERTEX
Pick a vertex of a mesh.
virtual void initializeInternal()=0
initializeInternal Initialize the renderer dependant resources.
const std::vector< PickingResult > & getPickingResults() const
virtual void uiInternal(const Data::ViewingParameters &renderData)=0
Draw the UI data.
std::map< std::string, Data::Texture * > m_secondaryTextures
Textures exposed in the texture section box to be displayed.
std::unique_ptr< Data::Texture > m_depthTexture
Depth texture : might be attached to the main framebuffer.
virtual void updateStepInternal(const Data::ViewingParameters &renderData)=0
const std::vector< PickingQuery > & getPickingQueries() const
virtual void resizeInternal()=0
void enableWireframe(bool enabled)
virtual void renderInternal(const Data::ViewingParameters &renderData)=0
All the scene rendering magics basically happens here.
hepler function to manage enum as underlying types in VariableSet
the set of viewing parameters extracted from the camera and given to the renderer