34#include "../common_ogl/ogl_utils.h"
42 wxLogTrace(
m_logTrace, wxT(
"RENDER_3D_RAYTRACE_GL::RENDER_3D_RAYTRACE_GL" ) );
84 bool requestRedraw =
false;
105 if( aStatusReporter )
106 aStatusReporter->
Report(
_(
"Loading..." ) );
109 requestRedraw =
true;
110 Reload( aStatusReporter, aWarningReporter,
false );
119 requestRedraw =
true;
125 glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
126 glClearDepth( 1.0f );
127 glClearStencil( 0x00 );
128 glClear( GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
131 glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
133 glDisable( GL_STENCIL_TEST );
134 glDisable( GL_LIGHTING );
135 glDisable( GL_COLOR_MATERIAL );
136 glDisable( GL_DEPTH_TEST );
137 glDisable( GL_TEXTURE_2D );
138 glDisable( GL_BLEND );
139 glDisable( GL_MULTISAMPLE );
143 if( requestRedraw || aIsMoving || was_camera_changed )
148 if( aIsMoving || was_camera_changed )
158 glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
m_pboId );
161 uint8_t* ptrPBO = (uint8_t *)glMapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
169 glUnmapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB );
177 glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
m_pboId );
182 uint8_t* ptrPBO = (uint8_t *)glMapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
187 render( ptrPBO, aStatusReporter );
190 requestRedraw =
true;
193 glUnmapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB );
199 glClear( GL_COLOR_BUFFER_BIT );
207 glEnable( GL_BLEND );
208 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
209 glEnable( GL_ALPHA_TEST );
211 glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, 0 );
213 return requestRedraw;
219 if( GLEW_ARB_pixel_buffer_object )
235 glGenBuffersARB( 1, &
m_pboId );
236 glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
m_pboId );
237 glBufferDataARB( GL_PIXEL_UNPACK_BUFFER_ARB,
m_pboDataSize, 0, GL_STREAM_DRAW_ARB );
238 glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, 0 );
241 wxT(
"RENDER_3D_RAYTRACE_GL:: GLEW_ARB_pixel_buffer_object is supported" ) );
Helper class to handle information needed to display 3D board.
SFVEC4F m_BgColorTop
background top color
SFVEC4F m_BgColorBot
background bottom color
A class used to derive camera objects from.
const SFVEC3F & GetDir() const
void SetDirection(const SFVEC3F &aDir)
Set directional light orientation.
Implement a canvas based on a wxGLCanvas.
CAMERA & m_camera
Flag if the canvas specific for this render was already initialized.
std::unique_ptr< BUSY_INDICATOR > CreateBusyIndicator() const
Return a created busy indicator, if a factory has been set, else a null pointer.
bool m_reloadRequested
The window size that this camera is working.
BOARD_ADAPTER & m_boardAdapter
static SFVEC4F premultiplyAlpha(const SFVEC4F &aInput)
void Reload(REPORTER *aStatusReporter, REPORTER *aWarningReporter, bool aOnlyLoadCopperAndShapes)
void render(uint8_t *ptrPBO, REPORTER *aStatusReporter)
DIRECTIONAL_LIGHT * m_cameraLight
RT_RENDER_STATE m_renderState
State used on quality render.
wxSize m_oldWindowsSize
Encode Morton code positions.
void renderPreview(uint8_t *ptrPBO)
void initializeBlockPositions()
SFVEC2UI m_realBufferSize
RENDER_3D_RAYTRACE_GL(EDA_3D_CANVAS *aCanvas, BOARD_ADAPTER &aAdapter, CAMERA &aCamera)
bool Redraw(bool aIsMoving, REPORTER *aStatusReporter, REPORTER *aWarningReporter) override
Redraw the view.
void deletePbo() override
void SetCurWindowSize(const wxSize &aSize) override
Before each render, the canvas will tell the render what is the size of its windows,...
bool m_openglSupportsVertexBufferObjects
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
void OglDrawBackground(const SFVEC4F &aTopColor, const SFVEC4F &aBotColor)