Recovered from microbel

This commit is contained in:
rot
2025-03-05 08:35:31 +01:00
committed by h7x4
commit 88b92402a8
601 changed files with 82177 additions and 0 deletions

1
util/Makefile.am Normal file
View File

@@ -0,0 +1 @@
SUBDIRS = asc2bog geo2bog bogscale getgos convert2tex converttex

284
util/Makefile.in Normal file
View File

@@ -0,0 +1,284 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 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.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CC = @CC@
CXX = @CXX@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
LEX = @LEX@
MAKEINFO = @MAKEINFO@
NETLIBS = @NETLIBS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
TIFF_CFLAGS = @TIFF_CFLAGS@
TIFF_LIBS = @TIFF_LIBS@
VERSION = @VERSION@
YACC = @YACC@
SUBDIRS = asc2bog geo2bog bogscale getgos convert2tex converttex
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign util/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
@SET_MAKE@
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive info-recursive dvi-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
test "$$subdir" = "." && dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = util
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign util/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
for subdir in $(SUBDIRS); do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
chmod 777 $(distdir)/$$subdir; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
|| exit 1; \
fi; \
done
info-am:
info: info-recursive
dvi-am:
dvi: dvi-recursive
check-am: all-am
check: check-recursive
installcheck-am:
installcheck: installcheck-recursive
install-exec-am:
install-exec: install-exec-recursive
install-data-am:
install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-recursive
uninstall-am:
uninstall: uninstall-recursive
all-am: Makefile
all-redirect: all-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive
installdirs-am:
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-recursive
clean-am: clean-tags clean-generic mostlyclean-am
clean: clean-recursive
distclean-am: distclean-tags distclean-generic clean-am
distclean: distclean-recursive
maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-recursive
.PHONY: install-data-recursive uninstall-data-recursive \
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
uninstalldirs-recursive all-recursive check-recursive \
installcheck-recursive info-recursive dvi-recursive \
mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs-am \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# 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:

1
util/asc2bog/.cvsignore Normal file
View File

@@ -0,0 +1 @@
asc2bog asc_parse.h asc_parse.c asc_scan.c

15
util/asc2bog/Makefile.am Normal file
View File

@@ -0,0 +1,15 @@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = asc2bog
asc2bog_SOURCES = asc2bog.c asc_parse.y asc_scan.l parse.c util.c writebog.c
BUILT_SOURCES = asc_parse.c asc_parse.h
asc2bog_LDADD = -L../../common/lib/geometry -lgeometry -L../../common/lib/texture -ltexture -L../../common/lib/utils -lpvvmudutils -L../../common/lib/srvcli -lsrvcli @TIFF_LIBS@ -ltiff -lm
YFLAGS=-d
CC = $(CXX)
asc2bog.o: asc_parse.h

345
util/asc2bog/Makefile.in Normal file
View File

@@ -0,0 +1,345 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 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.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CXX = @CXX@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
LEX = @LEX@
MAKEINFO = @MAKEINFO@
NETLIBS = @NETLIBS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
TIFF_CFLAGS = @TIFF_CFLAGS@
TIFF_LIBS = @TIFF_LIBS@
VERSION = @VERSION@
YACC = @YACC@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = asc2bog
asc2bog_SOURCES = asc2bog.c asc_parse.y asc_scan.l parse.c util.c writebog.c
BUILT_SOURCES = asc_parse.c asc_parse.h
asc2bog_LDADD = -L../../common/lib/geometry -lgeometry -L../../common/lib/texture -ltexture -L../../common/lib/utils -lpvvmudutils -L../../common/lib/srvcli -lsrvcli @TIFF_LIBS@ -ltiff -lm
YFLAGS = -d
CC = $(CXX)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
asc2bog_OBJECTS = asc2bog.o asc_parse.o asc_scan.o parse.o util.o \
writebog.o
asc2bog_DEPENDENCIES =
asc2bog_LDFLAGS =
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LEXLIB = @LEXLIB@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in asc_parse.c asc_scan.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
DEP_FILES = .deps/asc2bog.P .deps/asc_parse.P .deps/asc_scan.P \
.deps/parse.P .deps/util.P .deps/writebog.P
SOURCES = $(asc2bog_SOURCES)
OBJECTS = $(asc2bog_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .l .o .s .y
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign util/asc2bog/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
asc2bog: $(asc2bog_OBJECTS) $(asc2bog_DEPENDENCIES)
@rm -f asc2bog
$(LINK) $(asc2bog_LDFLAGS) $(asc2bog_OBJECTS) $(asc2bog_LDADD) $(LIBS)
.l.c:
$(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
.y.c:
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
else :; fi
asc_parse.h: asc_parse.c
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = util/asc2bog
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign util/asc2bog/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-test -z "asc_scanlasc_parsehasc_parsec$(BUILT_SOURCES)" || rm -f asc_scanl asc_parseh asc_parsec $(BUILT_SOURCES)
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
distclean-depend distclean-generic clean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
distclean-depend clean-depend maintainer-clean-depend info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
asc2bog.o: asc_parse.h
# 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:

90
util/asc2bog/asc2bog.c Normal file
View File

@@ -0,0 +1,90 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "globals.h"
#include "parse.h"
#include "writebog.h"
FILE * source;
FILE * outfile;
FILE * ndbFile;
TreeNode_t * parseTree;
int main(int argc, char * argv[]){
char ascfile[256];
char ndbfile[256];
char bogfile[256];
if (argc != 2) {
fprintf(stderr,"usage: %s <filename>\n",argv[0]);
exit(1);
}
strcpy(ascfile,argv[1]);
if (strrchr (ascfile, '/') != NULL){
if (strchr (strrchr(ascfile,'/'), '.') == NULL)
strcat(ascfile,".ase");
} else if (strchr (ascfile, '.') == NULL)
strcat(ascfile,".ase");
source = fopen(ascfile,"r");
if (source == NULL){
fprintf(stderr,"File %s not found\n",ascfile);
exit(1);
}
if (strrchr(ascfile,'/') != NULL){
strcpy(bogfile,strrchr(ascfile,'/')+1);
} else strcpy(bogfile,ascfile);
strcpy(strchr(bogfile,'.'),".bog");
strcpy(ndbfile,bogfile);
strcpy(strchr(ndbfile,'.'),".ndb");
parseTree = parse();
fclose(source);
outfile = fopen(bogfile,"w");
if (outfile == NULL){
fprintf(stderr,"Error: Failed to open output file %s\n",bogfile);
exit(1);
}
ndbFile = fopen(ndbfile,"w");
if (ndbFile == NULL){
fprintf(stderr,"Error: Failed to open output file %s\n",ndbfile);
exit(1);
}
writebogfile(parseTree,outfile,ndbFile);
fclose(outfile);
fclose(ndbFile);
/* printTree(parseTree); */
return 0;
}

29
util/asc2bog/asc2bog.html Normal file
View File

@@ -0,0 +1,29 @@
<HTML>
<HEAD>
<TITLE>PVVMUD - asc2bog file converter</TITLE>
</HEAD>
<BODY>
<H1>asc2bog file converter</H1>
<P>asc2bog convert from 3DStudio asc file format to
<A HREF="../../doc/bogfileformat.html">bog file format</A> with a material
<A HREF="../../doc/ndbfileformat.html">ndb file</A>.</P>
<P><PRE>
Syntax: asc2bog file[.asc]
Output: file.bog and file.ndb
</PRE></P>
<P>The 3DStudioMax asc file export plugin are a example for developers of
3DStudioMax file exports plugins. The plugin and source code are located on the
3DStudioMAX CD. In time this utility will be replaced by a 3DStudioMAX plugin
that exports bog files.</P>
<P>Known buggs:
<UL>
<LI>Don't convert UV mapping
</UL>
</P>
</BODY>
</HTML>

126
util/asc2bog/asc_parse.y Normal file
View File

@@ -0,0 +1,126 @@
/* The geo2bog Yacc/Bison spesification file */
%{
#define YYPARSER /* distinguishes yacc output from other code files */
#include "globals.h"
#include "parse.h"
#include "util.h"
#define YYSTYPE TreeNode_t *
static TreeNode_t * savedTree; /* Stores syntax tree for later return */
%}
%token AMBIENT_LIGHT_COLOR NAMED_OBJECT TRIMESH VERTICES FACES MAPPED
%token MATERIAL VERTEX VERTEX_LIST FACE_LIST FACE SMOOTHING AB BC CA
%token RED GREEN BLUE ASSIGN SOLID_BACKGROUND_COLOR
%token FLOAT NUM STRING
%token ERROR
%%
geometry: head object_seq
{ savedTree = newGeometry($1,$2); }
;
head: AMBIENT_LIGHT_COLOR ':' color
{ $$ = newHead(); }
| AMBIENT_LIGHT_COLOR ':' color SOLID_BACKGROUND_COLOR ':' color { $$ = newHead(); }
;
color: RED ASSIGN float_num GREEN ASSIGN float_num BLUE ASSIGN float_num
;
float_num: FLOAT
{ $$ = newFloat(atof(tokenString)); }
;
object_seq: object_seq object
{ $$ = linkNode($1,$2); }
| object
{ $$ = $1; }
;
object: object_head object_geo
{ $$ = newObject($1,$2); }
;
object_head: NAMED_OBJECT ':' STRING
{
tokenString[strlen(tokenString)-1] = '\0';
$$ = newObjectHead(copyString(tokenString+1));
}
;
object_geo: trimesh_head vertex_list face_list
{ $$ = newTriMesh($1,$2,$3); }
;
trimesh_head: TRIMESH ',' VERTICES ':' num FACES ':' num MAPPED
{ $$ = newTriMeshHead($5,$8,TRUE); }
| TRIMESH ',' VERTICES ':' num FACES ':' num
{ $$ = newTriMeshHead($5,$8,FALSE); }
;
num: NUM
{ $$ = newNum(atoi(tokenString)); }
;
vertex_list: VERTEX_LIST ':' vertex_seq
{ $$ = $3; }
;
vertex_seq: vertex_seq vertex
{ $$ = linkNode($1,$2); }
| vertex
{ $$ = $1; }
;
vertex: vertex_coord uv_mapping
{ $$ = linkNode($1,$2); }
| vertex_coord
{ $$ = $1; }
;
uv_mapping: 'U' ':' float_num 'V' ':' float_num
{ $$ = newUVMapping($3,$6); }
vertex_coord: VERTEX num ':' 'X' ':' float_num 'Y' ':' float_num 'Z' ':' float_num
{ $$ = newVertex($2,$6,$9,$12); }
;
face_list: FACE_LIST ':' face_seq
{ $$ = $3; }
;
face_seq: face_seq face_index
{ $$ = linkNode($1,$2); }
| face_index
{ $$ = $1; }
;
face_index: face face_opt_seq
{ $$ = linkNode($1,$2); }
| face
{ $$ = $1; }
;
face: FACE num ':' 'A' ':' num 'B' ':' num 'C' ':' num AB ':' num BC ':' num CA ':' num
{ $$ = newFace($2,$6,$9,$12); }
;
face_opt_seq: face_opt_seq face_opt
{ $$ = linkNode($1,$2); }
| face_opt
{ $$ = $1; }
;
face_opt: material
{ $$ = $1; }
| smoothing
{ $$ = $1; }
;
material: MATERIAL ':' STRING
{
tokenString[strlen(tokenString)-1] = '\0';
$$ = newMaterial(copyString(tokenString+1));
}
;
smoothing: SMOOTHING ':' num
{ $$ = newSmoothing($3); }
;
%%
static TokenType yylex(){
return getToken();
}
int yyerror(char * message){
printf("Syntax error at line %d: %s\n",lineno,message);
return 0;
}
TreeNode_t * parse(){
yyparse();
return savedTree;
}

76
util/asc2bog/asc_scan.l Normal file
View File

@@ -0,0 +1,76 @@
/* Lex spesification for asc2bog */
%option noyywrap
%o 4000
%{
#define YYLEX
#include "globals.h"
int lineno;
char tokenString[MAXTOKENLEN+1];
%}
digit [0-9]
nat {digit}+
signedNat ("+"|"-")?{nat}
floating {signedNat}("."{nat})?
string \"([^\"]|\\\")+\"
newline \n
whitespace [ \t\r]+
%%
"Ambient light color" { return AMBIENT_LIGHT_COLOR; }
"Solid background color" { return SOLID_BACKGROUND_COLOR; }
"Red" { return RED; }
"Green" { return GREEN; }
"Blue" { return BLUE; }
"Named object" { return NAMED_OBJECT; }
"Tri-mesh" { return TRIMESH; }
"Vertices" { return VERTICES; }
"Faces" { return FACES; }
"Mapped" { return MAPPED; }
"Vertex list" { return VERTEX_LIST; }
"Vertex" { return VERTEX; }
"Face list" { return FACE_LIST; }
"Face" { return FACE; }
"Material" { return MATERIAL; }
"Smoothing" { return SMOOTHING; }
"AB" { return AB; }
"BC" { return BC; }
"CA" { return CA; }
"=" { return ASSIGN; }
[:,XYZUVABC] { return yytext[0]; }
{nat} { return NUM; }
{floating} { return FLOAT; }
{string} { return STRING; }
{whitespace} { /* Skip */ }
{newline} { lineno++; }
. { return ERROR; }
%%
TokenType getToken(){
TokenType currentToken;
static int firstTime = TRUE;
if (firstTime){
firstTime = FALSE;
yyin = source;
lineno++;
}
currentToken = yylex();
strncpy(tokenString,yytext,MAXTOKENLEN);
return currentToken;
}
#if 0 /* ndef LINUX */
int yywrap(void){
return 1;
}
#endif

86
util/asc2bog/globals.h Normal file
View File

@@ -0,0 +1,86 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "bogfile.H"
#ifndef YYPARSER
#include "asc_parse.h"
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define WORD unsigned short int
#define MAXTOKENLEN 64
#define MAXCHILDREN 4
typedef int TokenType;
extern int lineno;
extern char tokenString[MAXTOKENLEN+1];
extern FILE * source;
/******************************************************************************
*
* Syntax tree for parsing
*
*****************************************************************************/
typedef enum {GeometryK,FloatK,HeadK,ObjectK,NumK,ObjectHeadK,UVMappingK,VertexK,FaceK,MaterialK,SmoothingK,TriMeshK,TriMeshHeadK} NodeKind_t;
typedef struct treeNode {
NodeKind_t nodeKind;
struct treeNode * sibling;
struct treeNode * child[MAXCHILDREN];
union {
int index;
int num;
int mapped;
float value;
char * name;
PolyType_t polyType;
} attr;
} TreeNode_t;
/*
Declarations to prevent SYMBOL NOT FOUND in c+
*/
static TokenType yylex();
int yyerror(char *);
extern int getToken();
#endif /* _GLOBALS_H */

244
util/asc2bog/parse.c Normal file
View File

@@ -0,0 +1,244 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "globals.h"
#include "parse.h"
TreeNode_t * linkNode(TreeNode_t * n1, TreeNode_t * n2){
TreeNode_t * t = n1;
if (t != NULL) {
while (t->sibling != NULL)
t = t->sibling;
t->sibling = n2;
return n1;
} else return n2;
}
TreeNode_t * newGeometry(TreeNode_t * head, TreeNode_t * object){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = GeometryK;
treeNode->child[0] = head;
treeNode->child[1] = object;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newHead(){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = HeadK;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newFloat(float value){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = FloatK;
treeNode->attr.value = value;
return treeNode;
}
TreeNode_t * newObject(TreeNode_t * head, TreeNode_t * objGeo){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = ObjectK;
treeNode->child[0] = head;
treeNode->child[1] = objGeo;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newTriMesh(TreeNode_t * triMeshHead, TreeNode_t * vertexList, TreeNode_t * faceList){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = TriMeshK;
treeNode->child[0] = triMeshHead;
treeNode->child[1] = vertexList;
treeNode->child[2] = faceList;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newNum(int num){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = NumK;
treeNode->attr.num = num;
return treeNode;
}
TreeNode_t * newObjectHead(char * name){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = ObjectHeadK;
treeNode->attr.name = name;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newTriMeshHead(TreeNode_t * vertexNum, TreeNode_t * faceNum, int mapped){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = TriMeshHeadK;
treeNode->child[0] = vertexNum;
treeNode->child[1] = faceNum;
treeNode->sibling = NULL;
treeNode->attr.mapped = mapped;
return treeNode;
}
TreeNode_t * newVertex(TreeNode_t * num, TreeNode_t * v1, TreeNode_t * v2, TreeNode_t * v3){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = VertexK;
treeNode->child[0] = num;
treeNode->child[1] = v1;
treeNode->child[2] = v2;
treeNode->child[3] = v3;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newUVMapping(TreeNode_t * u, TreeNode_t * v){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = UVMappingK;
treeNode->child[0] = u;
treeNode->child[1] = v;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newFace(TreeNode_t * num, TreeNode_t * v1, TreeNode_t * v2, TreeNode_t * v3){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = FaceK;
treeNode->child[0] = num;
treeNode->child[1] = v1;
treeNode->child[2] = v2;
treeNode->child[3] = v3;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newMaterial(char * name){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = MaterialK;
treeNode->attr.name = name;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newSmoothing(TreeNode_t * smoothing){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = SmoothingK;
treeNode->child[0] = smoothing;
treeNode->sibling = NULL;
return treeNode;
}
void printTree(TreeNode_t * node){
if (node == NULL) return;
switch (node->nodeKind){
case GeometryK:
printf("Geometry {\n");
printTree(node->child[0]);
printTree(node->child[1]);
printf("}\n");
break;
case HeadK:
printf("\tHead\n");
break;
case FloatK:
printf("%f",node->attr.value);
break;
case ObjectK:
printf("\tObject = [\n");
printTree(node->child[0]);
printTree(node->child[1]);
printf("\t];\n");
printTree(node->sibling);
break;
case ObjectHeadK:
printf("\t\tHead %s\n",node->attr.name);
break;
case TriMeshK:
printf("\t\tTri-Mesh [\n");
printTree(node->child[0]);
printTree(node->child[1]);
printTree(node->child[2]);
printf("\t\t];\n");
break;
case TriMeshHeadK:
printf("\t\t\tHead ( ");
printTree(node->child[0]);
printf(", ");
printTree(node->child[1]);
printf(", %i)\n",node->attr.mapped);
break;
case NumK:
printf("%i",node->attr.num);
if (node->sibling != NULL){
printf(", ");
printTree(node->sibling);
}
break;
case VertexK:
printf("\t\t\tXYZ ( ");
printTree(node->child[0]);
printf(": ");
printTree(node->child[1]);
printf(", ");
printTree(node->child[2]);
printf(", ");
printTree(node->child[3]);
printf(")\n");
if (node->sibling != NULL) {
printTree(node->sibling);
}
break;
case UVMappingK:
printf("\t\t\tUV ( ");
printTree(node->child[0]);
printf(", ");
printTree(node->child[1]);
printf(")\n");
if (node->sibling != NULL) {
printTree(node->sibling);
}
break;
case FaceK:
printf("\t\t\tFace( ");
printTree(node->child[0]);
printf(": ");
printTree(node->child[1]);
printf(", ");
printTree(node->child[2]);
printf(", ");
printTree(node->child[3]);
printf(")\n");
if (node->sibling != NULL) {
printTree(node->sibling);
}
break;
case MaterialK:
printf("\t\t\tMaterial = \"%s\"\n",node->attr.name);
printTree(node->sibling);
break;
case SmoothingK:
printf("\t\t\tSmoothing = ");
printTree(node->child[0]);
printf("\n");
printTree(node->sibling);
break;
}
}

44
util/asc2bog/parse.h Normal file
View File

@@ -0,0 +1,44 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _PARS_H
#define _PARS_H
TreeNode_t * parse(void);
TreeNode_t * linkNode(TreeNode_t * n1, TreeNode_t * n2 );
TreeNode_t * newGeometry(TreeNode_t * head, TreeNode_t * object);
TreeNode_t * newHead();
TreeNode_t * newFloat(float value);
TreeNode_t * newObject(TreeNode_t * head, TreeNode_t * objGeo);
TreeNode_t * newNum(int num);
TreeNode_t * newObjectHead(char * name);
TreeNode_t * newTriMesh(TreeNode_t * triMeshHead, TreeNode_t * vertexList, TreeNode_t * faceList);
TreeNode_t * newTriMeshHead(TreeNode_t * vertexnum, TreeNode_t * facenum, int mapped);
TreeNode_t * newVertex(TreeNode_t * num, TreeNode_t * v1, TreeNode_t * v2, TreeNode_t * v3);
TreeNode_t * newUVMapping(TreeNode_t * u, TreeNode_t * v);
TreeNode_t * newFace(TreeNode_t * num, TreeNode_t * v1, TreeNode_t * v2, TreeNode_t * v3);
TreeNode_t * newMaterial(char * name );
TreeNode_t * newSmoothing(TreeNode_t * smoothing);
void printTree(TreeNode_t * node);
#endif /* _PARS_H */

35
util/asc2bog/util.c Normal file
View File

@@ -0,0 +1,35 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "globals.h"
#include "util.h"
char * copyString(char * s){
int n;
char * t;
if (s==NULL) return NULL;
n = strlen(s)+1;
t = (char *)malloc(n);
if (t==NULL)
printf("Error: Out of memory error at line %d\n",lineno);
else strcpy(t,s);
return t;
}

22
util/asc2bog/util.h Normal file
View File

@@ -0,0 +1,22 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
char * copyString(char * s);

228
util/asc2bog/writebog.c Normal file
View File

@@ -0,0 +1,228 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <GL/gl.h>
#include <math.h>
#include "globals.h"
#include "writebog.h"
#include "geometry.H"
#include "namedb.H"
void countElements(TreeNode_t * node, WORD * numV, WORD * numN,
WORD * numTC, WORD * numP){
if (node == NULL) return;
switch (node->nodeKind){
case GeometryK:
countElements(node->child[1],numV,numN,numTC,numP);
break;
case ObjectK:
countElements(node->child[1],numV,numN,numTC,numP);
countElements(node->sibling,numV,numN,numTC,numP);
break;
case VertexK:
(*numV)++;
countElements(node->sibling,numV,numN,numTC,numP);
break;
case UVMappingK:
(*numTC)++;
countElements(node->sibling,numV,numN,numTC,numP);
break;
case FaceK:
(*numN)++;
countElements(node->sibling,numV,numN,numTC,numP);
break;
case MaterialK:
case SmoothingK:
countElements(node->sibling,numV,numN,numTC,numP);
break;
case TriMeshK:
(*numP)++;
countElements(node->child[1],numV,numN,numTC,numP);
countElements(node->child[2],numV,numN,numTC,numP);
countElements(node->sibling,numV,numN,numTC,numP);
break;
}
}
void CalcNorm(CGeometry * geo,float * xx, float * yy,float * zz,
int v1, int v2, int v3){
double dx1,dy1,dz1,dx2,dy2,dz2;
double v1x,v1y,v1z,v2x,v2y,v2z,v3x,v3y,v3z;
double x,y,z,l;
geo->getVertex(v1,&v1x,&v1y,&v1z);
geo->getVertex(v2,&v2x,&v2y,&v2z);
geo->getVertex(v3,&v3x,&v3y,&v3z);
dx1 = v1x - v2x;
dy1 = v1y - v2y;
dz1 = v1z - v2z;
dx2 = v2x - v3x;
dy2 = v2y - v3y;
dz2 = v2z - v3z;
x = dy1*dz2 - dy2*dz1;
y = dx2*dz1 - dx1*dz2;
z = dx1*dy2 - dx2*dy1;
l = sqrt(x*x+y*y+z*z);
*xx = x/l;
*yy = y/l;
*zz = z/l;
}
int * vertexIndexMap;
CPolygon * poly;
int normalIndex;
int * normalIndexMap;
int * texCoordIndexMap;
int texCoordIndex;
CNameDB * nameDB;
void buildGeo(CGeometry * geo, TreeNode_t * node){
int ii,index,v1,v2,v3;
int numVertices,numFaces,numTexCoords;
float xx,yy,zz;
if (node == NULL) return;
switch (node->nodeKind){
case GeometryK:
vertexIndexMap = NULL;
normalIndex = 0;
buildGeo(geo,node->child[1]);
break;
case ObjectK:
buildGeo(geo,node->child[1]);
buildGeo(geo,node->sibling);
break;
case TriMeshK:
buildGeo(geo,node->child[0]);
buildGeo(geo,node->child[1]);
buildGeo(geo,node->child[2]);
geo->addPolygon(poly);
break;
case TriMeshHeadK:
if (vertexIndexMap != NULL) free(vertexIndexMap);
if (texCoordIndexMap != NULL) free(texCoordIndexMap);
numVertices = node->child[0]->attr.num;
numFaces = node->child[1]->attr.num;
numTexCoords = (node->attr.mapped ? numFaces*3 : 0 );
vertexIndexMap = (int *)malloc( numVertices * sizeof(int) );
if (numTexCoords != 0){
texCoordIndexMap = (int *)malloc( numTexCoords * sizeof(int) );
} else texCoordIndexMap = NULL;
poly = new CPolygon( PT_Triangles , 0, numFaces*3, numFaces, numTexCoords );
break;
case VertexK:
index = node->child[0]->attr.num;
xx = node->child[1]->attr.value;
yy = node->child[2]->attr.value;
zz = node->child[3]->attr.value;
vertexIndexMap[index] = geo->addVertex(xx,yy,zz);
texCoordIndex = index;
buildGeo(geo,node->sibling);
break;
case FaceK:
v1 = node->child[1]->attr.num;
v2 = node->child[2]->attr.num;
v3 = node->child[3]->attr.num;
poly->addVertexIndex(vertexIndexMap[v1]);
poly->addVertexIndex(vertexIndexMap[v2]);
poly->addVertexIndex(vertexIndexMap[v3]);
if (texCoordIndexMap != NULL){
poly->addTexCoordIndex(texCoordIndexMap[v1]);
poly->addTexCoordIndex(texCoordIndexMap[v2]);
poly->addTexCoordIndex(texCoordIndexMap[v3]);
}
/* Calculate Normal vector to Face */
CalcNorm(geo,&xx,&yy,&zz,vertexIndexMap[v1],
vertexIndexMap[v2],vertexIndexMap[v3]);
normalIndexMap[normalIndex] = geo->addNormal(xx,yy,zz);
poly->addNormalIndex(normalIndexMap[normalIndex]);
normalIndex++;
buildGeo(geo,node->sibling);
break;
case MaterialK:
poly->setMaterial(nameDB->insert(node->attr.name));
buildGeo(geo,node->sibling);
break;
case SmoothingK:
buildGeo(geo,node->sibling);
break;
case UVMappingK:
xx = node->child[0]->attr.value;
yy = node->child[1]->attr.value;
if (texCoordIndexMap != NULL){
texCoordIndexMap[texCoordIndex] = geo->addTexCoord(xx,yy);
}
buildGeo(geo,node->sibling);
break;
}
}
void writebogfile(TreeNode_t * node, FILE * bogfile, FILE * ndbfile ){
WORD numVertices,numNormals,numTexCoords,numPolygons;
CGeometry * geo;
numVertices = 0;
numNormals = 0;
numTexCoords = 0;
numPolygons = 0;
countElements(node,&numVertices,&numNormals,&numTexCoords,&numPolygons);
geo = new CGeometry(0,numVertices,numNormals,
numTexCoords,numPolygons);
normalIndexMap = (int *)malloc( numNormals * sizeof(int) );
nameDB = new CNameDB();
buildGeo(geo,node);
geo->writeBOG(bogfile);
nameDB->writeNDB(ndbfile);
delete geo;
delete nameDB;
}

25
util/asc2bog/writebog.h Normal file
View File

@@ -0,0 +1,25 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _WRITEBOG_H
#define _WRITEBOG_H
void writebogfile(TreeNode_t * node, FILE * bogfile, FILE * ndbfile);
#endif /* _WRITEBOG_H */

1
util/bogscale/.cvsignore Normal file
View File

@@ -0,0 +1 @@
bogscale

View File

@@ -0,0 +1,8 @@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = bogscale
bogscale_SOURCES = bogscale.C
bogscale_LDADD = -L../../common/lib/geometry -lgeometry -L../../common/lib/texture -ltexture -L../../common/lib/utils -lpvvmudutils -L../../common/lib/srvcli -lsrvcli @TIFF_LIBS@ -ltiff -lm

345
util/bogscale/Makefile.in Normal file
View File

@@ -0,0 +1,345 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 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.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CC = @CC@
CXX = @CXX@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
LEX = @LEX@
MAKEINFO = @MAKEINFO@
NETLIBS = @NETLIBS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
TIFF_CFLAGS = @TIFF_CFLAGS@
TIFF_LIBS = @TIFF_LIBS@
VERSION = @VERSION@
YACC = @YACC@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = bogscale
bogscale_SOURCES = bogscale.C
bogscale_LDADD = -L../../common/lib/geometry -lgeometry -L../../common/lib/texture -ltexture -L../../common/lib/utils -lpvvmudutils -L../../common/lib/srvcli -lsrvcli @TIFF_LIBS@ -ltiff -lm
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
bogscale_OBJECTS = bogscale.o
bogscale_DEPENDENCIES =
bogscale_LDFLAGS =
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
DEP_FILES = .deps/bogscale.P
SOURCES = $(bogscale_SOURCES)
OBJECTS = $(bogscale_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .C .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign util/bogscale/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
bogscale: $(bogscale_OBJECTS) $(bogscale_DEPENDENCIES)
@rm -f bogscale
$(CXXLINK) $(bogscale_LDFLAGS) $(bogscale_OBJECTS) $(bogscale_LDADD) $(LIBS)
.C.o:
$(CXXCOMPILE) -c $<
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = util/bogscale
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign util/bogscale/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
%.o: %.C
@echo '$(CXXCOMPILE) -c $<'; \
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.C
@echo '$(LTCXXCOMPILE) -c $<'; \
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
distclean-depend distclean-generic clean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
distclean-depend clean-depend maintainer-clean-depend info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# 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:

60
util/bogscale/bogscale.C Normal file
View File

@@ -0,0 +1,60 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <strings.h>
#include "geometry.H"
int main(int argc, char * argv[]){
char bogfile[256];
float scale;
FILE * source;
CGeometry * geo;
if (argc != 3) {
fprintf(stderr,"usage: %s scale <filename>\n",argv[0]);
exit(1);
}
strcpy(bogfile,argv[2]);
if (strrchr (bogfile, '/') != NULL){
if (strchr (strrchr(bogfile,'/'), '.') == NULL)
strcat(bogfile,".bog");
} else if (strchr (bogfile, '.') == NULL)
strcat(bogfile,".bog");
sscanf(argv[1],"%f",&scale);
printf("Scale: %f\n",scale);
geo = new CGeometry(1);
geo->load(bogfile);
geo->scale(scale);
geo->save(bogfile);
return 0;
}

View File

@@ -0,0 +1 @@
convert2tex

View File

@@ -0,0 +1,8 @@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = convert2tex
convert2tex_SOURCES = convert2tex.C
convert2tex_LDADD = -L../../common/lib/texture -ltexture -L../../common/lib/geometry -lgeometry -L../../common/lib/utils -lpvvmudutils -L../../common/lib/gos -lgos -L../../common/lib/srvcli -lsrvcli @TIFF_LIBS@ -ltiff -lm

View File

@@ -0,0 +1,345 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 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.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CC = @CC@
CXX = @CXX@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
LEX = @LEX@
MAKEINFO = @MAKEINFO@
NETLIBS = @NETLIBS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
TIFF_CFLAGS = @TIFF_CFLAGS@
TIFF_LIBS = @TIFF_LIBS@
VERSION = @VERSION@
YACC = @YACC@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = convert2tex
convert2tex_SOURCES = convert2tex.C
convert2tex_LDADD = -L../../common/lib/texture -ltexture -L../../common/lib/geometry -lgeometry -L../../common/lib/utils -lpvvmudutils -L../../common/lib/gos -lgos -L../../common/lib/srvcli -lsrvcli @TIFF_LIBS@ -ltiff -lm
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
convert2tex_OBJECTS = convert2tex.o
convert2tex_DEPENDENCIES =
convert2tex_LDFLAGS =
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
DEP_FILES = .deps/convert2tex.P
SOURCES = $(convert2tex_SOURCES)
OBJECTS = $(convert2tex_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .C .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign util/convert2tex/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
convert2tex: $(convert2tex_OBJECTS) $(convert2tex_DEPENDENCIES)
@rm -f convert2tex
$(CXXLINK) $(convert2tex_LDFLAGS) $(convert2tex_OBJECTS) $(convert2tex_LDADD) $(LIBS)
.C.o:
$(CXXCOMPILE) -c $<
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = util/convert2tex
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign util/convert2tex/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
%.o: %.C
@echo '$(CXXCOMPILE) -c $<'; \
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.C
@echo '$(LTCXXCOMPILE) -c $<'; \
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
distclean-depend distclean-generic clean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
distclean-depend clean-depend maintainer-clean-depend info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# 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:

View File

@@ -0,0 +1,44 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "pvvmud.H"
#include <stdio.h>
#include <stdlib.h>
#include "texture.H"
int main(int argc, char * argv[]){
if (argc != 3) {
fprintf(stderr,"usage: %s <image file> <texture map id>\n",argv[0]);
exit(1);
}
int id = atoi(argv[2]);
char name[256];
sprintf(name,"%i.tex",id);
CTexture * texture = new CTexture(id);
texture->load(argv[1]);
texture->save(name);
delete texture;
return 0;
}

View File

@@ -0,0 +1 @@
converttex

View File

@@ -0,0 +1,8 @@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = converttex
converttex_SOURCES = converttex.C
converttex_LDADD = -L../../common/lib/texture -ltexture -L../../common/lib/geometry -lgeometry -L../../common/lib/utils -lpvvmudutils -L../../common/lib/gos -lgos -L../../common/lib/srvcli -lsrvcli @TIFF_LIBS@ -ltiff -lm

345
util/converttex/Makefile.in Normal file
View File

@@ -0,0 +1,345 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 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.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CC = @CC@
CXX = @CXX@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
LEX = @LEX@
MAKEINFO = @MAKEINFO@
NETLIBS = @NETLIBS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
TIFF_CFLAGS = @TIFF_CFLAGS@
TIFF_LIBS = @TIFF_LIBS@
VERSION = @VERSION@
YACC = @YACC@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = converttex
converttex_SOURCES = converttex.C
converttex_LDADD = -L../../common/lib/texture -ltexture -L../../common/lib/geometry -lgeometry -L../../common/lib/utils -lpvvmudutils -L../../common/lib/gos -lgos -L../../common/lib/srvcli -lsrvcli @TIFF_LIBS@ -ltiff -lm
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
converttex_OBJECTS = converttex.o
converttex_DEPENDENCIES =
converttex_LDFLAGS =
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
DEP_FILES = .deps/converttex.P
SOURCES = $(converttex_SOURCES)
OBJECTS = $(converttex_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .C .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign util/converttex/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
converttex: $(converttex_OBJECTS) $(converttex_DEPENDENCIES)
@rm -f converttex
$(CXXLINK) $(converttex_LDFLAGS) $(converttex_OBJECTS) $(converttex_LDADD) $(LIBS)
.C.o:
$(CXXCOMPILE) -c $<
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = util/converttex
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign util/converttex/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
%.o: %.C
@echo '$(CXXCOMPILE) -c $<'; \
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.C
@echo '$(LTCXXCOMPILE) -c $<'; \
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
distclean-depend distclean-generic clean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
distclean-depend clean-depend maintainer-clean-depend info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# 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:

View File

@@ -0,0 +1,57 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "pvvmud.H"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "texture.H"
int main(int argc, char * argv[]){
if (argc != 2 && argc != 3) {
fprintf(stderr,
"usage: %s [ <source file> | <source file> <dest file> ]\n",
argv[0]);
exit(1);
}
char *source = argv[1];
char *dest,name[1024];
if (argc == 3){
dest = argv[2];
} else {
if (strlen(source) > 1024) exit(1);
strcpy(name,source);
char *ch = strrchr(source,'.');
strcpy(ch,".tex");
}
printf("Converting: %s -> %s\n",source,dest);
CTexture * texture = new CTexture();
texture->load(source);
texture->save(dest);
delete texture;
return 0;
}

1
util/geo2bog/.cvsignore Normal file
View File

@@ -0,0 +1 @@
geo2bog geo_parse.h geo_parse.c geo_scan.c

16
util/geo2bog/Makefile.am Normal file
View File

@@ -0,0 +1,16 @@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = geo2bog
geo2bog_SOURCES = geo2bog.c geo_parse.y geo_scan.l parse.c util.c writebog.c
geo2bog_LDADD = -L../../common/lib/geometry -lgeometry -L../../common/lib/texture -ltexture -L../../common/lib/utils -lpvvmudutils -L../../common/lib/srvcli -lsrvcli @TIFF_LIBS@ -ltiff -lm
BUILT_SOURCES = geo_parse.h geo_parse.c geo_scan.c
YFLAGS=-d
CC = $(CXX)
geo_parse.h: geo_parse.c
geo2bog.o: geo_parse.h

346
util/geo2bog/Makefile.in Normal file
View File

@@ -0,0 +1,346 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 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.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CXX = @CXX@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
LEX = @LEX@
MAKEINFO = @MAKEINFO@
NETLIBS = @NETLIBS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
TIFF_CFLAGS = @TIFF_CFLAGS@
TIFF_LIBS = @TIFF_LIBS@
VERSION = @VERSION@
YACC = @YACC@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = geo2bog
geo2bog_SOURCES = geo2bog.c geo_parse.y geo_scan.l parse.c util.c writebog.c
geo2bog_LDADD = -L../../common/lib/geometry -lgeometry -L../../common/lib/texture -ltexture -L../../common/lib/utils -lpvvmudutils -L../../common/lib/srvcli -lsrvcli @TIFF_LIBS@ -ltiff -lm
BUILT_SOURCES = geo_parse.h geo_parse.c geo_scan.c
YFLAGS = -d
CC = $(CXX)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
geo2bog_OBJECTS = geo2bog.o geo_parse.o geo_scan.o parse.o util.o \
writebog.o
geo2bog_DEPENDENCIES =
geo2bog_LDFLAGS =
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LEXLIB = @LEXLIB@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in geo_parse.c geo_scan.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
DEP_FILES = .deps/geo2bog.P .deps/geo_parse.P .deps/geo_scan.P \
.deps/parse.P .deps/util.P .deps/writebog.P
SOURCES = $(geo2bog_SOURCES)
OBJECTS = $(geo2bog_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .l .o .s .y
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign util/geo2bog/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
geo2bog: $(geo2bog_OBJECTS) $(geo2bog_DEPENDENCIES)
@rm -f geo2bog
$(LINK) $(geo2bog_LDFLAGS) $(geo2bog_OBJECTS) $(geo2bog_LDADD) $(LIBS)
.l.c:
$(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
.y.c:
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
else :; fi
geo_parse.h: geo_parse.c
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = util/geo2bog
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign util/geo2bog/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-test -z "geo_scanlgeo_parsehgeo_parsec$(BUILT_SOURCES)" || rm -f geo_scanl geo_parseh geo_parsec $(BUILT_SOURCES)
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
distclean-depend distclean-generic clean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
distclean-depend clean-depend maintainer-clean-depend info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
geo_parse.h: geo_parse.c
geo2bog.o: geo_parse.h
# 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:

89
util/geo2bog/geo2bog.c Normal file
View File

@@ -0,0 +1,89 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "globals.h"
#include "parse.h"
FILE * source;
FILE * outfile;
FILE * ndbFile;
TreeNode_t * parseTree;
int main(int argc, char * argv[]){
char geofile[256];
char bogfile[256];
char ndbfile[256];
if (argc != 2) {
fprintf(stderr,"usage: %s <filename>\n",argv[0]);
exit(1);
}
strcpy(geofile,argv[1]);
if (strrchr (geofile, '/') != NULL){
if (strchr (strrchr(geofile,'/'), '.') == NULL)
strcat(geofile,".geo");
} else if (strchr (geofile, '.') == NULL)
strcat(geofile,".geo");
source = fopen(geofile,"r");
if (source == NULL){
fprintf(stderr,"File %s not found\n",geofile);
exit(1);
}
if (strrchr(geofile,'/') != NULL){
strcpy(bogfile,strrchr(geofile,'/')+1);
} else strcpy(bogfile,geofile);
strcpy(strchr(bogfile,'.'),".bog");
outfile = fopen(bogfile,"w");
if (outfile == NULL){
fprintf(stderr,"Error: Failed to open output file %s\n",bogfile);
exit(1);
}
strcpy(ndbfile,bogfile);
strcpy(strchr(ndbfile,'.'),".ndb");
parseTree = parse();
fclose(source);
ndbFile = fopen(ndbfile,"w");
if (ndbFile == NULL){
fprintf(stderr,"Error: Failed to open output file %s\n",ndbfile);
exit(1);
}
writebogfile(parseTree,outfile,ndbFile);
fclose(outfile);
fclose(ndbFile);
/* printTree(parseTree); */
return 0;
}

11
util/geo2bog/geo2bog.html Normal file
View File

@@ -0,0 +1,11 @@
<HTML>
<HEAD>
<TITLE>PVVMUD - geo2bog file converter</TITLE>
</HEAD>
<BODY>
<H1>geo2bog file converter</H1>
Se <A HREF="../../doc/geo2bog.html">doc/geo2bog.html</A> for current doc!
</BODY>
</HTML>

187
util/geo2bog/geo_parse.y Normal file
View File

@@ -0,0 +1,187 @@
/* The geo2bog Yacc/Bison spesification file */
%{
#define YYPARSER /* distinguishes yacc output from other code files */
#include "globals.h"
#include "parse.h"
#include "util.h"
#define YYSTYPE TreeNode_t *
static TreeNode_t * savedTree; /* Stores syntax tree for later return */
%}
%token GEO FILEVERSION GEOMETRY VERTEXLIST NORMALLIST TEXCOORDLIST POLYGON
%token TYPE MATERIAL VERTEX NORMAL TEXCOORD NAME
%token TRIANGLES QUADS QUAD_STRIP TRIANGLE_STRIP TRIANGLE_FAN
%token ASSIGN FLOAT NUM STRING
%token ERROR
%%
goeFile: geoHead geometry_seq
{ savedTree = newFile($1,$2); }
| geometry_seq
{ savedTree = newFile(NULL,$1); }
;
geoHead: GEO '(' FILEVERSION ASSIGN float_num ')'
{ $$ = newHead($5); }
;
geometry_seq: geometry_seq geometry
{ $$ = linkNode($1,$2); }
| geometry
{ $$ = $1; }
;
geometry: GEOMETRY '{' list_seq poly_seq '}'
{ $$ = newGeometry($3,$4); }
| GEOMETRY '(' NAME ASSIGN STRING ')' '{' list_seq poly_seq '}'
{ $$ = newGeometry($8,$9); }
;
list_seq: list_seq list
{ $$ = linkNode($1,$2); }
| list
{ $$ = $1; }
;
list: vertexlist ';'
{ $$ = $1; }
| normallist ';'
{ $$ = $1; }
| texcoordlist ';'
{ $$ = $1; }
;
vertexlist: VERTEXLIST ASSIGN '[' vertex_seq ']'
{ $$ = newVertexList($4); }
;
vertex_seq: vertex_seq ',' vertex
{ $$ = linkNode($1,$3); }
| vertex
{ $$ = $1; }
;
vertex: '(' float_num ',' float_num ',' float_num ')'
{ $$ = newVertex($2,$4,$6); }
;
float_num: FLOAT
{ $$ = newFloat((float)atof(tokenString)); }
| NUM
{ $$ = newFloat((float)atof(tokenString)); }
;
normallist: NORMALLIST ASSIGN '[' normal_seq ']'
{ $$ = newNormalList($4); }
;
normal_seq: normal_seq ',' normal
{ $$ = linkNode($1,$3); }
| normal
{ $$ = $1; }
;
normal: '(' float_num ',' float_num ',' float_num ')'
{ $$ = newNormal($2,$4,$6); }
;
texcoordlist: TEXCOORDLIST ASSIGN '[' texcoord_seq ']'
{ $$ = newTexCoordList($4); }
;
texcoord_seq: texcoord_seq ',' texcoord
{ $$ = linkNode($1,$3); }
| texcoord
{ $$ = $1; }
;
texcoord: '(' float_num ',' float_num ')'
{ $$ = newTexCoord($2,$4); }
;
poly_seq: poly_seq poly
{ $$ = linkNode($1,$2); }
| poly
{ $$ = $1; }
;
poly: POLYGON '{' polyattrib_seq '}'
{ $$ = newPoly($3); }
;
polyattrib_seq : polyattrib_seq polyattrib
{ $$ = linkNode($1,$2); }
| polyattrib
{ $$ = $1; }
;
polyattrib: type ';'
{ $$ = $1; }
| material ';'
{ $$ = $1; }
| vertexindexlst ';'
{ $$ = $1; }
| normalindexlst ';'
{ $$ = $1; }
| texindexlst ';'
{ $$ = $1; }
;
type: TYPE ASSIGN polytype
{ $$ = $3; }
;
polytype: POLYGON
{ $$ = newPolyType(PT_Polygon); }
| TRIANGLES
{ $$ = newPolyType(PT_Triangles); }
| QUADS
{ $$ = newPolyType(PT_Quads); }
| QUAD_STRIP
{ $$ = newPolyType(PT_Quad_strip); }
| TRIANGLE_STRIP
{ $$ = newPolyType(PT_Triangle_strip); }
| TRIANGLE_FAN
{ $$ = newPolyType(PT_Triangle_fan); }
;
material: MATERIAL ASSIGN STRING
{
tokenString[strlen(tokenString)-1] = '\0';
$$ = newMaterial(copyString(tokenString+1));
}
;
vertexindexlst: VERTEX ASSIGN '[' vertexindexseq ']'
{ $$ = newVertexIndexList($4); }
;
vertexindexseq: vertexindexseq ',' vertexindex
{ $$ = linkNode($1,$3); }
| vertexindex
{ $$ = $1; }
;
vertexindex: index
{ $$ = $1; }
;
normalindexlst: NORMAL ASSIGN '[' normalindexseq ']'
{ $$ = newNormalIndexList($4); }
;
normalindexseq: normalindexseq ',' normalindex
{ $$ = linkNode($1,$3); }
| normalindex
{ $$ = $1; }
;
normalindex: index
{ $$ = $1; }
;
texindexlst: TEXCOORD ASSIGN '[' texindexseq ']'
{ $$ = newTexCoordIndexList($4); }
;
texindexseq: texindexseq ',' texindex
{ $$ = linkNode($1,$3); }
| texindex
{ $$ = $1; }
;
texindex: index
{ $$ = $1; }
;
index: NUM
{ $$ = newIndex(atoi(tokenString)); }
;
%%
static TokenType yylex(){
return getToken();
}
int yyerror(char * message){
printf("Syntax error at line %d: %s\n",lineno,message);
return 0;
}
TreeNode_t * parse(){
yyparse();
return savedTree;
}

80
util/geo2bog/geo_scan.l Normal file
View File

@@ -0,0 +1,80 @@
/* Lex spesification for geo2bog */
%option noyywrap
%o 4000
%{
#define YYLEX
#include "globals.h"
int lineno;
char tokenString[MAXTOKENLEN+1];
%}
digit [0-9]
nat {digit}+
signedNat ("+"|"-")?{nat}
floating {signedNat}("."{nat})?(E{signedNat})?
string \"([^\"]|\\\")+\"
comment #[^\n]*
newline \n
whitespace [ \t\r]+
%%
"GEO" { return GEO; }
"Version" { return FILEVERSION; }
"Geometry" { return GEOMETRY ; }
"Name" { return NAME ; }
"VertexList" { return VERTEXLIST ; }
"NormalList" { return NORMALLIST ; }
"TexCoordList" { return TEXCOORDLIST ; }
"Vertex" { return VERTEX ; }
"Normal" { return NORMAL ; }
"TexCoord" { return TEXCOORD ; }
"Polygon" { return POLYGON ; }
"Type" { return TYPE ; }
"POLYGON" { return POLYGON ; }
"TRIANGLES" { return TRIANGLES ; }
"QUADS" { return QUADS ; }
"QUAD_STRIP" { return QUAD_STRIP ; }
"TRIANGLE_STRIP" { return TRIANGLE_STRIP ; }
"TRIANGLE_FAN" { return TRIANGLE_FAN ; }
"Material" { return MATERIAL ; }
"=" { return ASSIGN ; }
[;,()\[\]{}] { return yytext[0]; }
{nat} { return NUM; }
{floating} { return FLOAT; }
{string} { return STRING; }
{comment} { /* Skip */ }
{whitespace} { /* Skip */ }
{newline} { lineno++; }
. { return ERROR; }
%%
TokenType getToken(){
TokenType currentToken;
static int firstTime = TRUE;
if (firstTime){
firstTime = FALSE;
yyin = source;
lineno++;
}
currentToken = yylex();
strncpy(tokenString,yytext,MAXTOKENLEN);
return currentToken;
}
#if 0 /* ndef LINUX */
int yywrap(void){
return 1;
}
#endif

87
util/geo2bog/globals.h Normal file
View File

@@ -0,0 +1,87 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "bogfile.H"
#ifndef YYPARSER
#include "geo_parse.h"
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define WORD unsigned short int
#define MAXTOKENLEN 64
#define MAXCHILDREN 3
typedef int TokenType;
extern int lineno;
extern char tokenString[MAXTOKENLEN+1];
extern FILE * source;
/******************************************************************************
*
* Syntax tree for parsing
*
*****************************************************************************/
typedef enum {FileK,HeadK,GeometryK,FloatK,IndexK,StringK,VertexK,VertexListK,NormalK,NormalListK,TexCoordK,TexCoordListK,PolyK,PolyTypeK,MaterialK,VertexIndexK,NormalIndexK,TexCoordIndexK,VertexIndexListK,NormalIndexListK,TexCoordIndexListK} NodeKind_t;
typedef struct treeNode {
NodeKind_t nodeKind;
struct treeNode * sibling;
struct treeNode * child[MAXCHILDREN];
union {
int index;
float value;
char * name;
PolyType_t polyType;
} attr;
} TreeNode_t;
/*
Declarations to prevent SYMBOL NOT FOUND in c++
*/
static TokenType yylex();
int yyerror(char *);
TreeNode_t *parse();
extern int getToken();
void writebogfile(TreeNode_t *, FILE *, FILE *);
#endif /* _GLOBALS_H */

308
util/geo2bog/parse.c Normal file
View File

@@ -0,0 +1,308 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "globals.h"
#include "parse.h"
TreeNode_t * linkNode(TreeNode_t * n1, TreeNode_t * n2){
TreeNode_t * t = n1;
if (t != NULL) {
while (t->sibling != NULL)
t = t->sibling;
t->sibling = n2;
return n1;
} else return n2;
}
TreeNode_t * newFile(TreeNode_t * head, TreeNode_t * geometry){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = FileK;
treeNode->child[0] = head;
treeNode->child[1] = geometry;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newHead(TreeNode_t * version){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = HeadK;
treeNode->child[0] = version;
treeNode->child[1] = NULL;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newGeometry(TreeNode_t * list, TreeNode_t * poly){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = GeometryK;
treeNode->child[0] = list;
treeNode->child[1] = poly;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newVertex(TreeNode_t * v1, TreeNode_t * v2, TreeNode_t * v3){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = VertexK;
treeNode->child[0] = v1;
treeNode->child[1] = v2;
treeNode->child[2] = v3;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newNormal(TreeNode_t * v1, TreeNode_t * v2, TreeNode_t * v3){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = NormalK;
treeNode->child[0] = v1;
treeNode->child[1] = v2;
treeNode->child[2] = v3;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newTexCoord(TreeNode_t * v1, TreeNode_t * v2){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = TexCoordK;
treeNode->child[0] = v1;
treeNode->child[1] = v2;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newVertexList(TreeNode_t * vertex){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = VertexListK;
treeNode->child[0] = vertex;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newNormalList(TreeNode_t * normal){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = NormalListK;
treeNode->child[0] = normal;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newTexCoordList(TreeNode_t * texCoord){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = TexCoordListK;
treeNode->child[0] = texCoord;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newFloat(float value){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = FloatK;
treeNode->attr.value = value;
return treeNode;
}
TreeNode_t * newIndex(int index){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = IndexK;
treeNode->attr.index = index;
return treeNode;
}
TreeNode_t * newPoly(TreeNode_t * polyattr){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = PolyK;
treeNode->child[0] = polyattr;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newPolyType(PolyType_t polyType){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = PolyTypeK;
treeNode->attr.polyType = polyType;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newMaterial(char * name){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = MaterialK;
treeNode->attr.name = name;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newVertexIndexList(TreeNode_t * indexList){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = VertexIndexListK;
treeNode->child[0] = indexList;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newNormalIndexList(TreeNode_t * indexList){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = NormalIndexListK;
treeNode->child[0] = indexList;
treeNode->sibling = NULL;
return treeNode;
}
TreeNode_t * newTexCoordIndexList(TreeNode_t * indexList){
TreeNode_t * treeNode = (TreeNode_t *)malloc( sizeof (TreeNode_t) );
treeNode->nodeKind = TexCoordIndexListK;
treeNode->child[0] = indexList;
treeNode->sibling = NULL;
return treeNode;
}
void printTree(TreeNode_t * node){
if (node == NULL) return;
switch (node->nodeKind){
case GeometryK:
printf("Geometry {\n");
printTree(node->child[0]);
printTree(node->child[1]);
printf("}\n");
break;
case VertexListK:
printf("\tVertexList = [\t");
printTree(node->child[0]);
printf(" ];\n");
printTree(node->sibling);
break;
case NormalListK:
printf("\tNormalList = [\t");
printTree(node->child[0]);
printf(" ];\n");
printTree(node->sibling);
break;
case TexCoordListK:
printf("\tTexCoordList = [ ");
printTree(node->child[0]);
printf(" ];\n");
printTree(node->sibling);
break;
case VertexK:
printf("( ");
printTree(node->child[0]);
printf(", ");
printTree(node->child[1]);
printf(", ");
printTree(node->child[2]);
printf(")");
if (node->sibling != NULL) {
printf(",\n\t\t\t");
printTree(node->sibling);
}
break;
case NormalK:
printf("( ");
printTree(node->child[0]);
printf(", ");
printTree(node->child[1]);
printf(", ");
printTree(node->child[2]);
printf(")");
if (node->sibling != NULL) {
printf(",\n\t\t\t");
printTree(node->sibling);
}
break;
case TexCoordK:
printf("( ");
printTree(node->child[0]);
printf(", ");
printTree(node->child[1]);
printf(")");
if (node->sibling != NULL) {
printf(",\n\t\t\t");
printTree(node->sibling);
}
break;
case PolyK:
printf("\tPolygon {\n");
printTree(node->child[0]);
printf("\t}\n");
printTree(node->sibling);
break;
case PolyTypeK:
printf("\t\tType = ");
switch(node->attr.polyType){
case PT_Polygon:
printf("POLYGON");
break;
case PT_Triangles:
printf("TRIANGLES");
break;
case PT_Quads:
printf("QUADS");
break;
case PT_Quad_strip:
printf("QUAD_STRIP");
break;
case PT_Triangle_strip:
printf("TRIANGLE_STRIP");
break;
case PT_Triangle_fan:
printf("TRIANGLE_FAN");
break;
}
printf("\n");
printTree(node->sibling);
break;
case MaterialK:
printf("\t\tMaterial = %s\n",node->attr.name);
printTree(node->sibling);
break;
case VertexIndexListK:
printf("\t\tVertex = [ ");
printTree(node->child[0]);
printf("];\n");
printTree(node->sibling);
break;
case NormalIndexListK:
printf("\t\tNormal = [ ");
printTree(node->child[0]);
printf("];\n");
printTree(node->sibling);
break;
case TexCoordIndexListK:
printf("\t\tTexCoord = [ ");
printTree(node->child[0]);
printf("];\n");
printTree(node->sibling);
break;
case IndexK:
printf("%i",node->attr.index);
if (node->sibling != NULL){
printf(", ");
printTree(node->sibling);
}
break;
case FloatK:
printf("%f",node->attr.value);
break;
}
}

50
util/geo2bog/parse.h Normal file
View File

@@ -0,0 +1,50 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _PARS_H
#define _PARS_H
TreeNode_t * parse(void);
TreeNode_t * linkNode(TreeNode_t * n1, TreeNode_t * n2 );
TreeNode_t * newFile(TreeNode_t * head, TreeNode_t * geometry);
TreeNode_t * newHead(TreeNode_t * version);
TreeNode_t * newGeometry(TreeNode_t * list, TreeNode_t * poly);
TreeNode_t * newVertex(TreeNode_t * v1, TreeNode_t * v2, TreeNode_t * v3);
TreeNode_t * newNormal(TreeNode_t * v1, TreeNode_t * v2, TreeNode_t * v3);
TreeNode_t * newTexCoord(TreeNode_t * v1, TreeNode_t * v2);
TreeNode_t * newVertexList(TreeNode_t * vertex);
TreeNode_t * newNormalList(TreeNode_t * normal);
TreeNode_t * newTexCoordList(TreeNode_t * texCoord);
TreeNode_t * newFloat(float value);
TreeNode_t * newIndex(int index);
TreeNode_t * newPoly(TreeNode_t * polyattr );
TreeNode_t * newPolyType(PolyType_t polyType );
TreeNode_t * newMaterial(char * name );
TreeNode_t * newVertexIndexList(TreeNode_t * indexList);
TreeNode_t * newNormalIndexList(TreeNode_t * indexList);
TreeNode_t * newTexCoordIndexList(TreeNode_t * indexList);
void printTree(TreeNode_t * node);
#endif /* _PARS_H */

35
util/geo2bog/util.c Normal file
View File

@@ -0,0 +1,35 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "globals.h"
#include "util.h"
char * copyString(char * s){
int n;
char * t;
if (s==NULL) return NULL;
n = strlen(s)+1;
t = (char *)malloc(n);
if (t==NULL)
printf("Error: Out of memory error at line %d\n",lineno);
else strcpy(t,s);
return t;
}

22
util/geo2bog/util.h Normal file
View File

@@ -0,0 +1,22 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
char * copyString(char * s);

310
util/geo2bog/writebog.c Normal file
View File

@@ -0,0 +1,310 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "globals.h"
#include "writebog.h"
#include "namedb.H"
CNameDB * nameDB;
void countElements(TreeNode_t * node, WORD * numV, WORD * numN,
WORD * numTC, WORD * numP){
if (node == NULL) return;
switch (node->nodeKind){
case FileK:
case GeometryK:
countElements(node->child[0],numV,numN,numTC,numP);
countElements(node->child[1],numV,numN,numTC,numP);
break;
case VertexListK:
case NormalListK:
case TexCoordListK:
countElements(node->child[0],numV,numN,numTC,numP);
countElements(node->sibling,numV,numN,numTC,numP);
break;
case VertexK:
(*numV)++;
countElements(node->sibling,numV,numN,numTC,numP);
break;
case NormalK:
(*numN)++;
countElements(node->sibling,numV,numN,numTC,numP);
break;
case TexCoordK:
(*numTC)++;
countElements(node->sibling,numV,numN,numTC,numP);
break;
case PolyK:
(*numP)++;
countElements(node->sibling,numV,numN,numTC,numP);
break;
}
}
void writeVertex(TreeNode_t * node, FILE * bogfile ){
if (node == NULL) return;
switch (node->nodeKind){
case GeometryK:
writeVertex(node->child[0],bogfile);
break;
case VertexListK:
writeVertex(node->child[0],bogfile);
writeVertex(node->sibling,bogfile);
break;
case NormalListK:
case TexCoordListK:
writeVertex(node->sibling,bogfile);
break;
case VertexK:
fprintf(bogfile,"%f %f %f\n", node->child[0]->attr.value,
node->child[1]->attr.value, node->child[2]->attr.value);
writeVertex(node->sibling,bogfile);
break;
}
}
void writeNormal(TreeNode_t * node, FILE * bogfile ){
if (node == NULL) return;
switch (node->nodeKind){
case GeometryK:
writeNormal(node->child[0],bogfile);
break;
case NormalListK:
writeNormal(node->child[0],bogfile);
writeNormal(node->sibling,bogfile);
break;
case VertexListK:
case TexCoordListK:
writeNormal(node->sibling,bogfile);
break;
case NormalK:
fprintf(bogfile,"%f %f %f\n", node->child[0]->attr.value,
node->child[1]->attr.value, node->child[2]->attr.value);
writeNormal(node->sibling,bogfile);
break;
}
}
void writeTexCoord(TreeNode_t * node, FILE * bogfile ){
if (node == NULL) return;
switch (node->nodeKind){
case GeometryK:
writeTexCoord(node->child[0],bogfile);
break;
case TexCoordListK:
writeTexCoord(node->child[0],bogfile);
writeTexCoord(node->sibling,bogfile);
break;
case VertexListK:
case NormalListK:
writeTexCoord(node->sibling,bogfile);
break;
case TexCoordK:
fprintf(bogfile,"%f %f\n", node->child[0]->attr.value,
node->child[1]->attr.value);
writeTexCoord(node->sibling,bogfile);
break;
}
}
void writePolygonType(TreeNode_t * node, FILE * bogfile ){
if (node == NULL) return;
if (node->nodeKind == PolyTypeK){
fprintf(bogfile,"%i ",node->attr.polyType);
} else writePolygonType(node->sibling,bogfile);
}
void writePolygonMaterial(TreeNode_t * node, FILE * bogfile ){
if (node == NULL) return;
if (node->nodeKind == MaterialK){
fprintf(bogfile,"%i ",nameDB->insert(node->attr.name));
} else writePolygonMaterial(node->sibling,bogfile);
}
void writePolygonVertices(TreeNode_t * node, FILE * bogfile ){
if (node == NULL) return;
switch (node->nodeKind){
case VertexIndexListK:
writePolygonVertices(node->child[0],bogfile);
break;
case IndexK:
fprintf(bogfile,"%i ",node->attr.index);
if (node->sibling == NULL) fprintf(bogfile,"\n");
break;
}
writePolygonVertices(node->sibling,bogfile);
}
void writePolygonNormals(TreeNode_t * node, FILE * bogfile ){
if (node == NULL) return;
switch (node->nodeKind){
case NormalIndexListK:
writePolygonNormals(node->child[0],bogfile);
break;
case IndexK:
fprintf(bogfile,"%i ",node->attr.index);
if (node->sibling == NULL) fprintf(bogfile,"\n");
break;
}
writePolygonNormals(node->sibling,bogfile);
}
void writePolygonTexCoords(TreeNode_t * node, FILE * bogfile ){
if (node == NULL) return;
switch (node->nodeKind){
case TexCoordIndexListK:
writePolygonTexCoords(node->child[0],bogfile);
break;
case IndexK:
fprintf(bogfile,"%i ",node->attr.index);
if (node->sibling == NULL) fprintf(bogfile,"\n");
break;
}
writePolygonTexCoords(node->sibling,bogfile);
}
void countIndex(TreeNode_t * node, WORD * numI){
if (node == NULL) return;
switch (node->nodeKind){
case IndexK:
(*numI)++;
break;
}
countIndex(node->sibling,numI);
}
void countPolygon(TreeNode_t * node, WORD * numV, WORD * numN,
WORD * numTC){
if (node == NULL) return;
switch (node->nodeKind){
case VertexIndexListK:
countIndex(node->child[0],numV);
break;
case NormalIndexListK:
countIndex(node->child[0],numN);
break;
case TexCoordIndexListK:
countIndex(node->child[0],numTC);
break;
}
countPolygon(node->sibling,numV,numN,numTC);
}
void writePolygon(TreeNode_t * node, FILE * bogfile ){
WORD numV,numN,numTC;
if (node == NULL) return;
switch (node->nodeKind){
case GeometryK:
writePolygon(node->child[1],bogfile);
break;
case PolyK:
writePolygonType(node->child[0],bogfile);
writePolygonMaterial(node->child[0],bogfile);
numV = numN = numTC = 0;
countPolygon(node->child[0],&numV,&numN,&numTC);
fprintf(bogfile,"%i %i %i\n",numV,numN,numTC);
writePolygonVertices(node->child[0],bogfile);
writePolygonNormals(node->child[0],bogfile);
writePolygonTexCoords(node->child[0],bogfile);
writePolygon(node->sibling,bogfile);
break;
}
}
void countObjects(TreeNode_t * node,WORD * numO){
if (node == NULL) return;
switch (node->nodeKind){
case FileK:
countObjects(node->child[1],numO);
break;
case GeometryK:
(*numO)++;
countObjects(node->sibling,numO);
break;
default:
printf("Error: countObjects not supposed to encounter this node!\n");
}
}
void writeObjects(TreeNode_t * node,FILE * bogfile, WORD objectId){
WORD numVertices,numNormals,numTexCoords,numPolygons;
if (node == NULL) return;
switch (node->nodeKind){
case FileK:
writeObjects(node->child[1],bogfile,objectId);
break;
case GeometryK:
numVertices = 0;
numNormals = 0;
numTexCoords = 0;
numPolygons = 0;
countElements(node,&numVertices,&numNormals,&numTexCoords,&numPolygons);
fprintf(bogfile,"%i %i %i %i %i\n",
objectId,numVertices,numNormals,numTexCoords,numPolygons);
writeVertex(node,bogfile);
writeNormal(node,bogfile);
writeTexCoord(node,bogfile);
writePolygon(node,bogfile);
writeObjects(node->sibling,bogfile,objectId+1);
break;
default:
printf("Error: writeObjects not supposed to encounter this node!\n");
}
}
void writebogfile(TreeNode_t * node, FILE * bogfile, FILE * ndbfile ){
WORD numObjects;
numObjects = 0;
nameDB = new CNameDB;
countObjects(node,&numObjects);
fprintf(bogfile,"BOG 1 %i\n",numObjects);
writeObjects(node,bogfile,0);
nameDB->writeNDB(ndbfile);
delete nameDB;
}

25
util/geo2bog/writebog.h Normal file
View File

@@ -0,0 +1,25 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _WRITEBOG_H
#define _WRITEBOG_H
void writebogfile(TreeNode_t * node, FILE * bogfile, FILE * ndbfile);
#endif /* _WRITEBOG_H */

1
util/getgos/.cvsignore Normal file
View File

@@ -0,0 +1 @@
getgos

7
util/getgos/Makefile.am Normal file
View File

@@ -0,0 +1,7 @@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = getgos
getgos_SOURCES = getgos.C getgos_main.C getgosgos.C
getgos_LDADD = -L../../common/lib/texture -ltexture -L../../common/lib/geometry -lgeometry -L../../common/lib/utils -lpvvmudutils -L../../common/lib/gos -lgos -L../../common/lib/srvcli -lsrvcli -L../../common/lib/crypto -lcrypto @TIFF_LIBS@ -ltiff -lm @NETLIBS@

345
util/getgos/Makefile.in Normal file
View File

@@ -0,0 +1,345 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 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.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CC = @CC@
CXX = @CXX@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
LEX = @LEX@
MAKEINFO = @MAKEINFO@
NETLIBS = @NETLIBS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
TIFF_CFLAGS = @TIFF_CFLAGS@
TIFF_LIBS = @TIFF_LIBS@
VERSION = @VERSION@
YACC = @YACC@
INCLUDES = -I../../common/include @TIFF_CFLAGS@
bin_PROGRAMS = getgos
getgos_SOURCES = getgos.C getgos_main.C getgosgos.C
getgos_LDADD = -L../../common/lib/texture -ltexture -L../../common/lib/geometry -lgeometry -L../../common/lib/utils -lpvvmudutils -L../../common/lib/gos -lgos -L../../common/lib/srvcli -lsrvcli -L../../common/lib/crypto -lcrypto @TIFF_LIBS@ -ltiff -lm @NETLIBS@
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
getgos_OBJECTS = getgos.o getgos_main.o getgosgos.o
getgos_DEPENDENCIES =
getgos_LDFLAGS =
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in TODO
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
DEP_FILES = .deps/getgos.P .deps/getgos_main.P .deps/getgosgos.P
SOURCES = $(getgos_SOURCES)
OBJECTS = $(getgos_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .C .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign util/getgos/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
getgos: $(getgos_OBJECTS) $(getgos_DEPENDENCIES)
@rm -f getgos
$(CXXLINK) $(getgos_LDFLAGS) $(getgos_OBJECTS) $(getgos_LDADD) $(LIBS)
.C.o:
$(CXXCOMPILE) -c $<
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = util/getgos
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign util/getgos/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
%.o: %.C
@echo '$(CXXCOMPILE) -c $<'; \
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.C
@echo '$(LTCXXCOMPILE) -c $<'; \
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
distclean-depend distclean-generic clean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
distclean-depend clean-depend maintainer-clean-depend info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# 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:

6
util/getgos/TODO Normal file
View File

@@ -0,0 +1,6 @@
GetGOS TODO list
Create -r option for downloading material and textures when downloading
geometry and downloading textures when downloading materials.

44
util/getgos/getgos.C Normal file
View File

@@ -0,0 +1,44 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "pvvmud.H"
#include "getgos.H"
#include "inetaddress.H"
CGetGOS::CGetGOS(COption * option,int requestType,int requestId){
timeKeeper = new CTimeKeeper();
try {
CInetAddress gosAddr(option->getString("host"),option->getInt("port"));
gos = new CGetGOSGOS(this,timeKeeper,&gosAddr);
} catch (CException *e) {
cout << *e << "Error in CGetGOSGOS\n";
};
gos->request(requestType,requestId);
}
void CGetGOS::quit(){
timeKeeper->stopLoop();
}
void CGetGOS::run(){
timeKeeper->mainLoop();
}

38
util/getgos/getgos.H Normal file
View File

@@ -0,0 +1,38 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _GETGOS_H
#define _GETGOS_H
#include "getgosgos.H"
#include "timekeeper.H"
#include "option.H"
class CGetGOS {
CGetGOSGOS * gos;
CTimeKeeper * timeKeeper;
public:
CGetGOS(COption * option, int requestType,int requestId);
void quit();
void run();
};
#endif // _GETGOS_H

94
util/getgos/getgos_main.C Normal file
View File

@@ -0,0 +1,94 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "pvvmud.H"
#include <signal.h>
#include <iostream.h>
#include <stdlib.h>
#include <unistd.h>
#include "getgos.H"
#include "msggos.H"
CGetGOS * getgos;
void signalhandler(int signum){
switch(signum){
case SIGINT:
getgos->quit();
break;
}
}
void printUsage(){
printf("Usage [-h|--host <gos host>] [-p|--port <gos port>] <-g|-m|-t ID>\n");
}
int main(int argc, char * argv[]){
int id;
// Install signal handlers
signal(SIGINT, signalhandler);
signal(SIGPIPE, SIG_IGN);
int ch;
COption option;
option.setValue("host",'h',"localhost");
option.setValue("port",'p',GOS_CLIENT_PORT);
option.setValue("material",'m',-1);
option.setValue("geometry",'g',-1);
option.setValue("texture",'t',-1);
option.setValue("help",'h',0);
option.parseArguments(argc,argv);
if (argc < 3){
printUsage();
exit (0);
}
if (option.getInt("help")){
printUsage();
exit (0);
}
if (option.getInt("geometry") != -1){
getgos = new CGetGOS(&option,GOSREQUEST_GEOMETRY,option.getInt("geometry"));
getgos->run();
delete getgos;
}
if (option.getInt("material") != -1){
getgos = new CGetGOS(&option,GOSREQUEST_MATERIAL,option.getInt("material"));
getgos->run();
delete getgos;
}
if (option.getInt("texture") != -1){
getgos = new CGetGOS(&option,GOSREQUEST_TEXTURE,option.getInt("texture"));
getgos->run();
delete getgos;
}
exit(0);
}

58
util/getgos/getgosgos.C Normal file
View File

@@ -0,0 +1,58 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "pvvmud.H"
#include <limits.h>
#include <stdio.h>
#include "getgosgos.H"
#include "getgos.H"
CGetGOSGOS::CGetGOSGOS(CGetGOS * getGOS,CTimeKeeper * timeKeeper,
CInetAddress *gosAddress):CGOS(timeKeeper,gosAddress){
this->getGOS = getGOS;
}
void CGetGOSGOS::error(){
getGOS->quit();
}
void CGetGOSGOS::geometry(CGeometry * geometry){
char name[PATH_MAX];
sprintf(name,"%i.bog",geometry->getId());
geometry->save(name);
delete geometry;
error();
}
void CGetGOSGOS::material(CMaterial * material){
char name[PATH_MAX];
sprintf(name,"%i.bmat",material->getId());
material->save(name);
delete material;
error();
}
void CGetGOSGOS::texture(CTexture * texture){
char name[PATH_MAX];
sprintf(name,"%i.tex",texture->getId());
texture->save(name);
delete texture;
error();
}

41
util/getgos/getgosgos.H Normal file
View File

@@ -0,0 +1,41 @@
/*
* PVVMUD a 3D MUD
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _GETGOSGOS_H
#define _GETGOSGOS_H
#include "gos.H"
class CGetGOS;
class CGetGOSGOS : public CGOS {
CGetGOS * getGOS;
public:
CGetGOSGOS(CGetGOS * getGOS,CTimeKeeper * timeKeeper,
CInetAddress *gosAddress);
virtual void error();
virtual void geometry(CGeometry * geometry);
virtual void material(CMaterial * material);
virtual void texture(CTexture * texture);
};
#endif // _GETGOSGOS_H

15
util/utilities.html Normal file
View File

@@ -0,0 +1,15 @@
<HTML>
<HEAD>
<TITLE>PVVMUD - Utilities</TITLE>
</HEAD>
<BODY>
<H1>Utilities</H1>
<H2>File converting</H2>
<UL>
<LI><A HREF="asc2bog/asc2bog.html">asc2bog</A>
<LI><A HREF="geo2bog/geo2bog.html">geo2bog</A>
</UL>
</BODY>
</HTML>