23 changed files with 457 additions and 406 deletions
-
43d-viewer/3d_cache/3d_plugin_manager.cpp
-
693d-viewer/3d_cache/sg/CMakeLists.txt
-
203d-viewer/3d_cache/sg/ifsg_api.cpp
-
403d-viewer/3d_cache/sg/sg_version.h
-
43d-viewer/CMakeLists.txt
-
21CMakeLists.txt
-
10include/plugins/3d/3d_plugin.h
-
3include/plugins/3dapi/ifsg_api.h
-
1include/plugins/3dapi/ifsg_colors.h
-
8include/plugins/kicad_plugin.h
-
3plugins/3d/CMakeLists.txt
-
19plugins/3d/demo/CMakeLists.txt
-
181plugins/3d/demo/s3d_plugin_demo1.cpp
-
120plugins/3d/demo/s3d_plugin_demo2.cpp
-
23plugins/3d/dummy/CMakeLists.txt
-
136plugins/3d/dummy/s3d_plugin_dummy.cpp
-
18plugins/3d/idf/CMakeLists.txt
-
34plugins/3d/idf/s3d_plugin_idf.cpp
-
23plugins/3d/tetra/CMakeLists.txt
-
60plugins/3d/tetra/s3d_plugin_tetra.h
-
18plugins/ldr/3d/pluginldr3D.cpp
-
40plugins/ldr/pluginldr.cpp
-
8plugins/ldr/pluginldr.h
@ -1,3 +1,2 @@ |
|||
#add_subdirectory( dummy ) |
|||
#add_subdirectory( tetra ) |
|||
add_subdirectory( demo ) |
|||
add_subdirectory( idf ) |
|||
@ -0,0 +1,19 @@ |
|||
add_library( s3d_plugin_demo1 MODULE |
|||
s3d_plugin_demo1.cpp |
|||
) |
|||
|
|||
target_link_libraries( s3d_plugin_demo1 ${wxWidgets_LIBRARIES} ) |
|||
|
|||
|
|||
add_library( s3d_plugin_demo2 MODULE |
|||
s3d_plugin_demo2.cpp |
|||
) |
|||
|
|||
target_link_libraries( s3d_plugin_demo2 kicad_3dsg ${wxWidgets_LIBRARIES} ) |
|||
|
|||
install( TARGETS |
|||
s3d_plugin_demo1 |
|||
s3d_plugin_demo2 |
|||
DESTINATION ${KICAD_USER_PLUGIN}/3d |
|||
COMPONENT binary |
|||
) |
|||
@ -0,0 +1,181 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com> |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
/*
|
|||
* NOTES: |
|||
* |
|||
* 1. Notice that the plugin class is instantiated as a static; this |
|||
* ensures that it created an destroyed. |
|||
*/ |
|||
|
|||
#include <iostream>
|
|||
#include "plugins/3d/3d_plugin.h"
|
|||
|
|||
#define PLUGIN_3D_DEMO1_MAJOR 1
|
|||
#define PLUGIN_3D_DEMO1_MINOR 0
|
|||
#define PLUGIN_3D_DEMO1_PATCH 0
|
|||
#define PLUGIN_3D_DEMO1_REVNO 0
|
|||
|
|||
|
|||
const char* GetKicadPluginName( void ) |
|||
{ |
|||
return "PLUGIN_3D_DEMO1"; |
|||
} |
|||
|
|||
|
|||
void GetVersion( unsigned char* Major, unsigned char* Minor, |
|||
unsigned char* Patch, unsigned char* Revision ) |
|||
{ |
|||
if( Major ) |
|||
*Major = PLUGIN_3D_DEMO1_MAJOR; |
|||
|
|||
if( Minor ) |
|||
*Minor = PLUGIN_3D_DEMO1_MINOR; |
|||
|
|||
if( Patch ) |
|||
*Patch = PLUGIN_3D_DEMO1_PATCH; |
|||
|
|||
if( Revision ) |
|||
*Revision = PLUGIN_3D_DEMO1_REVNO; |
|||
|
|||
return; |
|||
} |
|||
|
|||
// number of extensions supported
|
|||
#ifdef _WIN32
|
|||
#define NEXTS 7
|
|||
#else
|
|||
#define NEXTS 14
|
|||
#endif
|
|||
|
|||
// number of filter sets supported
|
|||
#define NFILS 5
|
|||
|
|||
static char ext0[] = "wrl"; |
|||
static char ext1[] = "x3d"; |
|||
static char ext2[] = "emn"; |
|||
static char ext3[] = "iges"; |
|||
static char ext4[] = "igs"; |
|||
static char ext5[] = "stp"; |
|||
static char ext6[] = "step"; |
|||
|
|||
#ifdef _WIN32
|
|||
static char fil0[] = "VRML 1.0/2.0 (*.wrl)|*.wrl"; |
|||
static char fil1[] = "X3D (*.x3d)|*.x3d"; |
|||
static char fil2[] = "IDF 2.0/3.0 (*.emn)|*.emn"; |
|||
static char fil3[] = "IGESv5.3 (*.igs;*.iges)|*.igs;*.iges"; |
|||
static char fil4[] = "STEP (*.stp;*.step)|*.stp;*.step"; |
|||
#else
|
|||
static char ext7[] = "WRL"; |
|||
static char ext8[] = "X3D"; |
|||
static char ext9[] = "EMN"; |
|||
static char ext10[] = "IGES"; |
|||
static char ext11[] = "IGS"; |
|||
static char ext12[] = "STP"; |
|||
static char ext13[] = "STEP"; |
|||
|
|||
static char fil0[] = "VRML 1.0/2.0 (*.wrl;*.WRL)|*.wrl;*.WRL"; |
|||
static char fil1[] = "X3D (*.x3d;*.X3D)|*.x3d;*.X3D"; |
|||
static char fil2[] = "IDF 2.0/3.0 (*.emn;*.EMN)|*.emn;*.EMN"; |
|||
static char fil3[] = "IGESv5.3 (*.igs;*.iges;*.IGS;*.IGES)|*.igs;*.iges;*.IGS;*.IGES"; |
|||
static char fil4[] = "STEP (*.stp;*.step;*.STP;*.STEP)|*.stp;*.step;*.STP;*.STEP"; |
|||
#endif
|
|||
|
|||
|
|||
static struct FILE_DATA |
|||
{ |
|||
char const* extensions[NEXTS]; |
|||
char const* filters[NFILS]; |
|||
|
|||
FILE_DATA() |
|||
{ |
|||
extensions[0] = ext0; |
|||
extensions[1] = ext1; |
|||
extensions[2] = ext2; |
|||
extensions[3] = ext3; |
|||
extensions[4] = ext4; |
|||
extensions[5] = ext5; |
|||
extensions[6] = ext6; |
|||
filters[0] = fil0; |
|||
filters[1] = fil1; |
|||
filters[2] = fil2; |
|||
filters[3] = fil3; |
|||
filters[4] = fil4; |
|||
|
|||
#ifndef _WIN32
|
|||
extensions[7] = ext7; |
|||
extensions[8] = ext8; |
|||
extensions[9] = ext9; |
|||
extensions[10] = ext10; |
|||
extensions[11] = ext11; |
|||
extensions[12] = ext12; |
|||
extensions[13] = ext13; |
|||
#endif
|
|||
return; |
|||
} |
|||
|
|||
} file_data; |
|||
|
|||
|
|||
int GetNExtensions( void ) |
|||
{ |
|||
return NEXTS; |
|||
} |
|||
|
|||
|
|||
char const* GetModelExtension( int aIndex ) |
|||
{ |
|||
if( aIndex < 0 || aIndex >= NEXTS ) |
|||
return NULL; |
|||
|
|||
return file_data.extensions[aIndex]; |
|||
} |
|||
|
|||
|
|||
int GetNFilters( void ) |
|||
{ |
|||
return NFILS; |
|||
} |
|||
|
|||
|
|||
char const* GetFileFilter( int aIndex ) |
|||
{ |
|||
if( aIndex < 0 || aIndex >= NFILS ) |
|||
return NULL; |
|||
|
|||
return file_data.filters[aIndex]; |
|||
} |
|||
|
|||
|
|||
bool CanRender( void ) |
|||
{ |
|||
// this dummy plugin does not support rendering of any models
|
|||
return false; |
|||
} |
|||
|
|||
|
|||
SCENEGRAPH* Load( char const* aFileName ) |
|||
{ |
|||
// this dummy plugin does not support rendering of any models
|
|||
return NULL; |
|||
} |
|||
@ -1,23 +0,0 @@ |
|||
include_directories( |
|||
${CMAKE_CURRENT_SOURCE_DIR} |
|||
) |
|||
|
|||
add_library( s3d_plugin_dummy MODULE |
|||
s3d_plugin_dummy.cpp |
|||
) |
|||
|
|||
target_link_libraries( s3d_plugin_dummy ${wxWidgets_LIBRARIES} ) |
|||
|
|||
if( APPLE ) |
|||
install( TARGETS |
|||
s3d_plugin_dummy |
|||
DESTINATION /Applications/kicad.app/SharedSupport/plugins/3d |
|||
COMPONENT binary |
|||
) |
|||
else() |
|||
install( TARGETS |
|||
s3d_plugin_dummy |
|||
DESTINATION lib/kicad/plugins/3d |
|||
COMPONENT binary |
|||
) |
|||
endif() |
|||
@ -1,136 +0,0 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com> |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
/*
|
|||
* NOTES: |
|||
* |
|||
* 1. Notice that the plugin class is instantiated as a static; this |
|||
* ensures that it created an destroyed. |
|||
*/ |
|||
|
|||
#include <iostream>
|
|||
#include <s3d_plugin_dummy.h>
|
|||
|
|||
|
|||
S3D_PLUGIN_DUMMY::S3D_PLUGIN_DUMMY() |
|||
{ |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "wrl" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "x3d" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "idf" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "iges" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "igs" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "stp" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "step" ) ); |
|||
|
|||
#ifdef _WIN32
|
|||
// assume a case-insensitive file system
|
|||
m_filters.push_back( wxT( "VRML 1.0/2.0 (*.wrl)|*.wrl" ) ); |
|||
m_filters.push_back( wxT( "X3D (*.x3d)|*.x3d" ) ); |
|||
m_filters.push_back( wxT( "IDF 2.0/3.0 (*.idf)|*.idf" ) ); |
|||
m_filters.push_back( wxT( "IGESv5.3 (*.igs;*.iges)|*.igs;*.iges" ) ); |
|||
m_filters.push_back( wxT( "STEP (*.stp;*.step)|*.stp;*.step" ) ); |
|||
#else
|
|||
// assume the filesystem is case sensitive
|
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "WRL" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "X3D" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "IDF" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "IGES" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "IGS" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "STP" ) ); |
|||
m_extensions.push_back( wxString::FromUTF8Unchecked( "STEP" ) ); |
|||
|
|||
m_filters.push_back( wxT( "VRML 1.0/2.0 (*.wrl;*.WRL)|*.wrl;*.WRL" ) ); |
|||
m_filters.push_back( wxT( "X3D (*.x3d;*.X3D)|*.x3d;*.X3D" ) ); |
|||
m_filters.push_back( wxT( "IDF 2.0/3.0 (*.idf;*.IDF)|*.idf;*.IDF" ) ); |
|||
m_filters.push_back( wxT( "IGESv5.3 (*.igs;*.iges;*.IGS;*.IGES)|*.igs;*.iges;*.IGS;*.IGES" ) ); |
|||
m_filters.push_back( wxT( "STEP (*.stp;*.step;*.STP;*.STEP)|*.stp;*.step;*.STP;*.STEP" ) ); |
|||
#endif
|
|||
|
|||
|
|||
return; |
|||
} |
|||
|
|||
|
|||
S3D_PLUGIN_DUMMY::~S3D_PLUGIN_DUMMY() |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
|
|||
int S3D_PLUGIN_DUMMY::GetNExtensions( void ) const |
|||
{ |
|||
return (int) m_extensions.size(); |
|||
} |
|||
|
|||
|
|||
const wxString S3D_PLUGIN_DUMMY::GetModelExtension( int aIndex ) const |
|||
{ |
|||
if( aIndex < 0 || aIndex >= (int) m_extensions.size() ) |
|||
return wxString( "" ); |
|||
|
|||
return m_extensions[aIndex]; |
|||
} |
|||
|
|||
|
|||
int S3D_PLUGIN_DUMMY::GetNFilters( void ) const |
|||
{ |
|||
return (int)m_filters.size(); |
|||
} |
|||
|
|||
|
|||
const wxString S3D_PLUGIN_DUMMY::GetFileFilter( int aIndex ) const |
|||
{ |
|||
if( aIndex < 0 || aIndex >= (int)m_filters.size() ) |
|||
return wxEmptyString; |
|||
|
|||
return m_filters[aIndex]; |
|||
} |
|||
|
|||
|
|||
bool S3D_PLUGIN_DUMMY::CanRender( void ) const |
|||
{ |
|||
// this dummy plugin does not support rendering of any models
|
|||
return false; |
|||
} |
|||
|
|||
|
|||
SCENEGRAPH* S3D_PLUGIN_DUMMY::Load( const wxString& aFileName ) |
|||
{ |
|||
// this dummy plugin does not support rendering of any models
|
|||
return NULL; |
|||
} |
|||
|
|||
|
|||
static S3D_PLUGIN_DUMMY dummy; |
|||
|
|||
#ifndef _WIN32
|
|||
extern "C" __attribute__((__visibility__("default"))) S3D_PLUGIN* Get3DPlugin( void ) |
|||
{ |
|||
return &dummy; |
|||
} |
|||
#else
|
|||
extern "C" __declspec( dllexport ) S3D_PLUGIN* Get3DPlugin( void ) |
|||
{ |
|||
return &dummy; |
|||
} |
|||
#endif
|
|||
@ -1,23 +0,0 @@ |
|||
include_directories( |
|||
${CMAKE_CURRENT_SOURCE_DIR} |
|||
) |
|||
|
|||
add_library( s3d_plugin_tetra MODULE |
|||
s3d_plugin_tetra.cpp |
|||
) |
|||
|
|||
target_link_libraries( s3d_plugin_tetra s3d_sg ${wxWidgets_LIBRARIES} ) |
|||
|
|||
if( APPLE ) |
|||
install( TARGETS |
|||
s3d_plugin_tetra |
|||
DESTINATION /Applications/kicad.app/SharedSupport/plugins/3d |
|||
COMPONENT binary |
|||
) |
|||
else() |
|||
install( TARGETS |
|||
s3d_plugin_tetra |
|||
DESTINATION lib/kicad/plugins/3d |
|||
COMPONENT binary |
|||
) |
|||
endif() |
|||
@ -1,60 +0,0 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com> |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|||
* or you may search the http://www.gnu.org website for the version 2 license, |
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
/** |
|||
* @file 3d_plugin_tetra.h |
|||
* is a sample plugin which demonstrates the basic use of the SG* |
|||
* classes for the intermediate representation of objects. The plugin |
|||
* accepts any *.wrl filename but does not actually load any files, |
|||
* instead the Load() routine only creates a magenta tetrahedron. |
|||
*/ |
|||
|
|||
|
|||
#ifndef PLUGIN_3D_TETRA_H |
|||
#define PLUGIN_3D_TETRA_H |
|||
|
|||
#include <vector> |
|||
#include <plugins/3d/3d_plugin.h> |
|||
|
|||
class SCENEGRAPH; |
|||
|
|||
class S3D_PLUGIN_TETRA : public S3D_PLUGIN |
|||
{ |
|||
private: |
|||
std::vector< wxString > m_extensions; // supported extensions |
|||
std::vector< wxString > m_filters; // file filters |
|||
|
|||
public: |
|||
S3D_PLUGIN_TETRA(); |
|||
virtual ~S3D_PLUGIN_TETRA(); |
|||
|
|||
virtual int GetNExtensions( void ) const; |
|||
virtual const wxString GetModelExtension( int aIndex ) const; |
|||
virtual int GetNFilters( void ) const; |
|||
virtual const wxString GetFileFilter( int aIndex ) const; |
|||
|
|||
bool CanRender( void ) const; |
|||
SCENEGRAPH* Load( const wxString& aFileName ); |
|||
}; |
|||
|
|||
#endif // PLUGIN_3D_TETRA_H |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue