diff options
Diffstat (limited to 'apps/graphics/traveller/include')
-rw-r--r-- | apps/graphics/traveller/include/trv_bitmaps.h | 57 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_color.h | 79 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_debug.h | 2 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_doors.h | 52 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_graphics.h | 82 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_input.h | 53 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_main.h | 61 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_pov.h | 61 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_raycntl.h | 63 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_rayrend.h | 60 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_types.h | 7 | ||||
-rw-r--r-- | apps/graphics/traveller/include/trv_world.h | 69 |
12 files changed, 641 insertions, 5 deletions
diff --git a/apps/graphics/traveller/include/trv_bitmaps.h b/apps/graphics/traveller/include/trv_bitmaps.h new file mode 100644 index 000000000..43e6c84ea --- /dev/null +++ b/apps/graphics/traveller/include/trv_bitmaps.h @@ -0,0 +1,57 @@ +/**************************************************************************** + * apps/graphics/traveller/include/trv_bitmaps.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 new file mode 100644 index 000000000..3f11b4148 --- /dev/null +++ b/apps/graphics/traveller/include/trv_color.h @@ -0,0 +1,79 @@ +/**************************************************************************** + * apps/graphics/traveller/include/trv_color.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 index 33632df5f..e0912f4fe 100644 --- a/apps/graphics/traveller/include/trv_debug.h +++ b/apps/graphics/traveller/include/trv_debug.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/graphics/traveller/trv_debug.h + * apps/graphics/traveller/include/trv_debug.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> diff --git a/apps/graphics/traveller/include/trv_doors.h b/apps/graphics/traveller/include/trv_doors.h new file mode 100644 index 000000000..44ab7e18c --- /dev/null +++ b/apps/graphics/traveller/include/trv_doors.h @@ -0,0 +1,52 @@ +/**************************************************************************** + * apps/graphics/traveller/include/trv_doors.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 new file mode 100644 index 000000000..d63557b1b --- /dev/null +++ b/apps/graphics/traveller/include/trv_graphics.h @@ -0,0 +1,82 @@ +/**************************************************************************** + * apps/graphics/traveller/include/trv_graphics.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 new file mode 100644 index 000000000..beeeb8179 --- /dev/null +++ b/apps/graphics/traveller/include/trv_input.h @@ -0,0 +1,53 @@ +/**************************************************************************** + * apps/graphics/traveller/include/trv_input.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 new file mode 100644 index 000000000..9d53c3ad5 --- /dev/null +++ b/apps/graphics/traveller/include/trv_main.h @@ -0,0 +1,61 @@ +/**************************************************************************** + * apps/graphics/traveller/include/trv_main.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 new file mode 100644 index 000000000..986480e11 --- /dev/null +++ b/apps/graphics/traveller/include/trv_pov.h @@ -0,0 +1,61 @@ +/**************************************************************************** + * apps/graphics/traveller/include/trv_pov.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 new file mode 100644 index 000000000..a843cd2c8 --- /dev/null +++ b/apps/graphics/traveller/include/trv_raycntl.h @@ -0,0 +1,63 @@ +/**************************************************************************** + * apps/graphics/traveller/include/trv_raycntl.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 new file mode 100644 index 000000000..3773a977c --- /dev/null +++ b/apps/graphics/traveller/include/trv_rayrend.h @@ -0,0 +1,60 @@ +/**************************************************************************** + * apps/graphics/traveller/include/trv_rayrend.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 index b7371b758..83ee29dd4 100644 --- a/apps/graphics/traveller/include/trv_types.h +++ b/apps/graphics/traveller/include/trv_types.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/graphics/traveller/trv_types.h + * apps/graphics/traveller/include/trv_types.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> @@ -63,11 +63,10 @@ * Public Types ****************************************************************************/ -typedef uint8_t trv_pixel_t; -typedef nxgl_mxpixel_t dev_pixel_t; +typedef uint8_t trv_pixel_t; /**************************************************************************** - * Pre-processor Definitions + * 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 new file mode 100644 index 000000000..5e06fc9a7 --- /dev/null +++ b/apps/graphics/traveller/include/trv_world.h @@ -0,0 +1,69 @@ +/**************************************************************************** + * apps/graphics/traveller/include/trv_world.h + * + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * 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 */ |