From 5830a64163a3b4d3ce0e9161e126fd979e7dc8e5 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 30 Nov 2014 14:06:05 -0600 Subject: Let's get consistent with spelling: Use the US spelling of traveler with one 'l' --- apps/graphics/Kconfig | 8 +- apps/graphics/Make.defs | 2 +- apps/graphics/Makefile | 2 +- apps/graphics/traveler/.gitignore | 11 + apps/graphics/traveler/Kconfig | 26 +++ apps/graphics/traveler/Makefile | 142 +++++++++++ apps/graphics/traveler/include/trv_bitmaps.h | 57 +++++ apps/graphics/traveler/include/trv_color.h | 79 +++++++ apps/graphics/traveler/include/trv_debug.h | 139 +++++++++++ apps/graphics/traveler/include/trv_doors.h | 52 +++++ apps/graphics/traveler/include/trv_graphics.h | 82 +++++++ apps/graphics/traveler/include/trv_input.h | 53 +++++ apps/graphics/traveler/include/trv_main.h | 61 +++++ apps/graphics/traveler/include/trv_pov.h | 61 +++++ apps/graphics/traveler/include/trv_raycntl.h | 63 +++++ apps/graphics/traveler/include/trv_rayrend.h | 60 +++++ apps/graphics/traveler/include/trv_types.h | 72 ++++++ apps/graphics/traveler/include/trv_world.h | 69 ++++++ apps/graphics/traveler/src/trv_main.c | 312 +++++++++++++++++++++++++ apps/graphics/traveller/.gitignore | 11 - apps/graphics/traveller/Kconfig | 26 --- apps/graphics/traveller/Makefile | 142 ----------- apps/graphics/traveller/include/trv_bitmaps.h | 57 ----- apps/graphics/traveller/include/trv_color.h | 79 ------- apps/graphics/traveller/include/trv_debug.h | 139 ----------- apps/graphics/traveller/include/trv_doors.h | 52 ----- apps/graphics/traveller/include/trv_graphics.h | 82 ------- apps/graphics/traveller/include/trv_input.h | 53 ----- apps/graphics/traveller/include/trv_main.h | 61 ----- apps/graphics/traveller/include/trv_pov.h | 61 ----- apps/graphics/traveller/include/trv_raycntl.h | 63 ----- apps/graphics/traveller/include/trv_rayrend.h | 60 ----- apps/graphics/traveller/include/trv_types.h | 72 ------ apps/graphics/traveller/include/trv_world.h | 69 ------ apps/graphics/traveller/src/trv_main.c | 312 ------------------------- 35 files changed, 1345 insertions(+), 1345 deletions(-) create mode 100644 apps/graphics/traveler/.gitignore create mode 100644 apps/graphics/traveler/Kconfig create mode 100644 apps/graphics/traveler/Makefile create mode 100644 apps/graphics/traveler/include/trv_bitmaps.h create mode 100644 apps/graphics/traveler/include/trv_color.h create mode 100644 apps/graphics/traveler/include/trv_debug.h create mode 100644 apps/graphics/traveler/include/trv_doors.h create mode 100644 apps/graphics/traveler/include/trv_graphics.h create mode 100644 apps/graphics/traveler/include/trv_input.h create mode 100644 apps/graphics/traveler/include/trv_main.h create mode 100644 apps/graphics/traveler/include/trv_pov.h create mode 100644 apps/graphics/traveler/include/trv_raycntl.h create mode 100644 apps/graphics/traveler/include/trv_rayrend.h create mode 100644 apps/graphics/traveler/include/trv_types.h create mode 100644 apps/graphics/traveler/include/trv_world.h create mode 100755 apps/graphics/traveler/src/trv_main.c delete mode 100644 apps/graphics/traveller/.gitignore delete mode 100644 apps/graphics/traveller/Kconfig delete mode 100644 apps/graphics/traveller/Makefile delete mode 100644 apps/graphics/traveller/include/trv_bitmaps.h delete mode 100644 apps/graphics/traveller/include/trv_color.h delete mode 100644 apps/graphics/traveller/include/trv_debug.h delete mode 100644 apps/graphics/traveller/include/trv_doors.h delete mode 100644 apps/graphics/traveller/include/trv_graphics.h delete mode 100644 apps/graphics/traveller/include/trv_input.h delete mode 100644 apps/graphics/traveller/include/trv_main.h delete mode 100644 apps/graphics/traveller/include/trv_pov.h delete mode 100644 apps/graphics/traveller/include/trv_raycntl.h delete mode 100644 apps/graphics/traveller/include/trv_rayrend.h delete mode 100644 apps/graphics/traveller/include/trv_types.h delete mode 100644 apps/graphics/traveller/include/trv_world.h delete mode 100755 apps/graphics/traveller/src/trv_main.c (limited to 'apps/graphics') diff --git a/apps/graphics/Kconfig b/apps/graphics/Kconfig index 55002bcc1..74f084956 100644 --- a/apps/graphics/Kconfig +++ b/apps/graphics/Kconfig @@ -18,16 +18,16 @@ endmenu endif # TIFF config GRAPHICS_TRAVELER - bool "Traveller game" + bool "Traveler game" default n select SYSTEM_INIFILE ---help--- - Enable or disable the graphic Traveller game + Enable or disable the graphic Traveler game if GRAPHICS_TRAVELER -menu "Traveller game" -source "$APPSDIR/graphics/traveller/Kconfig" +menu "Traveler game" +source "$APPSDIR/graphics/traveler/Kconfig" endmenu endif # GRAPHICS_TRAVELER diff --git a/apps/graphics/Make.defs b/apps/graphics/Make.defs index 3376e941a..987c387b6 100644 --- a/apps/graphics/Make.defs +++ b/apps/graphics/Make.defs @@ -43,5 +43,5 @@ CONFIGURED_APPS += graphics/screenshot endif ifeq ($(CONFIG_GRAPHICS_TRAVELER),y) -CONFIGURED_APPS += graphics/traveller +CONFIGURED_APPS += graphics/traveler endif diff --git a/apps/graphics/Makefile b/apps/graphics/Makefile index 551e21472..7f33fe2a4 100644 --- a/apps/graphics/Makefile +++ b/apps/graphics/Makefile @@ -37,7 +37,7 @@ # Sub-directories -SUBDIRS = tiff screenshot traveller +SUBDIRS = tiff screenshot traveler # Sub-directories that might need context setup diff --git a/apps/graphics/traveler/.gitignore b/apps/graphics/traveler/.gitignore new file mode 100644 index 000000000..83bd7b811 --- /dev/null +++ b/apps/graphics/traveler/.gitignore @@ -0,0 +1,11 @@ +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/graphics/traveler/Kconfig b/apps/graphics/traveler/Kconfig new file mode 100644 index 000000000..3feee99bb --- /dev/null +++ b/apps/graphics/traveler/Kconfig @@ -0,0 +1,26 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +if GRAPHICS_TRAVELER + +config GRAPHICS_TRAVELER_PERFMON + bool "Performance monitor game" + default y + ---help--- + Enable or disable performance monitoring instrumentation and output. + +config GRAPHICS_TRAVELER_DEBUG_LEVEL + int "Debug output level" + default 0 + range 0 3 + ---help--- + DEBUG_LEVEL == 3 turns off sound and video and enables verbose debug + messages on stdout. + DEBUG_LEVEL == 2 turns off sound and video and enables normal debug + output + DEBUG_LEVEL == 1 turns off sound and enables normal debug output + OTHERWISE, all debugging features are disabled. + +endif # GRAPHICS_TRAVELER diff --git a/apps/graphics/traveler/Makefile b/apps/graphics/traveler/Makefile new file mode 100644 index 000000000..75d48566f --- /dev/null +++ b/apps/graphics/traveler/Makefile @@ -0,0 +1,142 @@ +############################################################################ +# apps/graphics/traveler/Makefile +# +# Copyright (C) 2014 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# Hello, World! built-in application info + +APPNAME = traveler +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Hello, World! Example + +ASRCS = +CSRCS = +MAINSRC = trv_main.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) +MAINOBJ = $(MAINSRC:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) $(MAINSRC) +OBJS = $(AOBJS) $(COBJS) + +ifneq ($(CONFIG_BUILD_KERNEL),y) + OBJS += $(MAINOBJ) +endif + +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else +ifeq ($(WINTOOL),y) + BIN = ..\\..\\libapps$(LIBEXT) +else + BIN = ../../libapps$(LIBEXT) +endif +endif + +ifeq ($(WINTOOL),y) + INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}" +else + INSTALL_DIR = $(BIN_DIR) +endif + +CONFIG_EXAMPLES_HELLO_PROGNAME ?= hello$(EXEEXT) +PROGNAME = $(CONFIG_EXAMPLES_HELLO_PROGNAME) + +ifeq ($(WINTOOL),y) +INCDIROPT = -w +endif + +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/graphics/traveler/include} + +DEPPATH = --dep-path src +VPATH = src + +# Common build + +all: .built +.PHONY: clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + $(call ARCHIVE, $(BIN), $(OBJS)) + @touch .built + +ifeq ($(CONFIG_BUILD_KERNEL),y) +$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ) + @echo "LD: $(PROGNAME)" + $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS) + $(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME) + +install: $(BIN_DIR)$(DELIM)$(PROGNAME) + +else +install: + +endif + +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif + +.depend: Makefile $(SRCS) + @$(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + $(call DELFILE, .built) + $(call CLEAN) + +distclean: clean + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + +-include Make.dep diff --git a/apps/graphics/traveler/include/trv_bitmaps.h b/apps/graphics/traveler/include/trv_bitmaps.h new file mode 100644 index 000000000..82df0c145 --- /dev/null +++ b/apps/graphics/traveler/include/trv_bitmaps.h @@ -0,0 +1,57 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_bitmaps.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_BITMAPS_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_BITMAPS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_BITMAPS_H */ diff --git a/apps/graphics/traveler/include/trv_color.h b/apps/graphics/traveler/include/trv_color.h new file mode 100644 index 000000000..04e9d1523 --- /dev/null +++ b/apps/graphics/traveler/include/trv_color.h @@ -0,0 +1,79 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_color.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_COLOR_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_COLOR_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" +#include "trv_graphics.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct trv_color_rgb_s +{ + uint8_t red; + uint8_t green; + uint8_t blue; +}; + +struct trv_color_lum_s +{ + float red; + float green; + float blue; + float luminance; +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +bool trv_color_allocate(FAR struct trv_palette_s *pinfo); +void trv_color_endmapping(void); +trv_pixel_t trv_color_rgb2pixel(FAR struct trv_color_rgb_s *pixel); +void trv_color_pixel2lum(trv_pixel_t pixel, FAR struct trv_color_lum_s *lum); +trv_pixel_t trv_color_lum2pixel(FAR struct trv_color_lum_s *lum); + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_COLOR_H */ diff --git a/apps/graphics/traveler/include/trv_debug.h b/apps/graphics/traveler/include/trv_debug.h new file mode 100644 index 000000000..d54b1eb13 --- /dev/null +++ b/apps/graphics/traveler/include/trv_debug.h @@ -0,0 +1,139 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_debug.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_DEBUG_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_DEBUG_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Feature Selection Switches + * + * CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 3 turns off sound and video and + * enables verbose debug messages on stdout. + * CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 2 turns off sound and video and + * enables normal debug output + * CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 1 turns off sound and enables + * normal debug output + * OTHERWISE, all debugging features are disabled. + */ + +#define ENABLE_SOUND 1 +#define ENABLE_VIDEO 1 +#undef TRV_VERBOSE + +#ifndef CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL +# define CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL 0 +#ielf (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 3) +# undef ENABLE_SOUND +# undef ENABLE_VIDEO +# define TRV_VERBOSE 1 +#elif (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 2) +# undef ENABLE_SOUND +# undef ENABLE_VIDEO +#elif (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 1) +# undef ENABLE_SOUND +#endif + +/* Sound is not yet supported */ + +#undef ENABLE_SOUND + +/* Debug output macros */ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# if (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL > 0) + +# define trv_debug(format, ...) \ + printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) + +# ifdef TRV_VERBOSE +# define trv_vdebug(format, ...) \ + printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) + +# else +# define vdbg(x...) +# endif + +# else + +# define dbg(x...) +# define vdbg(x...) + +# endif +#else + + /* Variadic macros NOT supported */ + +# if (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL > 0) +# ifdef TRV_VERBOSE +# define trv_vdebug trv_debug +# else +# define trv_vdebug (void) +# endif +# else +# define trv_debug (void) +# define trv_vdebug (void) +# endif + +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/* The debugging interfaces are normally accessed via the macros provided + * above. If the cross-compiler's C pre-processor supports a variable + * number of macro arguments, then those macros below will map all + * debug statements to printf. + * + * If the cross-compiler's pre-processor does not support variable length + * arguments, then this additional interface will be built. + */ + +#ifndef CONFIG_CPP_HAVE_VARARGS && (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL > 0) +int trv_debug(FAR const char *format, ...); +#endif + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_DEBUG_H */ diff --git a/apps/graphics/traveler/include/trv_doors.h b/apps/graphics/traveler/include/trv_doors.h new file mode 100644 index 000000000..9179e2979 --- /dev/null +++ b/apps/graphics/traveler/include/trv_doors.h @@ -0,0 +1,52 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_doors.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_DOORS_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_DOORS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +void trv_door_initialize(void); +void trv_door_animate(void); + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_DOORS_H */ diff --git a/apps/graphics/traveler/include/trv_graphics.h b/apps/graphics/traveler/include/trv_graphics.h new file mode 100644 index 000000000..5364c8bc7 --- /dev/null +++ b/apps/graphics/traveler/include/trv_graphics.h @@ -0,0 +1,82 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_graphics.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_GRAPHICS_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_GRAPHICS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct trv_palette_s +{ + int ncolors; /* Number of colors in the look-up table */ + FAR nxgl_mxpixel_t *lut; /* Color lookup table */ +}; + +struct trv_graphics_info_s +{ + nxgl_coord_t width; /* Image width */ + nxgl_coord_t height; /* Image height */ + struct trv_palette_s palette; /* Color palette */ + FAR nxgl_mxpixel_t *buffer; /* Hardware framebuffer */ +}; + +struct trv_framebuffer_s +{ + nxgl_coord_t width; /* Image width */ + nxgl_coord_t height; /* Image height */ + FAR trv_pixel_t *buffer; /* Software render buffer */ +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +int trv_graphics_initialize(uint16_t width, uint16_t height, + uint8_t scale_factor, + FAR struct trv_graphics_info_s *ginfo); +void trv_graphics_terminate(void); +trv_pixel_t trv_graphics_index2pixel(int index); +void trv_display_update(struct trv_framebuffer_s *fb); +trv_pixel_t *trv_get_renderbuffer(uint16_t width, uint16_t height); + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_GRAPHICS_H */ diff --git a/apps/graphics/traveler/include/trv_input.h b/apps/graphics/traveler/include/trv_input.h new file mode 100644 index 000000000..b4b4cf442 --- /dev/null +++ b/apps/graphics/traveler/include/trv_input.h @@ -0,0 +1,53 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_input.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_INPUT_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_INPUT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +void trv_input_initialize(void); +void trv_input_read(void); +void trv_input_terminate(void); + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_INPUT_H */ diff --git a/apps/graphics/traveler/include/trv_main.h b/apps/graphics/traveler/include/trv_main.h new file mode 100644 index 000000000..08d16ef2b --- /dev/null +++ b/apps/graphics/traveler/include/trv_main.h @@ -0,0 +1,61 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_main.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_MAIN_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_MAIN_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +extern bool g_trv_terminate; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +void trv_abort(FAR char *format, ...); + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_MAIN_H */ diff --git a/apps/graphics/traveler/include/trv_pov.h b/apps/graphics/traveler/include/trv_pov.h new file mode 100644 index 000000000..2edc5b7a2 --- /dev/null +++ b/apps/graphics/traveler/include/trv_pov.h @@ -0,0 +1,61 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_pov.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_POV_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_POV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" +#include "trv_world.h" + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* This structure defines the current camera position of the player's eyes */ + +extern struct trv_camera_s g_trv_player; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +void trv_pov_reset(void); +void trv_pov_new(void); + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_POV_H */ diff --git a/apps/graphics/traveler/include/trv_raycntl.h b/apps/graphics/traveler/include/trv_raycntl.h new file mode 100644 index 000000000..01cbed191 --- /dev/null +++ b/apps/graphics/traveler/include/trv_raycntl.h @@ -0,0 +1,63 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_raycntl.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_RAYCNTL_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_RAYCNTL_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +extern uint8_t *trv_raycaster_initialize(uint16_t screen_width, + uint16_t screen_height, + uint8_t scale_factor, + FAR uint8_t *screen_buffer); +extern void trv_raycaster(FAR struct trv_camera_s *player); + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_RAYCNTL_H */ diff --git a/apps/graphics/traveler/include/trv_rayrend.h b/apps/graphics/traveler/include/trv_rayrend.h new file mode 100644 index 000000000..189e17e46 --- /dev/null +++ b/apps/graphics/traveler/include/trv_rayrend.h @@ -0,0 +1,60 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_rayrend.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_RAYEND_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_RAYEND_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" +#include "trv_world.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +void trv_rend_backdrop (struct trv_camera_s *camera); + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_RAYEND_H */ diff --git a/apps/graphics/traveler/include/trv_types.h b/apps/graphics/traveler/include/trv_types.h new file mode 100644 index 000000000..6fbf61071 --- /dev/null +++ b/apps/graphics/traveler/include/trv_types.h @@ -0,0 +1,72 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_types.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_TYPES_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_TYPES_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* The maximum size of a line (for example, in the .INI file) */ + +#define TRV_MAX_LINE 256 + +/* Size of one (internal) pixel */ + +#define TRV_PIXEL_MAX UINT8_MAX + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +typedef uint8_t trv_pixel_t; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_TYPES_H */ diff --git a/apps/graphics/traveler/include/trv_world.h b/apps/graphics/traveler/include/trv_world.h new file mode 100644 index 000000000..b590e2f87 --- /dev/null +++ b/apps/graphics/traveler/include/trv_world.h @@ -0,0 +1,69 @@ +/**************************************************************************** + * apps/graphics/traveler/include/trv_world.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_WORLD_H +#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_WORLD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "trv_types.h" + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* The following structure contains all information necessary to define + * a point-of-view. + */ + +struct trv_camera_s +{ + nxgl_coord_t x; /* Camera X position */ + nxgl_coord_t y; /* Camera Y position */ + nxgl_coord_t z; /* Camera Z position */ + int16_t yaw; /* Camera yaw orientation */ + int16_t pitch; /* Camera pitch orientation */ +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +int trv_world_create(FAR const char *mapfile); +void trv_world_destroy(void); + +#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_WORLD_H */ diff --git a/apps/graphics/traveler/src/trv_main.c b/apps/graphics/traveler/src/trv_main.c new file mode 100755 index 000000000..6f74055ba --- /dev/null +++ b/apps/graphics/traveler/src/trv_main.c @@ -0,0 +1,312 @@ +/**************************************************************************** + * apps/graphics/traveler/trv_debug.h + * This file contains the main logic for the NuttX version of Traveler + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include + +#include "trv_types.h" +#include "trv_bitmaps.h" +#include "trv_world.h" +#include "trv_doors.h" +#include "trv_pov.h" +#include "trv_raycntl.h" +#include "trv_rayrend.h" +#include "trv_input.h" +#include "trv_graphics.h" +#include "trv_color.h" +#include "trv_main.h" + +#if CONFIG_GRAPHICS_TRAVELER_PERFMON +# include +# include +# include +#endif + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void trv_exit(int exitCode); +static void trv_usage(char *execname); +#if CONFIG_GRAPHICS_TRAVELER_PERFMON +static double trv_current_time(void); +#endif + +/**************************************************************************** + * Public Data + *************************************************************************/ + +bool g_trv_terminate; + +/**************************************************************************** + * Private Data + *************************************************************************/ + +static const char g_default_worldfile[] = "transfrm.wld"; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: trv_exit + * + * Description: + ****************************************************************************/ + +static void trv_exit(int exitCode) +{ + /* Release memory held by the ray casting engine */ + + trv_world_destroy(); + + /* Close off input */ + + trv_input_terminate(); + trv_graphics_terminate(); + + exit(exitCode); +} + +/**************************************************************************** + * Name: trv_usage + * + * Description: + ****************************************************************************/ + +static void trv_usage(char *execname) +{ + fprintf(stderr, "Usage: %s [-b] [-p] [world]\n", execname); + fprintf(stderr, "Where:\n"); + fprintf(stderr, " -b Selects 640x400 window (default is 320x200)\n"); + fprintf(stderr, " -p Selects the path to the world data file\n"); + fprintf(stderr, " world Selects the world file name\n"); + exit(EXIT_FAILURE); +} + +/**************************************************************************** + * Name: trv_current_time + * + * Description: + ****************************************************************************/ + +#ifdef CONFIG_GRAPHICS_TRAVELER_PERFMON +static double trv_current_time(void) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + return (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0; +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: main + * + * Description: + ****************************************************************************/ + +int main(int argc, char *argv[]) +{ + FAR struct trv_graphics_info_s ginfo; + struct trv_framebuffer_s frame; + FAR const char *world_filename; + uint8_t scale_factor = 1; +#ifdef CONFIG_GRAPHICS_TRAVELER_PERFMON + int32_t frame_count = 0; + double elapsed_time = 0.0; + double start_time; +#endif + int ret; + int i; + + /* Check for command line arguments */ + + world_filename = g_default_worldfile; + for (i = 1; i < argc; i++) + { + FAR char *ptr = argv[i]; + if (*ptr == '-') + { + ptr++; + switch (*ptr) + { + case 'b': + scale_factor = 2; + break; + + case 'p' : + ptr++; + printf("World data path = %s\n", ptr); + if (chdir(ptr)) + { + fprintf(stderr, "Bad path name\n"); + trv_usage(argv[0]); + } + break; + + default: + fprintf(stderr, "Invalid Switch\n"); + trv_usage(argv[0]); + break; + } + } + else + { + world_filename = ptr; + } + } + + printf("World data file = %s\n", world_filename); + + /* Initialize the graphics interface */ + + ret = trv_graphics_initialize(320, 200, scale_factor, &ginfo); + if (ret < 0) + { + fprintf(stderr, "ERROR: trv_graphics_initialize failed: %d\n", ret); + trv_exit(EXIT_FAILURE); + } + + /* Load the word data structures */ + + ret = trv_world_create(world_filename); + if (ret < 0) + { + fprintf(stderr, "ERROR: %d loading world file %s: %d\n", + world_filename, ret); + trv_exit(EXIT_FAILURE); + } + + /* We can now release any color mapping tables */ + + trv_color_endmapping(); + + /* Set the player's POV in the new world */ + + trv_pov_reset(); + + /* Initialize the world's door */ + + trv_door_initialize(); + + /* Initialize the ray cast engine */ + + frame.width = ginfo.width; + frame.height = ginfo.height; + frame.buffer = trv_get_renderbuffer(ginfo.width, ginfo.height); + + if (!trv_raycaster_initialize(frame.width, frame.height, + scale_factor, frame.buffer)) + { + fprintf(stderr, "Error: Initializing ray cast engine.\n"); + trv_exit(EXIT_FAILURE); + } + + /* Set up to receive input */ + + trv_input_initialize(); + + g_trv_terminate = false; + while (!g_trv_terminate) + { +#ifdef CONFIG_GRAPHICS_TRAVELER_PERFMON + start_time = trv_current_time(); +#endif + trv_input_read(); + + /* Select the POV to use on this viewing cycle */ + + trv_pov_new(); + + /* Process door animations */ + + trv_door_animate(); + + /* Paint the back drop */ + + trv_rend_backdrop(&g_trv_player); + + /* Render the 3-D view */ + + trv_raycaster(&g_trv_player); + + /* Display the world. */ + + trv_display_update(&frame); +#ifdef CONFIG_GRAPHICS_TRAVELER_PERFMON + frame_count++; + elapsed_time += trv_current_time() - start_time; + if (frame_count == 100) + { + fprintf(stderr, "fps = %3.2f\n", (double) frame_count / elapsed_time); + frame_count = 0; + elapsed_time = 0.0; + } +#endif + } + + trv_exit(EXIT_SUCCESS); + return 0; +} + +/**************************************************************************** + * Name: trv_abort + * + * Description: + ****************************************************************************/ + +void trv_abort(FAR char *message, ...) +{ + va_list args; + + va_start(args, message); + vfprintf(stderr, message, args); + putc('\n', stderr); + va_end(args); + + trv_exit(EXIT_FAILURE); +} diff --git a/apps/graphics/traveller/.gitignore b/apps/graphics/traveller/.gitignore deleted file mode 100644 index 83bd7b811..000000000 --- a/apps/graphics/traveller/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -/Make.dep -/.depend -/.built -/*.asm -/*.rel -/*.lst -/*.sym -/*.adb -/*.lib -/*.src -/*.obj diff --git a/apps/graphics/traveller/Kconfig b/apps/graphics/traveller/Kconfig deleted file mode 100644 index 3feee99bb..000000000 --- a/apps/graphics/traveller/Kconfig +++ /dev/null @@ -1,26 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -if GRAPHICS_TRAVELER - -config GRAPHICS_TRAVELER_PERFMON - bool "Performance monitor game" - default y - ---help--- - Enable or disable performance monitoring instrumentation and output. - -config GRAPHICS_TRAVELER_DEBUG_LEVEL - int "Debug output level" - default 0 - range 0 3 - ---help--- - DEBUG_LEVEL == 3 turns off sound and video and enables verbose debug - messages on stdout. - DEBUG_LEVEL == 2 turns off sound and video and enables normal debug - output - DEBUG_LEVEL == 1 turns off sound and enables normal debug output - OTHERWISE, all debugging features are disabled. - -endif # GRAPHICS_TRAVELER diff --git a/apps/graphics/traveller/Makefile b/apps/graphics/traveller/Makefile deleted file mode 100644 index 7a11a7b21..000000000 --- a/apps/graphics/traveller/Makefile +++ /dev/null @@ -1,142 +0,0 @@ -############################################################################ -# apps/graphics/traveller/Makefile -# -# Copyright (C) 2014 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name NuttX nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# Hello, World! built-in application info - -APPNAME = traveller -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Hello, World! Example - -ASRCS = -CSRCS = -MAINSRC = trv_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) -MAINOBJ = $(MAINSRC:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) $(MAINSRC) -OBJS = $(AOBJS) $(COBJS) - -ifneq ($(CONFIG_BUILD_KERNEL),y) - OBJS += $(MAINOBJ) -endif - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ifeq ($(WINTOOL),y) - INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}" -else - INSTALL_DIR = $(BIN_DIR) -endif - -CONFIG_EXAMPLES_HELLO_PROGNAME ?= hello$(EXEEXT) -PROGNAME = $(CONFIG_EXAMPLES_HELLO_PROGNAME) - -ifeq ($(WINTOOL),y) -INCDIROPT = -w -endif - -CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/graphics/traveller/include} - -DEPPATH = --dep-path src -VPATH = src - -# Common build - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -ifeq ($(CONFIG_BUILD_KERNEL),y) -$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ) - @echo "LD: $(PROGNAME)" - $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS) - $(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME) - -install: $(BIN_DIR)$(DELIM)$(PROGNAME) - -else -install: - -endif - -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - -context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat -else -context: -endif - -.depend: Makefile $(SRCS) - @$(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/graphics/traveller/include/trv_bitmaps.h b/apps/graphics/traveller/include/trv_bitmaps.h deleted file mode 100644 index 43e6c84ea..000000000 --- a/apps/graphics/traveller/include/trv_bitmaps.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_bitmaps.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_BITMAPS_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_BITMAPS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_BITMAPS_H */ diff --git a/apps/graphics/traveller/include/trv_color.h b/apps/graphics/traveller/include/trv_color.h deleted file mode 100644 index 3f11b4148..000000000 --- a/apps/graphics/traveller/include/trv_color.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_color.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_COLOR_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_COLOR_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" -#include "trv_graphics.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -struct trv_color_rgb_s -{ - uint8_t red; - uint8_t green; - uint8_t blue; -}; - -struct trv_color_lum_s -{ - float red; - float green; - float blue; - float luminance; -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -bool trv_color_allocate(FAR struct trv_palette_s *pinfo); -void trv_color_endmapping(void); -trv_pixel_t trv_color_rgb2pixel(FAR struct trv_color_rgb_s *pixel); -void trv_color_pixel2lum(trv_pixel_t pixel, FAR struct trv_color_lum_s *lum); -trv_pixel_t trv_color_lum2pixel(FAR struct trv_color_lum_s *lum); - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_COLOR_H */ diff --git a/apps/graphics/traveller/include/trv_debug.h b/apps/graphics/traveller/include/trv_debug.h deleted file mode 100644 index e0912f4fe..000000000 --- a/apps/graphics/traveller/include/trv_debug.h +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_debug.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_DEBUG_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_DEBUG_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Feature Selection Switches - * - * CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 3 turns off sound and video and - * enables verbose debug messages on stdout. - * CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 2 turns off sound and video and - * enables normal debug output - * CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 1 turns off sound and enables - * normal debug output - * OTHERWISE, all debugging features are disabled. - */ - -#define ENABLE_SOUND 1 -#define ENABLE_VIDEO 1 -#undef TRV_VERBOSE - -#ifndef CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL -# define CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL 0 -#ielf (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 3) -# undef ENABLE_SOUND -# undef ENABLE_VIDEO -# define TRV_VERBOSE 1 -#elif (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 2) -# undef ENABLE_SOUND -# undef ENABLE_VIDEO -#elif (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 1) -# undef ENABLE_SOUND -#endif - -/* Sound is not yet supported */ - -#undef ENABLE_SOUND - -/* Debug output macros */ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# if (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL > 0) - -# define trv_debug(format, ...) \ - printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) - -# ifdef TRV_VERBOSE -# define trv_vdebug(format, ...) \ - printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) - -# else -# define vdbg(x...) -# endif - -# else - -# define dbg(x...) -# define vdbg(x...) - -# endif -#else - - /* Variadic macros NOT supported */ - -# if (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL > 0) -# ifdef TRV_VERBOSE -# define trv_vdebug trv_debug -# else -# define trv_vdebug (void) -# endif -# else -# define trv_debug (void) -# define trv_vdebug (void) -# endif - -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* The debugging interfaces are normally accessed via the macros provided - * above. If the cross-compiler's C pre-processor supports a variable - * number of macro arguments, then those macros below will map all - * debug statements to printf. - * - * If the cross-compiler's pre-processor does not support variable length - * arguments, then this additional interface will be built. - */ - -#ifndef CONFIG_CPP_HAVE_VARARGS && (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL > 0) -int trv_debug(FAR const char *format, ...); -#endif - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_DEBUG_H */ diff --git a/apps/graphics/traveller/include/trv_doors.h b/apps/graphics/traveller/include/trv_doors.h deleted file mode 100644 index 44ab7e18c..000000000 --- a/apps/graphics/traveller/include/trv_doors.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_doors.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_DOORS_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_DOORS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void trv_door_initialize(void); -void trv_door_animate(void); - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_DOORS_H */ diff --git a/apps/graphics/traveller/include/trv_graphics.h b/apps/graphics/traveller/include/trv_graphics.h deleted file mode 100644 index d63557b1b..000000000 --- a/apps/graphics/traveller/include/trv_graphics.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_graphics.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_GRAPHICS_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_GRAPHICS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -struct trv_palette_s -{ - int ncolors; /* Number of colors in the look-up table */ - FAR nxgl_mxpixel_t *lut; /* Color lookup table */ -}; - -struct trv_graphics_info_s -{ - nxgl_coord_t width; /* Image width */ - nxgl_coord_t height; /* Image height */ - struct trv_palette_s palette; /* Color palette */ - FAR nxgl_mxpixel_t *buffer; /* Hardware framebuffer */ -}; - -struct trv_framebuffer_s -{ - nxgl_coord_t width; /* Image width */ - nxgl_coord_t height; /* Image height */ - FAR trv_pixel_t *buffer; /* Software render buffer */ -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -int trv_graphics_initialize(uint16_t width, uint16_t height, - uint8_t scale_factor, - FAR struct trv_graphics_info_s *ginfo); -void trv_graphics_terminate(void); -trv_pixel_t trv_graphics_index2pixel(int index); -void trv_display_update(struct trv_framebuffer_s *fb); -trv_pixel_t *trv_get_renderbuffer(uint16_t width, uint16_t height); - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_GRAPHICS_H */ diff --git a/apps/graphics/traveller/include/trv_input.h b/apps/graphics/traveller/include/trv_input.h deleted file mode 100644 index beeeb8179..000000000 --- a/apps/graphics/traveller/include/trv_input.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_input.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_INPUT_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_INPUT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void trv_input_initialize(void); -void trv_input_read(void); -void trv_input_terminate(void); - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_INPUT_H */ diff --git a/apps/graphics/traveller/include/trv_main.h b/apps/graphics/traveller/include/trv_main.h deleted file mode 100644 index 9d53c3ad5..000000000 --- a/apps/graphics/traveller/include/trv_main.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_main.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_MAIN_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_MAIN_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -extern bool g_trv_terminate; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void trv_abort(FAR char *format, ...); - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_MAIN_H */ diff --git a/apps/graphics/traveller/include/trv_pov.h b/apps/graphics/traveller/include/trv_pov.h deleted file mode 100644 index 986480e11..000000000 --- a/apps/graphics/traveller/include/trv_pov.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_pov.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_POV_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_POV_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" -#include "trv_world.h" - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* This structure defines the current camera position of the player's eyes */ - -extern struct trv_camera_s g_trv_player; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void trv_pov_reset(void); -void trv_pov_new(void); - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_POV_H */ diff --git a/apps/graphics/traveller/include/trv_raycntl.h b/apps/graphics/traveller/include/trv_raycntl.h deleted file mode 100644 index a843cd2c8..000000000 --- a/apps/graphics/traveller/include/trv_raycntl.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_raycntl.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_RAYCNTL_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_RAYCNTL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -extern uint8_t *trv_raycaster_initialize(uint16_t screen_width, - uint16_t screen_height, - uint8_t scale_factor, - FAR uint8_t *screen_buffer); -extern void trv_raycaster(FAR struct trv_camera_s *player); - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_RAYCNTL_H */ diff --git a/apps/graphics/traveller/include/trv_rayrend.h b/apps/graphics/traveller/include/trv_rayrend.h deleted file mode 100644 index 3773a977c..000000000 --- a/apps/graphics/traveller/include/trv_rayrend.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_rayrend.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_RAYEND_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_RAYEND_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" -#include "trv_world.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void trv_rend_backdrop (struct trv_camera_s *camera); - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_RAYEND_H */ diff --git a/apps/graphics/traveller/include/trv_types.h b/apps/graphics/traveller/include/trv_types.h deleted file mode 100644 index 83ee29dd4..000000000 --- a/apps/graphics/traveller/include/trv_types.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_types.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_TYPES_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_TYPES_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* The maximum size of a line (for example, in the .INI file) */ - -#define TRV_MAX_LINE 256 - -/* Size of one (internal) pixel */ - -#define TRV_PIXEL_MAX UINT8_MAX - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -typedef uint8_t trv_pixel_t; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_TYPES_H */ diff --git a/apps/graphics/traveller/include/trv_world.h b/apps/graphics/traveller/include/trv_world.h deleted file mode 100644 index 5e06fc9a7..000000000 --- a/apps/graphics/traveller/include/trv_world.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/include/trv_world.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_WORLD_H -#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_WORLD_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "trv_types.h" - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* The following structure contains all information necessary to define - * a point-of-view. - */ - -struct trv_camera_s -{ - nxgl_coord_t x; /* Camera X position */ - nxgl_coord_t y; /* Camera Y position */ - nxgl_coord_t z; /* Camera Z position */ - int16_t yaw; /* Camera yaw orientation */ - int16_t pitch; /* Camera pitch orientation */ -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -int trv_world_create(FAR const char *mapfile); -void trv_world_destroy(void); - -#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_WORLD_H */ diff --git a/apps/graphics/traveller/src/trv_main.c b/apps/graphics/traveller/src/trv_main.c deleted file mode 100755 index 6e4339f84..000000000 --- a/apps/graphics/traveller/src/trv_main.c +++ /dev/null @@ -1,312 +0,0 @@ -/**************************************************************************** - * apps/graphics/traveller/trv_debug.h - * This file contains the main logic for the NuttX version of Traveller - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include -#include - -#include "trv_types.h" -#include "trv_bitmaps.h" -#include "trv_world.h" -#include "trv_doors.h" -#include "trv_pov.h" -#include "trv_raycntl.h" -#include "trv_rayrend.h" -#include "trv_input.h" -#include "trv_graphics.h" -#include "trv_color.h" -#include "trv_main.h" - -#if CONFIG_GRAPHICS_TRAVELER_PERFMON -# include -# include -# include -#endif - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static void trv_exit(int exitCode); -static void trv_usage(char *execname); -#if CONFIG_GRAPHICS_TRAVELER_PERFMON -static double trv_current_time(void); -#endif - -/**************************************************************************** - * Public Data - *************************************************************************/ - -bool g_trv_terminate; - -/**************************************************************************** - * Private Data - *************************************************************************/ - -static const char g_default_worldfile[] = "transfrm.wld"; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: trv_exit - * - * Description: - ****************************************************************************/ - -static void trv_exit(int exitCode) -{ - /* Release memory held by the ray casting engine */ - - trv_world_destroy(); - - /* Close off input */ - - trv_input_terminate(); - trv_graphics_terminate(); - - exit(exitCode); -} - -/**************************************************************************** - * Name: trv_usage - * - * Description: - ****************************************************************************/ - -static void trv_usage(char *execname) -{ - fprintf(stderr, "Usage: %s [-b] [-p] [world]\n", execname); - fprintf(stderr, "Where:\n"); - fprintf(stderr, " -b Selects 640x400 window (default is 320x200)\n"); - fprintf(stderr, " -p Selects the path to the world data file\n"); - fprintf(stderr, " world Selects the world file name\n"); - exit(EXIT_FAILURE); -} - -/**************************************************************************** - * Name: trv_current_time - * - * Description: - ****************************************************************************/ - -#ifdef CONFIG_GRAPHICS_TRAVELER_PERFMON -static double trv_current_time(void) -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - return (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0; -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: main - * - * Description: - ****************************************************************************/ - -int main(int argc, char *argv[]) -{ - FAR struct trv_graphics_info_s ginfo; - struct trv_framebuffer_s frame; - FAR const char *world_filename; - uint8_t scale_factor = 1; -#ifdef CONFIG_GRAPHICS_TRAVELER_PERFMON - int32_t frame_count = 0; - double elapsed_time = 0.0; - double start_time; -#endif - int ret; - int i; - - /* Check for command line arguments */ - - world_filename = g_default_worldfile; - for (i = 1; i < argc; i++) - { - FAR char *ptr = argv[i]; - if (*ptr == '-') - { - ptr++; - switch (*ptr) - { - case 'b': - scale_factor = 2; - break; - - case 'p' : - ptr++; - printf("World data path = %s\n", ptr); - if (chdir(ptr)) - { - fprintf(stderr, "Bad path name\n"); - trv_usage(argv[0]); - } - break; - - default: - fprintf(stderr, "Invalid Switch\n"); - trv_usage(argv[0]); - break; - } - } - else - { - world_filename = ptr; - } - } - - printf("World data file = %s\n", world_filename); - - /* Initialize the graphics interface */ - - ret = trv_graphics_initialize(320, 200, scale_factor, &ginfo); - if (ret < 0) - { - fprintf(stderr, "ERROR: trv_graphics_initialize failed: %d\n", ret); - trv_exit(EXIT_FAILURE); - } - - /* Load the word data structures */ - - ret = trv_world_create(world_filename); - if (ret < 0) - { - fprintf(stderr, "ERROR: %d loading world file %s: %d\n", - world_filename, ret); - trv_exit(EXIT_FAILURE); - } - - /* We can now release any color mapping tables */ - - trv_color_endmapping(); - - /* Set the player's POV in the new world */ - - trv_pov_reset(); - - /* Initialize the world's door */ - - trv_door_initialize(); - - /* Initialize the ray cast engine */ - - frame.width = ginfo.width; - frame.height = ginfo.height; - frame.buffer = trv_get_renderbuffer(ginfo.width, ginfo.height); - - if (!trv_raycaster_initialize(frame.width, frame.height, - scale_factor, frame.buffer)) - { - fprintf(stderr, "Error: Initializing ray cast engine.\n"); - trv_exit(EXIT_FAILURE); - } - - /* Set up to receive input */ - - trv_input_initialize(); - - g_trv_terminate = false; - while (!g_trv_terminate) - { -#ifdef CONFIG_GRAPHICS_TRAVELER_PERFMON - start_time = trv_current_time(); -#endif - trv_input_read(); - - /* Select the POV to use on this viewing cycle */ - - trv_pov_new(); - - /* Process door animations */ - - trv_door_animate(); - - /* Paint the back drop */ - - trv_rend_backdrop(&g_trv_player); - - /* Render the 3-D view */ - - trv_raycaster(&g_trv_player); - - /* Display the world. */ - - trv_display_update(&frame); -#ifdef CONFIG_GRAPHICS_TRAVELER_PERFMON - frame_count++; - elapsed_time += trv_current_time() - start_time; - if (frame_count == 100) - { - fprintf(stderr, "fps = %3.2f\n", (double) frame_count / elapsed_time); - frame_count = 0; - elapsed_time = 0.0; - } -#endif - } - - trv_exit(EXIT_SUCCESS); - return 0; -} - -/**************************************************************************** - * Name: trv_abort - * - * Description: - ****************************************************************************/ - -void trv_abort(FAR char *message, ...) -{ - va_list args; - - va_start(args, message); - vfprintf(stderr, message, args); - putc('\n', stderr); - va_end(args); - - trv_exit(EXIT_FAILURE); -} -- cgit v1.2.3