From cb3716ffb584fe0f593b6f1669a8efdba1305104 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 29 Mar 2016 02:16:55 +1000 Subject: Added my version of libg3d and friends. --- .../plugins/import/imp_leocad/Makefile | 510 +++++++++++++++++ .../plugins/import/imp_leocad/Makefile.am | 20 + .../plugins/import/imp_leocad/Makefile.in | 510 +++++++++++++++++ .../plugins/import/imp_leocad/imp_leocad.c | 496 ++++++++++++++++ .../plugins/import/imp_leocad/imp_leocad_library.c | 633 +++++++++++++++++++++ .../plugins/import/imp_leocad/imp_leocad_library.h | 62 ++ 6 files changed, 2231 insertions(+) create mode 100644 src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile create mode 100644 src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile.am create mode 100644 src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile.in create mode 100644 src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad.c create mode 100644 src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad_library.c create mode 100644 src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad_library.h (limited to 'src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad') diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile new file mode 100644 index 0000000..9c0164a --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile @@ -0,0 +1,510 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# plugins/import/imp_leocad/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + +pkgdatadir = $(datadir)/libg3d +pkglibdir = $(libdir)/libg3d +pkgincludedir = $(includedir)/libg3d +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +subdir = plugins/import/imp_leocad +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ + $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/gtk-2.0.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/libxml2.m4 $(top_srcdir)/m4/win32.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/g3d/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pluginimpdir)" +pluginimpLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(pluginimp_LTLIBRARIES) +imp_leocad_la_DEPENDENCIES = $(top_builddir)/src/libg3d.la +am_imp_leocad_la_OBJECTS = imp_leocad.lo imp_leocad_library.lo +imp_leocad_la_OBJECTS = $(am_imp_leocad_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(top_builddir)/include/g3d +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(imp_leocad_la_SOURCES) +DIST_SOURCES = $(imp_leocad_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8/config/missing --run aclocal-1.10 +AMTAR = ${SHELL} /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8/config/missing --run tar +AR = ar +AS = as +AUTOCONF = ${SHELL} /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8/config/missing --run autoconf +AUTOHEADER = ${SHELL} /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8/config/missing --run autoheader +AUTOMAKE = ${SHELL} /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8/config/missing --run automake-1.10 +AWK = gawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DBG_CFLAGS = -O2 +DEBUG = 0 +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = dlltool +ECHO = echo +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +F77 = +FFLAGS = +GDKPIXBUF_CFLAGS = -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 +GDKPIXBUF_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 +GLIB_CFLAGS = -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include +GLIB_GENMARSHAL = glib-genmarshal +GLIB_LIBS = -Wl,--export-dynamic -pthread -lgmodule-2.0 -lrt -lgobject-2.0 -lglib-2.0 +GLIB_MKENUMS = glib-mkenums +GOBJECT_QUERY = gobject-query +GREP = /bin/grep +GTKDOC_CHECK = /usr/bin/gtkdoc-check +GTK_CFLAGS = -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 +GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 +HTML_DIR = ${datadir}/gtk-doc/html +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LDFLAGS = +LEX = flex +LEXLIB = -lfl +LEX_OUTPUT_ROOT = lex.yy +LIBGSF_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libxml2 -I/usr/include/libgsf-1 +LIBGSF_LIBS = -lgsf-1 -lgobject-2.0 -lxml2 -lglib-2.0 +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool --quiet +LIBXML2_CFLAGS = -I/usr/include/libxml2 +LIBXML2_LIBS = -L/usr/lib/x86_64-linux-gnu -lxml2 +LN_S = ln -s +LTLIBOBJS = +LTVERSION = 0:8:0 +MAGIC_LIBS = -lmagic +MAKEINFO = ${SHELL} /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8/config/missing --run makeinfo +MATH_LIBS = -lm +MKDIR_P = /bin/mkdir -p +OBJDUMP = objdump +OBJEXT = o +PACKAGE = libg3d +PACKAGE_BUGREPORT = +PACKAGE_NAME = +PACKAGE_STRING = +PACKAGE_TARNAME = +PACKAGE_VERSION = +PATH_SEPARATOR = : +PKG_CONFIG = /usr/bin/pkg-config +PLUGINS_LDFLAGS = -avoid-version -export-dynamic +RANLIB = ranlib +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +VERSION = 0.0.8 +XML2_CONFIG = /usr/bin/xml2-config +XML_CPPFLAGS = -I/usr/include/libxml2 +XML_LIBS = -L/usr/lib/x86_64-linux-gnu -lxml2 +Z_CFLAGS = +Z_LIBS = -lz +abs_builddir = /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad +abs_srcdir = /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad +abs_top_builddir = /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8 +abs_top_srcdir = /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8 +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_F77 = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = $(SHELL) /home/dvs1/VirtualWorlds/SOURCE/SledjHamr/src/others/mimesh/libg3d-0.0.8/config/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = /bin/mkdir -p +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_builddir = ../../.. +top_srcdir = ../../.. +pluginimpdir = $(pkglibdir)/plugins/import +pluginimp_LTLIBRARIES = imp_leocad.la +AM_CFLAGS = \ + -Wall -ansi -pedantic \ + -DG_LOG_DOMAIN=\"LibG3D\" \ + -O2 -DDEBUG=0 \ + -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include + +INCLUDES = -I$(top_srcdir)/include +AM_LDFLAGS = \ + -no-undefined -module \ + -avoid-version -export-dynamic + +imp_leocad_la_SOURCES = imp_leocad.c imp_leocad_library.h imp_leocad_library.c +imp_leocad_la_LIBADD = $(top_builddir)/src/libg3d.la -Wl,--export-dynamic -pthread -lgmodule-2.0 -lrt -lgobject-2.0 -lglib-2.0 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/import/imp_leocad/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/import/imp_leocad/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-pluginimpLTLIBRARIES: $(pluginimp_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pluginimpdir)" || $(MKDIR_P) "$(DESTDIR)$(pluginimpdir)" + @list='$(pluginimp_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pluginimpLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pluginimpdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pluginimpLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pluginimpdir)/$$f"; \ + else :; fi; \ + done + +uninstall-pluginimpLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pluginimp_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pluginimpdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pluginimpdir)/$$p"; \ + done + +clean-pluginimpLTLIBRARIES: + -test -z "$(pluginimp_LTLIBRARIES)" || rm -f $(pluginimp_LTLIBRARIES) + @list='$(pluginimp_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +imp_leocad.la: $(imp_leocad_la_OBJECTS) $(imp_leocad_la_DEPENDENCIES) + $(LINK) -rpath $(pluginimpdir) $(imp_leocad_la_OBJECTS) $(imp_leocad_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/imp_leocad.Plo +include ./$(DEPDIR)/imp_leocad_library.Plo + +.c.o: + $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pluginimpdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginimpLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-pluginimpLTLIBRARIES + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginimpLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginimpLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pluginimpLTLIBRARIES \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-pluginimpLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile.am b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile.am new file mode 100644 index 0000000..50b500a --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile.am @@ -0,0 +1,20 @@ +pluginimpdir = $(pkglibdir)/plugins/import + +pluginimp_LTLIBRARIES = imp_leocad.la + +AM_CFLAGS = \ + -Wall -ansi -pedantic \ + -DG_LOG_DOMAIN=\"LibG3D\" \ + @DBG_CFLAGS@ -DDEBUG=@DEBUG@ \ + @GLIB_CFLAGS@ + +INCLUDES = -I$(top_srcdir)/include + +AM_LDFLAGS = \ + -no-undefined -module \ + @PLUGINS_LDFLAGS@ + +LIBTOOL += --quiet + +imp_leocad_la_SOURCES = imp_leocad.c imp_leocad_library.h imp_leocad_library.c +imp_leocad_la_LIBADD = $(top_builddir)/src/libg3d.la @GLIB_LIBS@ diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile.in b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile.in new file mode 100644 index 0000000..8549398 --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/Makefile.in @@ -0,0 +1,510 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plugins/import/imp_leocad +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ + $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/gtk-2.0.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/libxml2.m4 $(top_srcdir)/m4/win32.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/g3d/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pluginimpdir)" +pluginimpLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(pluginimp_LTLIBRARIES) +imp_leocad_la_DEPENDENCIES = $(top_builddir)/src/libg3d.la +am_imp_leocad_la_OBJECTS = imp_leocad.lo imp_leocad_library.lo +imp_leocad_la_OBJECTS = $(am_imp_leocad_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include/g3d +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(imp_leocad_la_SOURCES) +DIST_SOURCES = $(imp_leocad_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DBG_CFLAGS = @DBG_CFLAGS@ +DEBUG = @DEBUG@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GDKPIXBUF_CFLAGS = @GDKPIXBUF_CFLAGS@ +GDKPIXBUF_LIBS = @GDKPIXBUF_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBGSF_CFLAGS = @LIBGSF_CFLAGS@ +LIBGSF_LIBS = @LIBGSF_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ --quiet +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LTVERSION = @LTVERSION@ +MAGIC_LIBS = @MAGIC_LIBS@ +MAKEINFO = @MAKEINFO@ +MATH_LIBS = @MATH_LIBS@ +MKDIR_P = @MKDIR_P@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINS_LDFLAGS = @PLUGINS_LDFLAGS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XML2_CONFIG = @XML2_CONFIG@ +XML_CPPFLAGS = @XML_CPPFLAGS@ +XML_LIBS = @XML_LIBS@ +Z_CFLAGS = @Z_CFLAGS@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +pluginimpdir = $(pkglibdir)/plugins/import +pluginimp_LTLIBRARIES = imp_leocad.la +AM_CFLAGS = \ + -Wall -ansi -pedantic \ + -DG_LOG_DOMAIN=\"LibG3D\" \ + @DBG_CFLAGS@ -DDEBUG=@DEBUG@ \ + @GLIB_CFLAGS@ + +INCLUDES = -I$(top_srcdir)/include +AM_LDFLAGS = \ + -no-undefined -module \ + @PLUGINS_LDFLAGS@ + +imp_leocad_la_SOURCES = imp_leocad.c imp_leocad_library.h imp_leocad_library.c +imp_leocad_la_LIBADD = $(top_builddir)/src/libg3d.la @GLIB_LIBS@ +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/import/imp_leocad/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/import/imp_leocad/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-pluginimpLTLIBRARIES: $(pluginimp_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pluginimpdir)" || $(MKDIR_P) "$(DESTDIR)$(pluginimpdir)" + @list='$(pluginimp_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pluginimpLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pluginimpdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pluginimpLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pluginimpdir)/$$f"; \ + else :; fi; \ + done + +uninstall-pluginimpLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pluginimp_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pluginimpdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pluginimpdir)/$$p"; \ + done + +clean-pluginimpLTLIBRARIES: + -test -z "$(pluginimp_LTLIBRARIES)" || rm -f $(pluginimp_LTLIBRARIES) + @list='$(pluginimp_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +imp_leocad.la: $(imp_leocad_la_OBJECTS) $(imp_leocad_la_DEPENDENCIES) + $(LINK) -rpath $(pluginimpdir) $(imp_leocad_la_OBJECTS) $(imp_leocad_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imp_leocad.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imp_leocad_library.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pluginimpdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginimpLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-pluginimpLTLIBRARIES + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginimpLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginimpLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pluginimpLTLIBRARIES \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-pluginimpLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad.c b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad.c new file mode 100644 index 0000000..590c342 --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad.c @@ -0,0 +1,496 @@ +/* $Id$ */ + +/* + libg3d - 3D object loading library + + Copyright (C) 2005-2009 Markus Dahms + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include "imp_leocad_library.h" + +static int leocad_load_lcd(G3DStream *stream, G3DModel *model, + LeoCadLibrary *library, G3DContext *context); + +EAPI +gpointer plugin_init(G3DContext *context) +{ + LeoCadLibrary *library; + const gchar *libdir; + + libdir = g_getenv("LEOCAD_LIB"); + if(libdir == NULL) + libdir = "/usr/local/share/leocad"; + + library = leocad_library_load(libdir); + + if(library == NULL) + { +#if DEBUG > 1 + g_warning("LeoCAD: failed to load library"); +#endif + return NULL; + } + + return library; +} + +EAPI +void plugin_cleanup(gpointer user_data) +{ + LeoCadLibrary *library; + +#if DEBUG > 1 + g_debug("LeoCAD: cleaning up library\n"); +#endif + + library = (LeoCadLibrary *)user_data; + + if(library) + leocad_library_free(library); +} + +EAPI +gboolean plugin_load_model_from_stream(G3DContext *context, G3DStream *stream, + G3DModel *model, gpointer user_data) +{ + LeoCadLibrary *library; + + library = (LeoCadLibrary *)user_data; + + if(library == NULL) + { + g_warning("LeoCAD: library not loaded"); + return FALSE; + } + + setlocale(LC_NUMERIC, "C"); + + return leocad_load_lcd(stream, model, library, context); +} + +EAPI +gchar *plugin_description(G3DContext *context) +{ + return g_strdup("LeoCAD models."); +} + +EAPI +gchar **plugin_extensions(G3DContext *context) +{ + return g_strsplit("lcd", ":", 0); +} + +/* + * LeoCAD specific stuff + */ + +static gboolean leocad_change_key(guint16 ktime, G3DFloat *param, guint8 ktype, + G3DFloat *matrix, G3DFloat *mloc, gboolean *valid_matrix) +{ + /* get first frame */ + if(ktime == 1) + { + switch(ktype) + { + case 0x00: /* translation */ + g3d_matrix_identity(mloc); + g3d_matrix_translate(param[0], param[1], param[2], mloc); + g3d_matrix_multiply(matrix, mloc, matrix); + *valid_matrix = TRUE; + break; + + case 0x01: /* rotation */ + g3d_matrix_rotate((G3DFloat)param[3] * G_PI / 180.0, + param[0], param[1], param[2], matrix); + g3d_matrix_multiply(mloc, matrix, matrix); + *valid_matrix = TRUE; + break; + + default: + break; + } + } +#if DEBUG > 0 + g_debug("LeoCAD: key 0x%02x (%d): %+2.2f %+2.2f %+2.2f %+2.2f", + ktype, ktime, param[0], param[1], param[2], param[3]); +#endif + return TRUE; +} + +static gboolean leocad_load_lcd_piece(G3DStream *stream, G3DModel *model, + LeoCadLibrary *library, G3DFloat lcdversion) +{ + guint32 i, j, k, nkeys, nobjs; + guint16 ktime; + guint8 pver, over, ktype, color = 0, len8; + gchar name[9]; + G3DFloat param[4], matrix[16], mloc[16]; + G3DFloat offx = 0.0, offy = 0.0, offz = 0.0; + G3DFloat rotx = 0.0, roty = 0.0, rotz = 0.0; + G3DObject *object; + G3DMaterial *mat_change; + G3DFace *face; + GSList *fitem; + gboolean valid_matrix = FALSE; + + g3d_matrix_identity(mloc); + g3d_matrix_identity(matrix); + + mat_change = leocad_library_get_nth_material(library, 0x10); + + if(lcdversion > 0.4) + { + pver = g3d_stream_read_int8(stream); + + if(pver >= 9) + { + /* object stuff */ + over = g3d_stream_read_int8(stream); + nobjs = g3d_stream_read_int32_le(stream); + for(i = 0; i < nobjs; i ++) + { + /* time */ + ktime = g3d_stream_read_int16_le(stream); + /* param */ + param[0] = g3d_stream_read_float_le(stream); + param[1] = g3d_stream_read_float_le(stream); + param[2] = g3d_stream_read_float_le(stream); + param[3] = g3d_stream_read_float_le(stream); + /* type */ + ktype = g3d_stream_read_int8(stream); + + leocad_change_key(ktime, param, ktype, matrix, mloc, + &valid_matrix); + } + + if(over == 1) + { + nobjs = g3d_stream_read_int32_le(stream); + for(i = 0; i < nobjs; i ++) + { + ktime = g3d_stream_read_int16_le(stream); + param[0] = g3d_stream_read_float_le(stream); + param[1] = g3d_stream_read_float_le(stream); + param[2] = g3d_stream_read_float_le(stream); + param[3] = g3d_stream_read_float_le(stream); + ktype = g3d_stream_read_int8(stream); + } + } + } + else /* pver < 9 */ + { + if(pver > 5) + { + nkeys = g3d_stream_read_int32_le(stream); + for(i = 0; i < nkeys; i ++) + { + /* param */ + param[0] = g3d_stream_read_float_le(stream); + param[1] = g3d_stream_read_float_le(stream); + param[2] = g3d_stream_read_float_le(stream); + param[3] = g3d_stream_read_float_le(stream); + + /* time */ + ktime = g3d_stream_read_int16_le(stream); + + /* type */ + ktype = g3d_stream_read_int8(stream); + + leocad_change_key(ktime, param, ktype, matrix, mloc, + &valid_matrix); + + } /* keys */ + + nkeys = g3d_stream_read_int32_le(stream); + for(i = 0; i < nkeys; i ++) + { + /* param */ + param[0] = g3d_stream_read_float_le(stream); + param[1] = g3d_stream_read_float_le(stream); + param[2] = g3d_stream_read_float_le(stream); + param[3] = g3d_stream_read_float_le(stream); + + /* time */ + ktime = g3d_stream_read_int16_le(stream); + + /* type */ + ktype = g3d_stream_read_int8(stream); + } + } /* pver > 5 */ + else /* pver <= 5 */ + { + if(pver > 2) + { + nkeys = g3d_stream_read_int8(stream); + for(i = 0; i < nkeys; i ++) + { + if(pver > 3) + { +#if DEBUG > 2 + g_debug("LeoCAD: matrix\n"); +#endif + /* matrix */ + for(j = 0; j < 4; j ++) + for(k = 0; k < 4; k ++) + matrix[j * 4 + k] = + g3d_stream_read_float_le(stream); + + valid_matrix = TRUE; + } + else + { + /* move: 3 x float */ + offx = g3d_stream_read_float_le(stream); + offy = g3d_stream_read_float_le(stream); + offz = g3d_stream_read_float_le(stream); + + /* rotate: 3 x float */ + rotx = g3d_stream_read_float_le(stream); + roty = g3d_stream_read_float_le(stream); + rotz = g3d_stream_read_float_le(stream); + } + + /* time */ + ktime = g3d_stream_read_int8(stream); + + /* bl? */ + g3d_stream_read_int32_le(stream); + } /* .. nkeys */ + } /* pver > 2 */ + else /* pver <= 2 */ + { + /* move: 3 x float */ + offx = g3d_stream_read_float_le(stream); + offy = g3d_stream_read_float_le(stream); + offz = g3d_stream_read_float_le(stream); + + /* rotate: 3 x float */ + rotx = g3d_stream_read_float_le(stream); + roty = g3d_stream_read_float_le(stream); + rotz = g3d_stream_read_float_le(stream); + } + } /* pver <= 5 */ + } /* pver < 9 */ + + /* common stuff */ + + /* name of piece */ + g3d_stream_read(stream, name, 9); + + /* color */ + color = g3d_stream_read_int8(stream); + + if(pver < 5) + color = leocad_library_convert_color(color); + +#if DEBUG > 0 + g_debug("LeoCAD: [%d]: '%-8s', color 0x%02x", pver, name, color); +#endif + + /* step show */ + g3d_stream_read_int8(stream); + + /* step hide */ + if(pver > 1) + g3d_stream_read_int8(stream); + + if(pver > 5) + { + /* frame show */ + g3d_stream_read_int16_le(stream); + /* frame hide */ + g3d_stream_read_int16_le(stream); + + if(pver > 7) { + /* state */ + g3d_stream_read_int8(stream); + + len8 = g3d_stream_read_int8(stream); + g3d_stream_skip(stream, len8); + } else { /* pver <= 7 */ + /* hide */ + g3d_stream_read_int32_le(stream); + g3d_stream_skip(stream, 81); + } /* pver <= 7 */ + + if(pver > 6) { + /* group pointer ?! */ + g3d_stream_read_int32_le(stream); + } + } /* pver > 5 */ + else /* pver <= 5 */ + { + /* group pointer ?! */ + g3d_stream_read_int8(stream); + + /* hide */ + g3d_stream_read_int8(stream); + } + + } /* lcdversion > 0.4 */ + + object = leocad_library_get_piece(library, name); + if(object == NULL) + { + g_warning("LeoCAD: failed to load piece '%s'", name); + return FALSE; + } + + /* matrix */ + if(!valid_matrix) + { + /* translation */ + g3d_matrix_identity(mloc); + g3d_matrix_translate(offx, offy, offz, mloc); + /* rotation */ + rotx = (G3DFloat)(rotx * G_PI) / 180.0; + roty = (G3DFloat)(roty * G_PI) / 180.0; + rotz = (G3DFloat)(rotz * G_PI) / 180.0; + g3d_matrix_identity(matrix); + g3d_matrix_rotate_xyz(rotx, roty, rotz, matrix); + + /* combine */ + g3d_matrix_multiply(mloc, matrix, matrix); + } + + /*g3d_matrix_dump(matrix);*/ + + /* transform vertices */ + for(i = 0; i < object->vertex_count; i ++) + g3d_vector_transform( + &(object->vertex_data[i * 3 + 0]), + &(object->vertex_data[i * 3 + 1]), + &(object->vertex_data[i * 3 + 2]), + matrix); + + /* change color */ + fitem = object->faces; + while(fitem) + { + face = (G3DFace *)fitem->data; + if(face->material == mat_change) + { + face->material = leocad_library_get_nth_material(library, color); + } + + if(face->material == NULL) + { + face->material = leocad_library_get_nth_material(library, 0); + } + + fitem = fitem->next; + } + + /* add to model object list */ + model->objects = g_slist_append(model->objects, object); + + return TRUE; +} + +static gboolean leocad_load_lcd(G3DStream *stream, G3DModel *model, + LeoCadLibrary *library, G3DContext *context) +{ + gchar magic[32]; + float version; + guint32 i, count; + G3DFloat r, g, b; + G3DMatrix rmatrix[16]; + + g3d_stream_read(stream, magic, 32); + if(strncmp(magic, "LeoCAD", 6) != 0) { + g_warning("LeoCAD: '%s' is not a valid LeoCAD project file", + stream->uri); + return FALSE; + } + + sscanf(&magic[7], "%f", &version); + + if(version > 0.4) { +#if DEBUG > 0 + g_debug("LeoCAD: file version %.1f, getting next float", version); +#endif + version = g3d_stream_read_float_le(stream); + } + +#if DEBUG > 0 + g_debug("LeoCAD: file version %.1f", version); +#endif + + r = g3d_stream_read_int8(stream) / 255.0; + g = g3d_stream_read_int8(stream) / 255.0; + b = g3d_stream_read_int8(stream) / 255.0; + /* background color */ + g3d_context_set_bgcolor(context, r, g, b, 1.0); + g3d_stream_read_int8(stream); + + /* view */ + if(version < 0.6) { + /* eye: 3 x double */ + g3d_stream_skip(stream, 24); + + /* target: 3 x double */ + g3d_stream_skip(stream, 24); + } + + /* angle snap */ + g3d_stream_read_int32_le(stream); + /* snap */ + g3d_stream_read_int32_le(stream); + /* line width */ + g3d_stream_read_float_le(stream); + /* detail */ + g3d_stream_read_int32_le(stream); + /* cur group */ + g3d_stream_read_int32_le(stream); + /* cur color */ + g3d_stream_read_int32_le(stream); + /* action */ + g3d_stream_read_int32_le(stream); + /* cur step */ + g3d_stream_read_int32_le(stream); + + if(version > 0.8) { + /* scene */ + g3d_stream_read_int32_le(stream); + } + + /* piece count */ + count = g3d_stream_read_int32_le(stream); + for(i = 0; i < count; i ++) { + /* load piece */ + leocad_load_lcd_piece(stream, model, library, version); + } + + g3d_matrix_identity(rmatrix); + g3d_matrix_rotate_xyz(G_PI * -90.0 / 180, 0.0, 0.0, rmatrix); + g3d_model_transform(model, rmatrix); + + return TRUE; +} diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad_library.c b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad_library.c new file mode 100644 index 0000000..7336336 --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad_library.c @@ -0,0 +1,633 @@ +/* $Id$ */ + +/* + libg3d - 3D object loading library + + Copyright (C) 2005-2009 Markus Dahms + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include "imp_leocad_library.h" + +#define LEOCAD_FLAG_PIECE_COUNT 0x01 +#define LEOCAD_FLAG_PIECE_LONGDATA 0x02 +#define LEOCAD_FLAG_PIECE_CCW 0x04 +#define LEOCAD_FLAG_PIECE_SMALL 0x10 +#define LEOCAD_FLAG_PIECE_MEDIUM 0x20 +#define LEOCAD_FLAG_LONGDATA_RUNTIME 0x40 +#define LEOCAD_FLAG_PIECE_RENAMED 0x80 + +#define LEOCAD_TYPE_MESH 0x01 +#define LEOCAD_TYPE_STUD 0x02 +#define LEOCAD_TYPE_STUD2 0x03 +#define LEOCAD_TYPE_STUD3 0x04 +#define LEOCAD_TYPE_STUD4 0x05 + +static gboolean leocad_library_read_pieces_idx(LeoCadLibrary *library, + G3DStream *idx); +static gboolean leocad_create_materials(LeoCadLibrary *library); + +struct LeoCadConnection { + guint8 type; + G3DFloat center[3]; + G3DFloat normal[3]; +}; + +LeoCadLibrary *leocad_library_load(const gchar *libdir) +{ + LeoCadLibrary *library; + gchar filename[1025]; + G3DStream *idx, *bin; + + library = g_new0(LeoCadLibrary, 1); + + g_snprintf(filename, 1024, "%s/%s", libdir, "pieces.idx"); + idx = g3d_stream_open_file(filename, "rb"); + if(idx == NULL) { +#if DEBUG > 0 + g_warning("LeoCAD: failed to read '%s'", filename); +#endif + g_free(library); + return NULL; + } + + g_snprintf(filename, 1024, "%s/%s", libdir, "pieces.bin"); + bin = g3d_stream_open_file(filename, "rb"); + if(bin == NULL) { +#if DEBUG > 0 + g_debug("LeoCAD: failed to read '%s'", filename); +#endif + g3d_stream_close(idx); + g_free(library); + return NULL; + } + + library->pieces = g_hash_table_new(g_str_hash, g_str_equal); + library->pieces_bin = bin; + + leocad_library_read_pieces_idx(library, idx); + g3d_stream_close(idx); + + leocad_create_materials(library); + + return library; +} + +static gboolean leocad_free_piece_cb(gpointer key, gpointer value, + gpointer user_data) +{ + LeoCadPiece *piece; + + piece = (LeoCadPiece *)value; + +#if DEBUG > 3 + g_debug("D: freeing piece %s", piece->name); +#endif + + if(piece->name) g_free(piece->name); + if(piece->description) g_free(piece->description); + if(piece->moved_to) g_free(piece->moved_to); + + if(!(piece->flags & LEOCAD_FLAG_PIECE_RENAMED)) + if(piece->object) g3d_object_free(piece->object); + + g_free(piece); + + return TRUE; +} + +void leocad_library_free(LeoCadLibrary *library) +{ + GSList *mlist; + G3DMaterial *material; + + /* remove materials */ + mlist = library->materials; + while(mlist) + { + material = (G3DMaterial *)mlist->data; + mlist = g_slist_remove(mlist, material); + g3d_material_free(material); + } + + /* remove pieces */ + g_hash_table_foreach_remove(library->pieces, leocad_free_piece_cb, NULL); + g_hash_table_destroy(library->pieces); + + /* free library */ + g_free(library); +} + +static G3DFloat leocad_read_scaled16(G3DStream *stream, G3DFloat scale) +{ + gint16 x; + + x = g3d_stream_read_int16_le(stream); + + return (G3DFloat)(x / scale); +} + +static gboolean leocad_create_materials(LeoCadLibrary *library) +{ + const guint8 colors[] = { + 166, 25, 25, 255, /* 0 - Red */ + 255, 127, 51, 255, /* 1 - Orange */ + 25, 102, 25, 255, /* 2 - Green */ + 76, 153, 76, 255, /* 3 - Light Green */ + 0, 51, 178, 255, /* 4 - Blue */ + 51, 102, 229, 255, /* 5 - Light Blue */ + 204, 204, 0, 255, /* 6 - Yellow */ + 242, 242, 242, 255, /* 7 - White */ + 76, 76, 76, 255, /* 8 - Dark Gray */ + 25, 25, 25, 255, /* 9 - Black */ + 102, 51, 51, 255, /* 10 - Brown */ + 178, 76, 153, 255, /* 11 - Pink */ + 153, 51, 153, 255, /* 12 - Purple */ + 229, 178, 51, 255, /* 13 - Gold */ + 153, 25, 25, 153, /* 14 - Clear Red */ + 255, 153, 76, 153, /* 15 - Clear Orange */ + 25, 102, 25, 153, /* 16 - Clear Green */ + 153, 178, 76, 153, /* 17 - Clear Light Green */ + 0, 0, 127, 153, /* 18 - Clear Blue */ + 51, 102, 229, 153, /* 19 - Clear Light Blue */ + 229, 229, 0, 153, /* 20 - Clear Yellow */ + 229, 229, 229, 153, /* 21 - Clear White */ + 127, 127, 127, 255, /* 22 - Light Gray */ + 204, 204, 178, 255, /* 23 - Tan */ + 153, 102, 102, 255, /* 24 - Light Brown */ + 229, 178, 229, 255, /* 25 - Light Pink */ + 25, 178, 204, 255, /* 26 - Turquoise */ + 204, 204, 204, 255, /* 27 - Silver */ + 51, 51, 51, 255, /* 28 - Edges */ + 229, 76, 102, 255, /* 29 - Selected */ + 102, 76, 229, 255}; /* 30 - Focused */ + + G3DMaterial *material; + guint32 i; + + for(i = 0; i < 31; i ++) + { + material = g3d_material_new(); + material->r = (G3DFloat)colors[i * 4 + 0] / 255.0; + material->g = (G3DFloat)colors[i * 4 + 1] / 255.0; + material->b = (G3DFloat)colors[i * 4 + 2] / 255.0; + material->a = (G3DFloat)colors[i * 4 + 3] / 255.0; + + library->materials = g_slist_append(library->materials, material); + } + + return TRUE; +} + +guint8 leocad_library_convert_color(guint8 n) +{ + static guint8 converted_colors[20] = + { 0,2,4,9,7,6,22,8,10,11,14,16,18,9,21,20,22,8,10,11 }; + + if(n >= 20) + return 0; + + return converted_colors[n]; +} + +G3DMaterial *leocad_library_get_nth_material(LeoCadLibrary *library, guint8 n) +{ + return g_slist_nth_data(library->materials, n); +} + +G3DObject *leocad_library_get_piece(LeoCadLibrary *library, const gchar *name) +{ + LeoCadPiece *piece; + G3DObject *stud; + G3DFace *face; + guint32 i, j, k, nconn, ngrp, ntex, ngrpconn, ncol, nx, color = 0; + guint16 grp_type; + G3DFloat scale = 100.0; + G3DFloat matrix[16]; + G3DStream *bin; + struct LeoCadConnection *connections; + + piece = g_hash_table_lookup(library->pieces, name); + + if(piece == NULL) + { + g_warning("LeoCAD: failed to load piece '%s'", name); + return NULL; + } + + bin = library->pieces_bin; + + if(piece->object == NULL) + { + piece->object = g_new0(G3DObject, 1); + piece->object->name = g_strdup(piece->description); + + g3d_stream_seek(bin, piece->offset_bin, G_SEEK_SET); + piece->object->vertex_count = g3d_stream_read_int32_le(bin); + piece->object->vertex_data = g_new0(G3DFloat, + piece->object->vertex_count * 3); + + if(piece->flags & LEOCAD_FLAG_PIECE_SMALL) + scale = 10000.0; + else if(piece->flags & LEOCAD_FLAG_PIECE_MEDIUM) + scale = 1000.0; + + for(i = 0; i < piece->object->vertex_count; i ++) + { + piece->object->vertex_data[i * 3 + 0] = + leocad_read_scaled16(bin, scale); + piece->object->vertex_data[i * 3 + 1] = + leocad_read_scaled16(bin, scale); + piece->object->vertex_data[i * 3 + 2] = + leocad_read_scaled16(bin, scale); + } +#if DEBUG > 1 + g_debug("LeoCAD: piece '%s': flags 0x%02X", name, piece->flags); +#endif + +#if DEBUG > 1 + g_debug("LeoCAD: piece '%s': %d vertices", + name, piece->object->vertex_count); +#endif + + /* connections */ + nconn = g3d_stream_read_int16_le(bin); +#if DEBUG > 1 + g_debug("LeoCAD: piece '%s': %d connections", name, nconn); +#endif + connections = g_new0(struct LeoCadConnection, nconn); + for(i = 0; i < nconn; i ++) + { + connections[i].type = g3d_stream_read_int8(bin); + + /* center */ + connections[i].center[0] = leocad_read_scaled16(bin, scale); + connections[i].center[1] = leocad_read_scaled16(bin, scale); + connections[i].center[2] = leocad_read_scaled16(bin, scale); + + /* normal */ + connections[i].normal[0] = g3d_stream_read_int16_le(bin) / (1 << 14); + connections[i].normal[1] = g3d_stream_read_int16_le(bin) / (1 << 14); + connections[i].normal[2] = g3d_stream_read_int16_le(bin) / (1 << 14); + } + + /* textures */ + ntex = g3d_stream_read_int8(bin); +#if DEBUG > 0 + if(ntex > 0) + g_debug("LeoCAD: piece '%s': %d textures", name, ntex); +#endif + for(i = 0; i < ntex; i ++) + { + /* TODO: */ + } + + /* groups */ + ngrp = g3d_stream_read_int16_le(bin); +#if DEBUG > 1 + g_debug("LeoCAD: piece '%s': %d groups @ 0x%08lx", + name, ngrp, ftell(bin)); +#endif + for(i = 0; i < ngrp; i ++) + { + /* group connections */ + ngrpconn = g3d_stream_read_int8(bin); + for(j = 0; j < ngrpconn; j ++) + { + g3d_stream_read_int16_le(bin); + } + +#if 0 + while(1) + { +#endif + grp_type = g3d_stream_read_int8(bin); + if(grp_type == 0) + { + break; + } +#if DEBUG > 1 + g_debug("LeoCAD: piece '%s': grp %d: type 0x%02x @ 0x%08lx", + name, i, grp_type, ftell(bin)); +#endif + + switch(grp_type) + { + case LEOCAD_TYPE_MESH: + ncol = g3d_stream_read_int16_le(bin); +#if DEBUG > 1 + g_debug("LeoCAD: piece '%s': grp %d: %d colors " + "(@ 0x%08lx)", name, i, ncol, ftell(bin)); +#endif + for(j = 0; j < ncol; j ++) + { + /* color code */ + color = g3d_stream_read_int16_le(bin); +#if DEBUG > 1 + g_debug("LeoCAD: piece '%s': grp %d: color 0x%04x", + name, i, color); +#endif + /* quads? */ + nx = g3d_stream_read_int16_le(bin); + for(k = 0; k < nx / 4; k ++) + { + face = g_new0(G3DFace, 1); + face->material = + g_slist_nth_data( + library->materials, color); + face->vertex_count = 4; + face->vertex_indices = g_new0(guint32, 4); + + face->vertex_indices[0] = + g3d_stream_read_int16_le(bin); + face->vertex_indices[1] = + g3d_stream_read_int16_le(bin); + face->vertex_indices[2] = + g3d_stream_read_int16_le(bin); + face->vertex_indices[3] = + g3d_stream_read_int16_le(bin); + + piece->object->faces = g_slist_prepend( + piece->object->faces, face); + } +#if DEBUG > 1 + g_debug("LeoCAD: piece '%s': grp %d: " + "quads: %d bytes", name, i, nx * 2); +#endif + nx = g3d_stream_read_int16_le(bin); + for(k = 0; k < nx / 3; k ++) + { + face = g_new0(G3DFace, 1); + face->material = + g_slist_nth_data( + library->materials, color); + face->vertex_count = 3; + face->vertex_indices = g_new0(guint32, 3); + + face->vertex_indices[0] = + g3d_stream_read_int16_le(bin); + face->vertex_indices[1] = + g3d_stream_read_int16_le(bin); + face->vertex_indices[2] = + g3d_stream_read_int16_le(bin); + + piece->object->faces = g_slist_prepend( + piece->object->faces, face); + } + +#if DEBUG > 1 + g_debug("LeoCAD: piece '%s': grp %d: " + "triangles: %d bytes", + name, i, nx * 2); +#endif + nx = g3d_stream_read_int16_le(bin); +#if DEBUG > 1 + g_debug("LeoCAD: piece '%s': grp %d: " + "skipping %d bytes @ 0x%08lx", + name, i, nx * 2, ftell(bin)); +#endif + g3d_stream_skip(bin, nx * 2); + } + break; + + case LEOCAD_TYPE_STUD: + case LEOCAD_TYPE_STUD2: + case LEOCAD_TYPE_STUD3: + case LEOCAD_TYPE_STUD4: + stud = NULL; + color = g3d_stream_read_int8(bin); +#if DEBUG > 0 + g_debug("LeoCAD: piece '%s': stud 0x%02x", + name, grp_type); +#endif + if(grp_type == LEOCAD_TYPE_STUD4) + stud = g3d_primitive_tube( + 0.24, /* inner radius */ + 0.32, /* outer radius */ + 0.16, /* height */ + 16, /* sides */ + TRUE, FALSE, /* top, bottom */ + leocad_library_get_nth_material( + library, color)); + + g3d_matrix_identity(matrix); + for(j = 0; j < 12; j ++) +#if 1 + matrix[(j / 3) * 4 + (j % 3)] = + g3d_stream_read_float_le(bin); +#else + matrix[j] = g3d_stream_read_float_le(bin); +#endif + /* g3d_matrix_dump(matrix); */ + + if(stud && piece->object) + { + g3d_object_transform(stud, matrix); + g3d_object_merge(piece->object, stud); + stud = NULL; + } + + break; + + default: +#if DEBUG > 1 + g_debug( + "LeoCAD: piece '%s': unhandled group type 0x%02x " + "@ 0x%08lx", + name, grp_type, ftell(bin)); +#endif + break; + } /* grp_type */ +#if 0 + } /* grp_type != 0 */ +#endif + g3d_stream_read_int8(bin); + } /* ngrp */ + + /* generate studs */ + for(i = 0; i < nconn; i ++) + { +#if DEBUG > 4 + g_debug("LeoCAD: connection %d: type 0x%02x", + i, connections[i].type); +#endif + + switch(connections[i].type) + { + case 0: + stud = g3d_primitive_cylinder( + 0.24, /* radius */ + 0.16, /* height */ + 16, /* sides */ + TRUE, FALSE, /* top, bottom */ + leocad_library_get_nth_material(library, color)); + break; + + case 2: + stud = g3d_primitive_tube( + 0.24, /* inner radius */ + 0.32, /* outer radius */ + 0.16, /* height */ + 16, /* sides */ + FALSE, TRUE, /* top, bottom */ + leocad_library_get_nth_material(library, color)); + break; + + default: + stud = NULL; + break; + } + + if(stud) + { +#if DEBUG > 5 + g_debug("LeoCAD: stud"); +#endif + /* transform stud */ + for(j = 0; j < stud->vertex_count; j ++) + { +#if 0 + g3d_vector_transform( + &(stud->vertices[j * 3 + 0]), + &(stud->vertices[j * 3 + 1]), + &(stud->vertices[j * 3 + 2]), + matrix); +#endif + + stud->vertex_data[j * 3 + 0] += connections[i].center[0]; + stud->vertex_data[j * 3 + 1] += connections[i].center[1]; + stud->vertex_data[j * 3 + 2] += connections[i].center[2]; + } + + /* merge stud */ + g3d_object_merge(piece->object, stud); + } /* stud */ + } /* nconn */ + + if(connections) + g_free(connections); + } + + return g3d_object_duplicate(piece->object); +} + +static gboolean leocad_library_read_piece(LeoCadLibrary *library, + G3DStream *idx) +{ + gchar buffer[128]; + guint32 i; + LeoCadPiece *piece; + + piece = g_new0(LeoCadPiece, 1); + + g3d_stream_read(idx, buffer, 8); + buffer[8] = '\0'; + piece->name = g_strdup(buffer); + + g3d_stream_read(idx, buffer, 64); + buffer[64] = '\0'; + piece->description = g_strdup(buffer); + + for(i = 0; i < 6; i ++) + piece->bounding_box[i] = g3d_stream_read_int16_le(idx); + + piece->flags = g3d_stream_read_int8(idx); + piece->default_group = g3d_stream_read_int32_le(idx); + piece->offset_bin = g3d_stream_read_int32_le(idx); + piece->info_size = g3d_stream_read_int32_le(idx); + +#if DEBUG > 1 + g_debug("LeoCAD: %-8s: @ 0x%08x, %s", + piece->name, piece->offset_bin, piece->description); +#endif + + g_hash_table_insert(library->pieces, piece->name, piece); + + return TRUE; +} + +static gboolean leocad_library_read_pieces_idx(LeoCadLibrary *library, + G3DStream *idx) +{ + gchar magic[32], nameold[9], namenew[9]; + guint8 version, lastupdate; + guint32 nmoved, nbinsize, npieces, i; + LeoCadPiece *piece, *newpiece; + + g3d_stream_read(idx, magic, 32); + if(strncmp(magic, "LeoCAD piece library index file", 31) != 0) + { + g_debug("LeoCAD: pieces.idx: wrong magic"); + return FALSE; + } + + version = g3d_stream_read_int8(idx); + lastupdate = g3d_stream_read_int8(idx); + + g3d_stream_seek(idx, -8, G_SEEK_END); + nmoved = g3d_stream_read_int16_le(idx); + nbinsize = g3d_stream_read_int32_le(idx); + npieces = g3d_stream_read_int16_le(idx); + + g3d_stream_seek(idx, 34, G_SEEK_SET); + +#if DEBUG > 0 + g_debug("LeoCAD: pieces.idx: version %d, last update %d", + version, lastupdate); + g_debug("LeoCAD: pieces.idx: %d pieces, %d moves, pieces.bin %d bytes", + npieces, nmoved, nbinsize); +#endif + + for(i = 0; i < npieces; i ++) + leocad_library_read_piece(library, idx); + + for(i = 0; i < nmoved; i ++) { + memset(nameold, 0, 9); + memset(namenew, 0, 9); + + g3d_stream_read(idx, nameold, 8); + g3d_stream_read(idx, namenew, 8); + + piece = g_hash_table_lookup(library->pieces, namenew); + if(piece) { + newpiece = g_new0(LeoCadPiece, 1); + memcpy(newpiece, piece, sizeof(LeoCadPiece)); + newpiece->name = g_strdup(nameold); + newpiece->description = g_strdup(piece->description); + newpiece->moved_to = g_strdup(namenew); + newpiece->object = piece->object; + newpiece->flags |= LEOCAD_FLAG_PIECE_RENAMED; + + g_hash_table_insert(library->pieces, piece->name, newpiece); + } + } + + return TRUE; +} + diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad_library.h b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad_library.h new file mode 100644 index 0000000..ac7299e --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_leocad/imp_leocad_library.h @@ -0,0 +1,62 @@ +/* $Id$ */ + +/* + libg3d - 3D object loading library + + Copyright (C) 2005-2009 Markus Dahms + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef IMP_LEOCAD_LIBRARY_H +#define IMP_LEOCAD_LIBRARY_H + +#include + +#include +#include + +typedef struct +{ + gchar *name; + gchar *description; + gchar *moved_to; + + guint16 bounding_box[6]; + guint8 flags; + guint32 default_group; + guint32 offset_bin; + guint32 info_size; + + G3DObject *object; +} +LeoCadPiece; + +typedef struct +{ + G3DStream *pieces_bin; + GHashTable *pieces; + GSList *materials; +} +LeoCadLibrary; + +LeoCadLibrary *leocad_library_load(const gchar *libdir); +void leocad_library_free(LeoCadLibrary *library); +guint8 leocad_library_convert_color(guint8 n); +G3DObject *leocad_library_get_piece(LeoCadLibrary *library, const gchar *name); +G3DMaterial *leocad_library_get_nth_material(LeoCadLibrary *library, guint8 n); + +#endif /* IMP_LEOCAD_LIBRARY_H */ + -- cgit v1.1