Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-02-08 13:13:11 +0000
committerStijn Buys <ingar@osirion.org>2009-02-08 13:13:11 +0000
commitc8a6ff1c0693ca1bd9025dcbdd7c22e3d193f8dd (patch)
tree67b9568002fa77ea34aa993362fd53636f70fca8
parent43f7733dfdd8700430a238d230ed573c12e72c87 (diff)
materials registry, read shaderlist.txt
-rw-r--r--src/model/Makefile.am4
-rw-r--r--src/model/Makefile.in478
-rw-r--r--src/model/material.cc153
-rw-r--r--src/model/material.h47
-rw-r--r--src/render/render.cc26
-rw-r--r--src/render/screenshot.cc2
6 files changed, 703 insertions, 7 deletions
diff --git a/src/model/Makefile.am b/src/model/Makefile.am
index 93023ff..81512ab 100644
--- a/src/model/Makefile.am
+++ b/src/model/Makefile.am
@@ -1,7 +1,7 @@
METASOURCES = AUTO
-libmodel_la_SOURCES = classes.cc fragment.cc map.cc model.cc plane.cc \
- primitives.cc quad.cc triangle.cc vertexarray.cc
+libmodel_la_SOURCES = classes.cc fragment.cc map.cc material.cc model.cc \
+ plane.cc primitives.cc quad.cc triangle.cc vertexarray.cc
libmodel_la_LDFLAGS = -avoid-version -no-undefined -lm
noinst_LTLIBRARIES = libmodel.la
diff --git a/src/model/Makefile.in b/src/model/Makefile.in
new file mode 100644
index 0000000..f5f4d9b
--- /dev/null
+++ b/src/model/Makefile.in
@@ -0,0 +1,478 @@
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/model
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libmodel_la_LIBADD =
+am_libmodel_la_OBJECTS = classes.lo fragment.lo map.lo material.lo \
+ model.lo plane.lo primitives.lo quad.lo triangle.lo \
+ vertexarray.lo
+libmodel_la_OBJECTS = $(am_libmodel_la_OBJECTS)
+libmodel_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(libmodel_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libmodel_la_SOURCES)
+DIST_SOURCES = $(libmodel_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AL_LIBS = @AL_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CURSES_LIBS = @CURSES_LIBS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HOST_LIBS = @HOST_LIBS@
+ICON_CLIENT = @ICON_CLIENT@
+ICON_SERVER = @ICON_SERVER@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBJPG_LIBS = @LIBJPG_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBPNG_LIBS = @LIBPNG_LIBS@
+LIBS = @LIBS@
+LIBSDL_CFLAGS = @LIBSDL_CFLAGS@
+LIBSDL_LIBS = @LIBSDL_LIBS@
+LIBSDL_RPATH = @LIBSDL_RPATH@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+METASOURCES = AUTO
+libmodel_la_SOURCES = classes.cc fragment.cc map.cc material.cc model.cc \
+ plane.cc primitives.cc quad.cc triangle.cc vertexarray.cc
+
+libmodel_la_LDFLAGS = -avoid-version -no-undefined -lm
+noinst_LTLIBRARIES = libmodel.la
+noinst_HEADERS = classes.h fragment.h map.h material.h model.h plane.h \
+ primitives.h quad.h triangle.h vertexarray.h
+
+INCLUDES = -I$(top_srcdir)/src
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/model/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/model/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libmodel.la: $(libmodel_la_OBJECTS) $(libmodel_la_DEPENDENCIES)
+ $(libmodel_la_LINK) $(libmodel_la_OBJECTS) $(libmodel_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/classes.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fragment.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plane.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitives.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quad.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/triangle.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vertexarray.Plo@am__quote@
+
+.cc.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/model/material.cc b/src/model/material.cc
new file mode 100644
index 0000000..0167f7b
--- /dev/null
+++ b/src/model/material.cc
@@ -0,0 +1,153 @@
+/*
+ model/material.cc
+ This file is part of the Osirion project and is distributed under
+ the terms of the GNU General Public License version 2
+*/
+
+#include <string>
+
+#include "auxiliary/functions.h"
+#include "filesystem/filestream.h"
+#include "model/material.h"
+#include "sys/sys.h"
+
+namespace model
+{
+
+Material::Material(const std::string &name) : material_name(name)
+{
+}
+
+Material::~Material()
+{
+}
+
+Material::Registry Material::material_registry;
+
+void Material::init()
+{
+ con_print << "^BInitializing materials..." << std::endl;
+
+ filesystem::IFileStream shaderlist("materials/shaderlist.txt");
+ if (!shaderlist.is_open()) {
+ con_warn << "Could not open " << shaderlist.name() << std::endl;
+ return;
+ }
+
+ con_debug << " " << shaderlist.name() << std::endl;
+
+ char line[1024];
+ while (shaderlist.getline(line, 1023)) {
+ if ((line[0] == 0) || (line[0] == '#') || (line[0] == ';')) {
+ continue;
+ } else {
+ std::string s(line);
+ aux::trim(s);
+ load_shader(s);
+ }
+ }
+
+ shaderlist.close();
+}
+
+void Material::add(Material *material)
+{
+ if (!find(material->name())) {
+ material_registry[material->name()] = material;
+ }
+}
+
+void Material::load_shader(const std::string &shadername)
+{
+ std::string shaderfilename("materials/");
+ shaderfilename.append(shadername);
+ shaderfilename.append(".shader");
+
+ filesystem::IFileStream shaderfile(shaderfilename);
+ if (!shaderfile.is_open()) {
+ con_warn << "Could not open " << shaderfile.name() << std::endl;
+ return;
+ }
+
+ int parselevel = 0;
+ char line[1024];
+ unsigned int count = 0;
+
+ while (shaderfile.getline(line, 1023)) {
+ // read materials
+ std::string s(line);
+ aux::trim(s);
+
+ // skip empty lines
+ if (!s.size())
+ continue;
+
+ // skip comments
+ if ((s[0] == '#') || (s[0] == ';') || ((s[0] == '/') && (s[1] == '/')))
+ continue;
+
+ std::istringstream linestream(s);
+ std::string firstword;
+
+ if (linestream >> firstword) {
+
+ if (firstword.compare("}") == 0) {
+ parselevel--;
+
+ } else if (firstword.compare("{") == 0) {
+ parselevel++;
+
+ } else if ((firstword.size()) && (parselevel == 0) ) {
+
+ if (firstword.compare(0, 9, "textures/") == 0) {
+ firstword.erase(0, 9);
+ Material *material = new Material(firstword);
+ add(material);
+ count++;
+ }
+
+ } else if (parselevel == 1) {
+
+ }
+ }
+ }
+
+ con_debug << " " << shaderfile.name() << " " << count << " materials " << std::endl;
+
+ shaderfile.close();
+}
+
+void Material::shutdown()
+{
+ clear();
+}
+
+void Material::clear()
+{
+ con_print << "^BClearing materials..." << std::endl;
+
+ for (Registry::iterator i = material_registry.begin(); i != material_registry.end(); ++i) {
+ delete (*i).second;
+ }
+
+ material_registry.clear();
+}
+
+void Material::list()
+{
+ for (Registry::iterator i = material_registry.begin(); i != material_registry.end(); ++i) {
+ con_print << " " << (*i).second->name() << std::endl;
+ }
+ con_print << material_registry.size() << " registered materials" << std::endl;
+}
+
+Material *Material::find(const std::string &name)
+{
+ for (Registry::iterator i = material_registry.begin(); i != material_registry.end(); ++i) {
+ if ((*i).first.compare(name) == 0)
+ return (*i).second;
+ }
+ return 0;
+}
+
+}
diff --git a/src/model/material.h b/src/model/material.h
index bdfee68..8081792 100644
--- a/src/model/material.h
+++ b/src/model/material.h
@@ -7,13 +7,58 @@
#ifndef __INCLUDED_MODEL_MATERIAL_H__
#define __INCLUDED_MODEL_MATERIAL_H__
+#include <string>
+#include <map>
+
namespace model
{
+/// fragment surface material parameters
class Material
{
public:
- enum Flags { None=0, Primary=1, Secondary=2, Tertiary=3, Dark=4, Light=8, Engine=16};
+ /// surface flags
+ enum SurfaceFlags { None=0, Primary=1, Secondary=2, Tertiary=3, Dark=4, Light=8, Engine=16};
+
+ /// type definition for the material registry
+ typedef std::map<std::string, Material *> Registry;
+
+ Material(const std::string &name);
+ ~Material();
+
+ inline const std::string &name() { return material_name; }
+
+/* ---- static ----------------------------------------------------- */
+
+ /**
+ * @brief initialize materials
+ * reads materials from the shader files
+ */
+ static void init();
+
+ /// clear all materials
+ static void shutdown();
+
+ /// clear all materials
+ static void clear();
+
+ /// list registered materials
+ static void list();
+
+ /// add a material to the registry
+ static void add(Material *material);
+
+ /// find a material in the registry
+ static Material *find(const std::string &name);
+
+private:
+
+ std::string material_name;
+
+ /// the material registry
+ static Registry material_registry;
+
+ static void load_shader(const std::string &shadername);
};
}
diff --git a/src/render/render.cc b/src/render/render.cc
index 41aa96f..fbeec11 100644
--- a/src/render/render.cc
+++ b/src/render/render.cc
@@ -14,6 +14,8 @@
#include "core/gameinterface.h"
#include "filesystem/filesystem.h"
#include "model/model.h"
+#include "model/material.h"
+#include "model/material.h"
#include "render/gl.h"
#include "render/state.h"
#include "render/dust.h"
@@ -39,6 +41,11 @@ void func_list_textures(std::string const &args)
Textures::list();
}
+void func_list_materials(std::string const &args)
+{
+ model::Material::list();
+}
+
void func_list_particles(std::string const &args)
{
ParticleScript::list();
@@ -63,6 +70,9 @@ void init(int width, int height)
Dust::init();
+ // read materials
+ model::Material::init();
+
// size of the vertex array in megabytes
r_arraysize = core::Cvar::get("r_arraysize", 0.0f , core::Cvar::Archive);
r_arraysize->set_info("[int] size of the vertex array in Mb");
@@ -102,10 +112,14 @@ void init(int width, int height)
// engine functions
core::Func *func = core::Func::add("list_textures", func_list_textures);
- func->set_info("list loaded textures");
+ func->set_info("list registered textures");
+
+ func = core::Func::add("list_materials", func_list_materials);
+ func->set_info("list registered materials");
+
func = core::Func::add("list_particles", func_list_particles);
- func->set_info("list loaded particle scripts");
+ func->set_info("list registered particle scripts");
}
// unload game assets (zone change)
@@ -166,9 +180,12 @@ void clear()
}
}
- // clear model refistry
+ // clear model registry
model::Model::clear();
+ // clear materials
+ model::Material::clear();
+
// clear particle system scripts
ParticleScript::clear();
@@ -197,6 +214,8 @@ void reset()
vertexarray = new model::VertexArray(mb);
Dust::reset();
+
+ model::Material::init();
}
void resize(int width, int height)
@@ -208,6 +227,7 @@ void shutdown()
{
con_print << "^BShutting down renderer..." << std::endl;
+ core::Func::remove("list_materials");
core::Func::remove("list_particles");
core::Func::remove("list_textures");
diff --git a/src/render/screenshot.cc b/src/render/screenshot.cc
index aa5aa9e..043756b 100644
--- a/src/render/screenshot.cc
+++ b/src/render/screenshot.cc
@@ -35,7 +35,7 @@ void Screenshot::save()
// make sure the screenshots folder exists
filename.assign(filesystem::writedir());
filename.append("screenshots");
- if (!sys::isdirectory(filename)) {
+ if (!sys::directory_exists(filename)) {
sys::mkdir(filename);
}
filename += '/';