34#include "../common_ogl/ogl_utils.h"
43 wxLogTrace(
m_logTrace, wxT(
"RENDER_3D_RAYTRACE_GL::RENDER_3D_RAYTRACE_GL" ) );
85 bool requestRedraw =
false;
106 if( aStatusReporter )
107 aStatusReporter->
Report(
_(
"Loading..." ) );
110 requestRedraw =
true;
111 Reload( aStatusReporter, aWarningReporter,
false );
120 requestRedraw =
true;
126 glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
127 glClearDepth( 1.0f );
128 glClearStencil( 0x00 );
129 glClear( GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
132 glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
134 glDisable( GL_STENCIL_TEST );
135 glDisable( GL_LIGHTING );
136 glDisable( GL_COLOR_MATERIAL );
137 glDisable( GL_DEPTH_TEST );
138 glDisable( GL_TEXTURE_2D );
139 glDisable( GL_BLEND );
140 glDisable( GL_MULTISAMPLE );
144 if( requestRedraw || aIsMoving || was_camera_changed )
149 if( aIsMoving || was_camera_changed )
159 glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
m_pboId );
162 uint8_t* ptrPBO = (uint8_t *)glMapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
170 glUnmapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB );
178 glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
m_pboId );
183 uint8_t* ptrPBO = (uint8_t *)glMapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
188 render( ptrPBO, aStatusReporter );
191 requestRedraw =
true;
194 glUnmapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB );
200 glClear( GL_COLOR_BUFFER_BIT );
208 glEnable( GL_BLEND );
209 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
210 glEnable( GL_ALPHA_TEST );
212 glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, 0 );
214 return requestRedraw;
220 if( GLEW_ARB_pixel_buffer_object )
236 glGenBuffersARB( 1, &
m_pboId );
237 glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
m_pboId );
238 glBufferDataARB( GL_PIXEL_UNPACK_BUFFER_ARB,
m_pboDataSize, 0, GL_STREAM_DRAW_ARB );
239 glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, 0 );
242 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.
std::unique_ptr< BUSY_INDICATOR > CreateBusyIndicator() const
Return a created busy indicator, if a factory has been set, else a null pointer.
bool m_canvasInitialized
Flag if the canvas specific for this render was already initialized.
wxSize m_windowSize
The window size that this camera is working.
BOARD_ADAPTER & m_boardAdapter
Settings reference in use for this render.
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
Used to see if the windows size changed.
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)