KiCad PCB EDA Suite
3d_cache.cpp File Reference
#include <mutex>
#include <utility>
#include <wx/datetime.h>
#include <wx/dir.h>
#include <wx/log.h>
#include <wx/stdpaths.h>
#include <boost/version.hpp>
#include <boost/uuid/sha1.hpp>
#include "3d_cache.h"
#include "3d_info.h"
#include "3d_plugin_manager.h"
#include "sg/scenegraph.h"
#include "plugins/3dapi/ifsg_api.h"
#include <advanced_config.h>
#include <common.h>
#include <filename_resolver.h>
#include <paths.h>
#include <pgm_base.h>
#include <project.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <wx_filename.h>

Go to the source code of this file.

Classes

class  S3D_CACHE_ENTRY
 

Macros

#define GLM_FORCE_RADIANS
 
#define MASK_3D_CACHE   "3D_CACHE"
 

Functions

static bool isSHA1Same (const unsigned char *shaA, const unsigned char *shaB) noexcept
 
static bool checkTag (const char *aTag, void *aPluginMgrPtr)
 
static const wxString sha1ToWXString (const unsigned char *aSHA1Sum)
 

Variables

static std::mutex mutex3D_cache
 
static std::mutex mutex3D_cacheManager
 

Macro Definition Documentation

◆ GLM_FORCE_RADIANS

#define GLM_FORCE_RADIANS

Definition at line 25 of file 3d_cache.cpp.

◆ MASK_3D_CACHE

#define MASK_3D_CACHE   "3D_CACHE"

Definition at line 60 of file 3d_cache.cpp.

Function Documentation

◆ checkTag()

static bool checkTag ( const char *  aTag,
void *  aPluginMgrPtr 
)
static

Definition at line 78 of file 3d_cache.cpp.

79{
80 if( nullptr == aTag || nullptr == aPluginMgrPtr )
81 return false;
82
83 S3D_PLUGIN_MANAGER *pp = (S3D_PLUGIN_MANAGER*) aPluginMgrPtr;
84
85 return pp->CheckTag( aTag );
86}
bool CheckTag(const char *aTag)
Check the given tag and returns true if the plugin named in the tag is not loaded or the plugin is lo...

References S3D_PLUGIN_MANAGER::CheckTag().

Referenced by S3D_CACHE::loadCacheData().

◆ isSHA1Same()

static bool isSHA1Same ( const unsigned char *  shaA,
const unsigned char *  shaB 
)
staticnoexcept

Definition at line 66 of file 3d_cache.cpp.

67{
68 for( int i = 0; i < 20; ++i )
69 {
70 if( shaA[i] != shaB[i] )
71 return false;
72 }
73
74 return true;
75}

Referenced by S3D_CACHE::load().

◆ sha1ToWXString()

static const wxString sha1ToWXString ( const unsigned char *  aSHA1Sum)
static

Definition at line 89 of file 3d_cache.cpp.

90{
91 unsigned char uc;
92 unsigned char tmp;
93 char sha1[41];
94 int j = 0;
95
96 for( int i = 0; i < 20; ++i )
97 {
98 uc = aSHA1Sum[i];
99 tmp = uc / 16;
100
101 if( tmp > 9 )
102 tmp += 87;
103 else
104 tmp += 48;
105
106 sha1[j++] = tmp;
107 tmp = uc % 16;
108
109 if( tmp > 9 )
110 tmp += 87;
111 else
112 tmp += 48;
113
114 sha1[j++] = tmp;
115 }
116
117 sha1[j] = 0;
118
119 return wxString::FromUTF8Unchecked( sha1 );
120}

Referenced by S3D_CACHE_ENTRY::GetCacheBaseName().

Variable Documentation

◆ mutex3D_cache

std::mutex mutex3D_cache
static

Definition at line 62 of file 3d_cache.cpp.

Referenced by S3D_CACHE::load().

◆ mutex3D_cacheManager

std::mutex mutex3D_cacheManager
static

Definition at line 63 of file 3d_cache.cpp.