21#ifndef TRIANGLE_DISPLAY_LIST_H
22#define TRIANGLE_DISPLAY_LIST_H
46 TRIANGLE_LIST(
unsigned int aNrReservedTriangles,
bool aReserveNormals );
51 void Reserve_More(
unsigned int aNrReservedTriangles,
bool aReserveNormals );
110 double aBiuTo3Du,
bool aInvertFaceDirection,
114 double aBiuTo3Du,
bool aInvertFaceDirection,
118 float zTop,
bool aInvertFaceDirection,
147 GLuint aTextureIndexForSegEnds,
float aZBot,
float aZTop );
182 void DrawAll(
bool aDrawMiddle =
true )
const;
192 void DrawCulled(
bool aDrawMiddle,
const std::shared_ptr<OPENGL_RENDER_LIST> aSubtractList =
nullptr,
193 const std::shared_ptr<OPENGL_RENDER_LIST> bSubtractList =
nullptr,
194 const std::shared_ptr<OPENGL_RENDER_LIST> cSubtractList =
nullptr,
195 const std::shared_ptr<OPENGL_RENDER_LIST> dSubtractList =
nullptr )
const;
209 bool aIsNormalUp, GLuint aTextureId )
const;
212 bool aIsNormalUp )
const;
245 float aZBot,
float aZTop,
bool aTransparent =
false ) :
258 std::lock_guard<std::recursive_mutex> lock(
m_mutex );
262 throw std::runtime_error(
"Both OpenGL render list and layer triangles are null" );
276 std::lock_guard<std::recursive_mutex> lock(
m_mutex );
284 std::lock_guard<std::recursive_mutex> lock(
m_mutex );
bool m_defaultTransparent
~OPENGL_RENDER_LIST_DEFERRED()
GLuint m_textureIndexForSegEnds
std::shared_ptr< OPENGL_RENDER_LIST > m_openglRenderList
OPENGL_RENDER_LIST_DEFERRED(std::shared_ptr< TRIANGLE_DISPLAY_LIST > aLayerTriangles, GLuint aTextureIndexForSegEnds, float aZBot, float aZTop, bool aTransparent=false)
std::shared_ptr< OPENGL_RENDER_LIST > MakeOrGet()
std::shared_ptr< TRIANGLE_DISPLAY_LIST > m_layerTriangles
std::recursive_mutex m_mutex
float m_zPositionTransformation
GLuint generate_middle_triangles(const TRIANGLE_LIST *aTriangleContainer) const
bool m_haveTransformation
bool m_draw_it_transparent
void ClearScalePosition()
void beginTransformation() const
void DrawMiddle() const
Call the display lists for the middle elements.
GLuint generate_top_or_bot_seg_ends(const TRIANGLE_LIST *aTriangleContainer, bool aIsNormalUp, GLuint aTextureId) const
GLuint m_layer_bot_segment_ends
void DrawTop() const
Call the display lists for the top elements.
GLuint m_layer_bot_triangles
GLuint m_layer_middle_contours_quads
void DrawCulled(bool aDrawMiddle, const std::shared_ptr< OPENGL_RENDER_LIST > aSubtractList=nullptr, const std::shared_ptr< OPENGL_RENDER_LIST > bSubtractList=nullptr, const std::shared_ptr< OPENGL_RENDER_LIST > cSubtractList=nullptr, const std::shared_ptr< OPENGL_RENDER_LIST > dSubtractList=nullptr) const
Draw all layers if they are visible by the camera if camera position is above the layer.
void DrawBot() const
Call the display lists for the bottom elements.
void ApplyScalePosition(float aZposition, float aZscale)
GLuint m_layer_top_triangles
GLuint generate_top_or_bot_triangles(const TRIANGLE_LIST *aTriangleContainer, bool aIsNormalUp) const
void setBlendfunction() const
void DrawBotAndMiddle() const
Call the display lists for the bottom elements and middle contours.
void SetItIsTransparent(bool aSetTransparent)
void endTransformation() const
~OPENGL_RENDER_LIST()
Destroy this class while free the display lists from GPU memory.
float m_zScaleTransformation
OPENGL_RENDER_LIST(const TRIANGLE_DISPLAY_LIST &aLayerTriangles, GLuint aTextureIndexForSegEnds, float aZBot, float aZTop)
Create the display lists for a layer.
GLuint m_layer_top_segment_ends
void DrawTopAndMiddle() const
Call the display lists for the top elements and middle contours.
void DrawAll(bool aDrawMiddle=true) const
Call to draw all the display lists.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
Store arrays of triangles to be used to create display lists.
TRIANGLE_LIST * m_layer_bot_segment_ends
void AddToMiddleContours(const SHAPE_LINE_CHAIN &outlinePath, float zBot, float zTop, double aBiuTo3Du, bool aInvertFaceDirection, const BVH_CONTAINER_2D *aThroughHoles=nullptr)
TRIANGLE_LIST * m_layer_middle_contours_quads
TRIANGLE_LIST * m_layer_top_segment_ends
TRIANGLE_LIST * m_layer_bot_triangles
TRIANGLE_DISPLAY_LIST(unsigned int aNrReservedTriangles)
Initialize arrays with reserved triangles.
TRIANGLE_LIST * m_layer_top_triangles
std::mutex m_middle_layer_lock
bool IsLayersSizeValid()
Check if the vertex arrays of the layers are as expected.
Container to manage a vector of triangles.
void AddTriangle(const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3)
const float * GetVertexPointer() const
Get the array of vertices.
std::vector< SFVEC3F > m_vertexs
vertex array
unsigned int GetNormalsSize() const
std::vector< SFVEC3F > m_normals
normals array
void AddQuad(const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3, const SFVEC3F &aV4)
void AddNormal(const SFVEC3F &aN1, const SFVEC3F &aN2, const SFVEC3F &aN3)
unsigned int GetVertexSize() const
const float * GetNormalsPointer() const
Get the array of normals.
TRIANGLE_LIST(unsigned int aNrReservedTriangles, bool aReserveNormals)
void Reserve_More(unsigned int aNrReservedTriangles, bool aReserveNormals)
Reserve more triangles.