KiCad PCB EDA Suite
Loading...
Searching...
No Matches
render_3d_opengl.cpp File Reference
#include <cstdint>
#include <gal/opengl/kiglew.h>
#include "plugins/3dapi/xv3d_types.h"
#include "render_3d_opengl.h"
#include "opengl_utils.h"
#include "common_ogl/ogl_utils.h"
#include <board.h>
#include <footprint.h>
#include <gal/opengl/gl_context_mgr.h>
#include <3d_math.h>
#include <glm/geometric.hpp>
#include <lset.h>
#include <pgm_base.h>
#include <math/util.h>
#include <utility>
#include <vector>
#include <wx/log.h>
#include <base_units.h>
#include <glm/gtc/type_ptr.hpp>

Go to the source code of this file.

Macros

#define UNITS3D_TO_UNITSPCB   ( pcbIUScale.IU_PER_MM )
 Scale conversion from 3d model units to pcb units.
 
#define DELETE_AND_FREE(ptr)
 
#define DELETE_AND_FREE_MAP(map)
 

Functions

static float TransparencyControl (float aGrayColorValue, float aTransparency)
 Attempt to control the transparency based on the gray value of the color.
 
void init_lights ()
 
static SFVEC4F premultiplyAlpha (const SFVEC4F &aInput)
 

Macro Definition Documentation

◆ DELETE_AND_FREE

#define DELETE_AND_FREE ( ptr)
Value:
{ \
delete ptr; \
ptr = nullptr; \
} \

◆ DELETE_AND_FREE_MAP

#define DELETE_AND_FREE_MAP ( map)
Value:
{ \
for( auto& [ layer, ptr ] : map ) \
delete ptr; \
\
map.clear(); \
}

◆ UNITS3D_TO_UNITSPCB

#define UNITS3D_TO_UNITSPCB   ( pcbIUScale.IU_PER_MM )

Scale conversion from 3d model units to pcb units.

Definition at line 74 of file render_3d_opengl.cpp.

Function Documentation

◆ init_lights()

void init_lights ( )

Definition at line 435 of file render_3d_opengl.cpp.

References SphericalToCartesian().

Referenced by RENDER_3D_OPENGL::initializeOpenGL().

◆ premultiplyAlpha()

static SFVEC4F premultiplyAlpha ( const SFVEC4F & aInput)
inlinestatic

Definition at line 539 of file render_3d_opengl.cpp.

Referenced by RENDER_3D_OPENGL::Redraw().

◆ TransparencyControl()

static float TransparencyControl ( float aGrayColorValue,
float aTransparency )
static

Attempt to control the transparency based on the gray value of the color.

This function applies a non-linear transformation that makes darker colors more opaque, preventing copper show-through on dark solder masks like black.

Parameters
aGrayColorValue- diffuse gray value (0.0 to 1.0)
aTransparency- base transparency value (0.0 opaque to 1.0 transparent)
Returns
transparency to use in material

Definition at line 58 of file render_3d_opengl.cpp.

Referenced by RENDER_3D_OPENGL::setLayerMaterial(), and RENDER_3D_RAYTRACE_BASE::setupMaterials().