KiCad PCB EDA Suite
3d_cache.cpp File Reference
#include <fstream>
#include <iostream>
#include <iterator>
#include <mutex>
#include <sstream>
#include <utility>
#include <wx/datetime.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/stdpaths.h>
#include <boost/version.hpp>
#include <boost/uuid/sha1.hpp>
#include <glm/glm.hpp>
#include <glm/ext.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 <pgm_base.h>
#include <project.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)
 
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 62 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( NULL == aTag || NULL == aPluginMgrPtr )
81  return false;
82 
83  S3D_PLUGIN_MANAGER *pp = (S3D_PLUGIN_MANAGER*) aPluginMgrPtr;
84 
85  return pp->CheckTag( aTag );
86 }
#define NULL
bool CheckTag(const char *aTag)
Function CheckTag checks the given tag and returns true if the plugin named in the tag is not loaded ...

References S3D_PLUGIN_MANAGER::CheckTag(), and NULL.

Referenced by S3D_CACHE::loadCacheData().

◆ isSHA1Same()

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

Definition at line 68 of file 3d_cache.cpp.

69 {
70  for( int i = 0; i < 20; ++i )
71  if( shaA[i] != shaB[i] )
72  return false;
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 64 of file 3d_cache.cpp.

Referenced by S3D_CACHE::load().

◆ mutex3D_cacheManager

std::mutex mutex3D_cacheManager
static

Definition at line 65 of file 3d_cache.cpp.