source: trunk/src/lib/assimp.cc @ 331

Last change on this file since 331 was 319, checked in by epyon, 11 years ago
  • created core module and moved all free source files there
  • took the opportunity to update all copyright lines and minor cleanup
  • minor fixes
  • not all examples are up to date
File size: 1.2 KB
Line 
1// Copyright (C) 2014 ChaosForge Ltd
2// http://chaosforge.org/
3//
4// This file is part of NV Libraries.
5// For conditions of distribution and use, see copyright notice in nv.hh
6
7#include "nv/lib/assimp.hh"
8
9nv::assimp_log_guard::assimp_log_guard()
10{
11        aiLogStream ls = aiGetPredefinedLogStream( aiDefaultLogStream_FILE, "assimp_log.txt" );
12        aiAttachLogStream(&ls);
13        ls.callback = assimp_log_callback;
14        ls.user     = nullptr;
15        aiAttachLogStream(&ls);
16}
17
18nv::assimp_log_guard::~assimp_log_guard()
19{
20        aiDetachAllLogStreams();
21}
22
23#if defined( NV_ASSIMP_DYNAMIC )
24
25#include "nv/core/library.hh"
26
27#define NV_ASSIMP_FUN( rtype, fname, fparams ) rtype (NV_ASSIMP_APIENTRY *fname) fparams = nullptr;
28#include <nv/lib/detail/assimp_functions.inc>
29#undef NV_ASSIMP_FUN
30
31bool nv::load_assimp_library( const char* path )
32{
33        static nv::library assimp_library;
34        if ( assimp_library.is_open() ) return true;
35        assimp_library.open( path );
36
37#       define NV_ASSIMP_FUN( rtype, fname, fparams ) *(void **) (&fname) = assimp_library.get(#fname);
38#       include <nv/lib/detail/assimp_functions.inc>
39#       undef NV_ASSIMP_FUN
40
41        static nv::assimp_log_guard lg;
42        return true;
43}
44#endif
Note: See TracBrowser for help on using the repository browser.