Add fourth of several ray cast/rendering files
This commit is contained in:
parent
a4c05f2a49
commit
e9088a308a
@ -47,8 +47,8 @@ STACKSIZE = 2048
|
||||
|
||||
ASRCS =
|
||||
CSRCS = trv_bitmaps.c trv_color.c trv_doors.c trv_graphics.c trv_input.c
|
||||
CSRCS += trv_mem.c trv_plane.c trv_pov.c trv_rayavoid.c trv_raycntl.c
|
||||
CSRCS += trv_rayrend.c trv_trigtbl.c
|
||||
CSRCS += trv_mem.c trv_plane.c trv_pov.c trv_rayavoid.c trv_raycast.c
|
||||
CSRCS += trv_raycntl.c trv_rayrend.c trv_trigtbl.c
|
||||
MAINSRC = trv_main.c
|
||||
|
||||
ifeq ($(CONFIG_NX),y)
|
||||
|
@ -42,6 +42,32 @@
|
||||
|
||||
#include "trv_types.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* This structure describes the characteristics of the door which currently
|
||||
* being opened.
|
||||
*/
|
||||
|
||||
struct trv_opendoor_s
|
||||
{
|
||||
FAR struct trv_rect_data_s *rect; /* Points to the current door rectangle */
|
||||
uint8_t state; /* State of the door being opened */
|
||||
trv_coord_t zbottom; /* Z-Coordinate of the bottom of the door */
|
||||
trv_coord_t zdist; /* Distance which the door has moved */
|
||||
int16_t clock; /* This is clock which counts down the time
|
||||
* remaining to keep the door open */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This structure describes the door which is currently opening */
|
||||
|
||||
struct trv_opendoor_s g_opendoor;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
@ -163,7 +163,7 @@ extern struct trv_camera_s g_camera;
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
void trv_raycast(int16_t pitchangle, int16_t yawangle, int16_t screenyaw,
|
||||
void trv_raycast(int16_t pitch, int16_t yaw, int16_t screenyaw,
|
||||
FAR struct trv_raycast_s *result);
|
||||
|
||||
#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_RAYCAST_H */
|
||||
|
@ -42,6 +42,14 @@
|
||||
|
||||
#include "trv_types.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
extern struct trv_rect_head_s g_ray_xplane; /* List of X=plane rectangles */
|
||||
extern struct trv_rect_head_s g_ray_yplane; /* List of Y=plane rectangles */
|
||||
extern struct trv_rect_head_s g_ray_zplane; /* List of Z=plane rectangles */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
@ -69,20 +69,6 @@ enum trv_door_state_e
|
||||
DOOR_CLOSING, /* A door is closing */
|
||||
};
|
||||
|
||||
/* This structure describes the characteristics of the door which currently
|
||||
* being opened.
|
||||
*/
|
||||
|
||||
struct trv_opendoor_s
|
||||
{
|
||||
FAR struct trv_rect_data_s *rect; /* Points to the current door rectangle */
|
||||
uint8_t state; /* State of the door being opened */
|
||||
trv_coord_t zbottom; /* Z-Coordinate of the bottom of the door */
|
||||
trv_coord_t zdistance; /* Distance which the door has moved */
|
||||
int16_t clock; /* This is clock which counts down the time
|
||||
* remaining to keep the door open */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
@ -146,10 +132,10 @@ static void trv_door_startopen (void)
|
||||
* in motion
|
||||
*/
|
||||
|
||||
g_opendoor.rect = rect;
|
||||
g_opendoor.state = DOOR_OPENING;
|
||||
g_opendoor.zbottom = rect->vstart;
|
||||
g_opendoor.zdistance = 0;
|
||||
g_opendoor.rect = rect;
|
||||
g_opendoor.state = DOOR_OPENING;
|
||||
g_opendoor.zbottom = rect->vstart;
|
||||
g_opendoor.zdist = 0;
|
||||
|
||||
/* Mark the door's attribute to indicate that it is in motion */
|
||||
|
||||
@ -176,8 +162,8 @@ static void trv_door_animation(void)
|
||||
|
||||
/* Raise the door a little */
|
||||
|
||||
g_opendoor.zbottom += DOOR_ZSTEP;
|
||||
g_opendoor.zdistance += DOOR_ZSTEP;
|
||||
g_opendoor.zbottom += DOOR_ZSTEP;
|
||||
g_opendoor.zdist += DOOR_ZSTEP;
|
||||
|
||||
/* When the bottom of the door is above the player's head, we will
|
||||
* say that the door is open
|
||||
@ -195,7 +181,7 @@ static void trv_door_animation(void)
|
||||
/* Make sure that the door does not open wider than it is tall */
|
||||
|
||||
g_opendoor.zbottom = g_opendoor.rect->vend;
|
||||
g_opendoor.zdistance = g_opendoor.rect->vend - g_opendoor.rect->vstart;
|
||||
g_opendoor.zdist = g_opendoor.rect->vend - g_opendoor.rect->vstart;
|
||||
|
||||
/* The door is done opening, the next state is the DOOR_OPEN state
|
||||
* where we will hold the door open a while
|
||||
@ -229,7 +215,7 @@ static void trv_door_animation(void)
|
||||
/* Lower the door a little */
|
||||
|
||||
g_opendoor.zbottom -= DOOR_ZSTEP;
|
||||
g_opendoor.zdistance -= DOOR_ZSTEP;
|
||||
g_opendoor.zdist -= DOOR_ZSTEP;
|
||||
|
||||
/* When the bottom of the door is below the player's head, we
|
||||
* will say that the door is closed
|
||||
@ -248,7 +234,7 @@ static void trv_door_animation(void)
|
||||
/* Lower the door a little */
|
||||
|
||||
g_opendoor.zbottom -= DOOR_ZSTEP;
|
||||
g_opendoor.zdistance -= DOOR_ZSTEP;
|
||||
g_opendoor.zdist -= DOOR_ZSTEP;
|
||||
|
||||
/* When the bottom of the door is below the player's head, we will
|
||||
* say that the door is closed
|
||||
@ -261,7 +247,7 @@ static void trv_door_animation(void)
|
||||
|
||||
/* Check if the door is fully closed */
|
||||
|
||||
if (g_opendoor.zdistance <= 0)
|
||||
if (g_opendoor.zdist <= 0)
|
||||
{
|
||||
/* Indicate that the door is no longer in motion */
|
||||
|
||||
|
@ -576,7 +576,7 @@ trv_coord_t trv_rayclip_player_ymotion(FAR struct trv_camera_s *pov,
|
||||
* Make sure that the player is standing on something!
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
trv_coord_t trv_ray_adjust_zpos(FAR struct trv_camera_s *pov,
|
||||
trv_coord_t height)
|
||||
{
|
||||
|
1405
graphics/traveler/src/trv_raycast.c
Normal file
1405
graphics/traveler/src/trv_raycast.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user