KiCad PCB EDA Suite
3d_cache.cpp File Reference
#include <mutex>
#include <utility>
#include <wx/datetime.h>
#include <wx/dir.h>
#include <wx/filename.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 <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>

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 59 of file 3d_cache.cpp.

Function Documentation

◆ checkTag()

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

Definition at line 77 of file 3d_cache.cpp.

78 {
79  if( nullptr == aTag || nullptr == aPluginMgrPtr )
80  return false;
81 
82  S3D_PLUGIN_MANAGER *pp = (S3D_PLUGIN_MANAGER*) aPluginMgrPtr;
83 
84  return pp->CheckTag( aTag );
85 }
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 65 of file 3d_cache.cpp.

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

Referenced by S3D_CACHE::load().

◆ sha1ToWXString()

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

Definition at line 88 of file 3d_cache.cpp.

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

Referenced by S3D_CACHE_ENTRY::GetCacheBaseName().

Variable Documentation

◆ mutex3D_cache

std::mutex mutex3D_cache
static

Definition at line 61 of file 3d_cache.cpp.

Referenced by S3D_CACHE::load().

◆ mutex3D_cacheManager

std::mutex mutex3D_cacheManager
static

Definition at line 62 of file 3d_cache.cpp.