[scene] Move entity_t etc into scene headers

I meant to do this a while ago but forgot about it. Things are a bit of
a mess in that the renderer knows too much about entities, but
eventually the renderer will know about only things to render (meshes,
particles, etc).
This commit is contained in:
Bill Currie 2022-03-29 14:40:48 +09:00
parent 75d7f4cecb
commit 3c86764eb2
17 changed files with 84 additions and 72 deletions

View File

@ -44,6 +44,7 @@ typedef struct glsliqm_s {
iqmvertexarray *color;
} gliqm_t;
void gl_R_DrawIQMModel (entity_t *ent);
struct entity_s;
void gl_R_DrawIQMModel (struct entity_s *ent);
#endif//__QF_GL_qf_iqm_h

View File

@ -120,49 +120,6 @@ typedef struct
//===============
typedef struct animation_s {
int frame;
float syncbase; // randomize time base for local animations
float frame_start_time;
float frame_interval;
int pose1;
int pose2;
float blend;
int nolerp; // don't lerp this frame (pose data invalid)
} animation_t;
typedef struct visibility_s {
struct entity_s *entity; // owning entity
struct efrag_s *efrag; // linked list of efrags
struct mnode_s *topnode; // bmodels, first world node that
// splits bmodel, or NULL if not split
// applies to other models, too
// found in an active leaf
int trivial_accept; // view clipping (frustum and depth)
} visibility_t;
typedef struct renderer_s {
struct model_s *model; // NULL = no model
struct skin_s *skin;
float colormod[4]; // color tint and alpha for model
int skinnum; // for Alias models
int fullbright;
float min_light;
mat4_t full_transform;
} renderer_t;
typedef struct entity_s {
struct entity_s *next;
struct transform_s *transform;
int id; ///< scene id
animation_t animation;
visibility_t visibility;
renderer_t renderer;
int active;
//XXX FIXME XXX should not be here
vec4f_t old_origin;
} entity_t;
typedef union refframe_s {
mat4f_t mat;
struct {
@ -240,8 +197,6 @@ void R_LoadModule (struct vid_internal_s *vid_internal);
struct progs_s;
void R_Progs_Init (struct progs_s *pr);
void R_AddEfrags (mod_brush_t *, entity_t *ent);
void R_RemoveEfrags (entity_t *ent);
dlight_t *R_AllocDlight (int key);
void R_MaxDlightsCheck (struct cvar_s *var);
void R_DecayLights (double frametime);

View File

@ -45,7 +45,48 @@
#include "QF/scene/hierarchy.h"
#include "QF/scene/transform.h"
#include "QF/render.h" //FIXME move entity_t here
typedef struct animation_s {
int frame;
float syncbase; // randomize time base for local animations
float frame_start_time;
float frame_interval;
int pose1;
int pose2;
float blend;
int nolerp; // don't lerp this frame (pose data invalid)
} animation_t;
typedef struct visibility_s {
struct entity_s *entity; // owning entity
struct efrag_s *efrag; // linked list of efrags
struct mnode_s *topnode; // bmodels, first world node that
// splits bmodel, or NULL if not split
// applies to other models, too
// found in an active leaf
int trivial_accept; // view clipping (frustum and depth)
} visibility_t;
typedef struct renderer_s {
struct model_s *model; // NULL = no model
struct skin_s *skin;
float colormod[4]; // color tint and alpha for model
int skinnum; // for Alias models
int fullbright;
float min_light;
mat4_t full_transform;
} renderer_t;
typedef struct entity_s {
struct entity_s *next;
struct transform_s *transform;
int id; ///< scene id
animation_t animation;
visibility_t visibility;
renderer_t renderer;
int active;
//XXX FIXME XXX should not be here
vec4f_t old_origin;
} entity_t;
typedef struct entqueue_s {
set_t *queued_ents;
@ -78,6 +119,9 @@ EntQueue_AddEntity (entqueue_t *queue, entity_t *ent, int queue_num)
DARRAY_APPEND (&queue->ent_queues[queue_num], ent);
}
}
struct mod_brush_s;
void R_AddEfrags (struct mod_brush_s *, entity_t *ent);
void R_RemoveEfrags (entity_t *ent);
///@}

View File

@ -69,17 +69,19 @@ void R_ClearDlights (void);
int R_InitGraphTextures (int base);
void R_DrawAliasModel (entity_t *e);
struct entity_s;
struct animation_s;
void R_DrawAliasModel (struct entity_s *e);
void R_MarkLeaves (void);
void GL_SetPalette (void *data, const byte *palette);
void GLSL_SetPalette (void *data, const byte *palette);
int R_BillboardFrame (entity_t *ent, int orientation, const vec3_t cameravec,
int R_BillboardFrame (struct entity_s *ent, int orientation, const vec3_t cameravec,
vec3_t bbup, vec3_t bbright, vec3_t bbfwd);
mspriteframe_t *R_GetSpriteFrame (const msprite_t *sprite,
const animation_t *animation);
const struct animation_s *animation);
// These correspond to the standard box sides for OpenGL cube maps but with
// TOP and BOTTOM swapped due to lelt/right handed systems (quake/gl are right,

View File

@ -145,37 +145,40 @@ union refframe_s;
void R_SetFrustum (plane_t *frustum, const union refframe_s *frame,
float fov_x, float fov_y);
struct entity_s;
void R_SpriteBegin (void);
void R_SpriteEnd (void);
void R_DrawSprite (entity_t *ent);
void R_RenderFace (entity_t *ent, msurface_t *fa, int clipflags);
void R_RenderPoly (entity_t *ent, msurface_t *fa, int clipflags);
void R_RenderBmodelFace (entity_t *ent, bedge_t *pedges, msurface_t *psurf);
void R_DrawSprite (struct entity_s *ent);
void R_RenderFace (struct entity_s *ent, msurface_t *fa, int clipflags);
void R_RenderPoly (struct entity_s *ent, msurface_t *fa, int clipflags);
void R_RenderBmodelFace (struct entity_s *ent, bedge_t *pedges, msurface_t *psurf);
void R_TransformFrustum (void);
void R_SetSkyFrame (void);
void R_DrawSurfaceBlock (void);
texture_t *R_TextureAnimation (const entity_t *entity, msurface_t *surf) __attribute__((pure));
texture_t *R_TextureAnimation (const struct entity_s *entity, msurface_t *surf) __attribute__((pure));
void R_GenSkyTile (void *pdest);
void R_SurfPatch (void);
void R_DrawSubmodelPolygons (entity_t *ent, model_t *pmodel, int clipflags, struct mnode_s *topnode);
void R_DrawSolidClippedSubmodelPolygons (entity_t *ent, model_t *pmodel, struct mnode_s *topnode);
void R_DrawSubmodelPolygons (struct entity_s *ent, model_t *pmodel, int clipflags, struct mnode_s *topnode);
void R_DrawSolidClippedSubmodelPolygons (struct entity_s *ent, model_t *pmodel, struct mnode_s *topnode);
void R_AddPolygonEdges (emitpoint_t *pverts, int numverts, int miplevel);
surf_t *R_GetSurf (void);
void R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av);
void R_AliasDrawModel (entity_t *ent, alight_t *plighting);
void R_IQMDrawModel (entity_t *ent, alight_t *plighting);
maliasskindesc_t *R_AliasGetSkindesc (animation_t *animation, int skinnum, aliashdr_t *hdr);
maliasframedesc_t *R_AliasGetFramedesc (animation_t *animation, aliashdr_t *hdr);
float R_AliasGetLerpedFrames (animation_t *animation, aliashdr_t *hdr);
float R_IQMGetLerpedFrames (entity_t *ent, iqm_t *hdr);
void R_AliasDrawModel (struct entity_s *ent, alight_t *plighting);
void R_IQMDrawModel (struct entity_s *ent, alight_t *plighting);
struct animation_s;
maliasskindesc_t *R_AliasGetSkindesc (struct animation_s *animation, int skinnum, aliashdr_t *hdr);
maliasframedesc_t *R_AliasGetFramedesc (struct animation_s *animation, aliashdr_t *hdr);
float R_AliasGetLerpedFrames (struct animation_s *animation, aliashdr_t *hdr);
float R_IQMGetLerpedFrames (struct entity_s *ent, iqm_t *hdr);
iqmframe_t *R_IQMBlendFrames (const iqm_t *iqm, int frame1, int frame2,
float blend, int extra);
iqmframe_t *R_IQMBlendPalette (const iqm_t *iqm, int frame1, int frame2,
float blend, int extra,
iqmblend_t *blend_palette, int palette_size);
float R_EntityBlend (animation_t *animation, int pose, float interval);
float R_EntityBlend (struct animation_s *animation, int pose, float interval);
void R_BeginEdgeFrame (void);
void R_ScanEdges (void);
void D_DrawSurfaces (void);
@ -229,7 +232,7 @@ typedef struct btofpoly_s {
extern int numbtofpolys;
void R_InitTurb (void);
void R_ZDrawSubmodelPolys (entity_t *ent, model_t *clmodel);
void R_ZDrawSubmodelPolys (struct entity_s *ent, model_t *clmodel);
// Alias models ===========================================
@ -244,7 +247,7 @@ extern auxvert_t *pauxverts;
extern float ziscale;
extern float aliastransform[3][4];
qboolean R_AliasCheckBBox (entity_t *ent);
qboolean R_AliasCheckBBox (struct entity_s *ent);
// turbulence stuff =======================================

View File

@ -34,6 +34,7 @@
#include "QF/screen.h"
#include "QF/plugin/vid_render.h"
#include "QF/scene/entity.h"
#include "QF/scene/transform.h"
#include "QF/simd/vec4f.h"

View File

@ -39,8 +39,8 @@
#include "QF/cmem.h"
#include "QF/hash.h"
#include "QF/progs.h"
#include "QF/render.h"
#include "QF/scene/entity.h"
#include "QF/scene/scene.h"
#include "QF/scene/transform.h"

View File

@ -49,6 +49,7 @@
#include "QF/GL/qf_iqm.h"
#include "QF/GL/qf_rmain.h"
#include "QF/GL/qf_vid.h"
#include "QF/scene/entity.h"
#include "r_internal.h"

View File

@ -29,6 +29,7 @@
#endif
#include "QF/sys.h"
#include "QF/scene/entity.h"
#include "r_internal.h"

View File

@ -39,6 +39,8 @@
#include "QF/set.h"
#include "QF/sys.h"
#include "QF/scene/entity.h"
#include "r_internal.h"
static mleaf_t *r_oldviewleaf;

View File

@ -43,6 +43,7 @@
#include "QF/render.h"
#include "QF/skin.h"
#include "QF/sys.h"
#include "QF/scene/entity.h"
#include "r_internal.h"

View File

@ -51,8 +51,6 @@ qboolean r_force_fullscreen;
qboolean r_paused;
double r_realtime;
double r_frametime;
entity_t *r_view_model;
entity_t *r_player_entity;
double r_time1;
int r_lineadj;
qboolean r_active;

View File

@ -29,6 +29,7 @@
#endif
#include "QF/sys.h"
#include "QF/scene/entity.h"
#include "r_internal.h"

View File

@ -33,6 +33,7 @@
#include "QF/qargs.h"
#include "QF/render.h"
#include "QF/sys.h"
#include "QF/scene/entity.h"
#include "compat.h"
#include "d_local.h"

View File

@ -29,6 +29,7 @@
#endif
#include "QF/render.h"
#include "QF/scene/entity.h"
#include "r_internal.h"

View File

@ -233,7 +233,7 @@ extern struct cvar_s *noskins;
extern client_state_t cl;
extern entity_t *cl_entities[MAX_EDICTS];
extern struct entity_s *cl_entities[MAX_EDICTS];
extern double cl_msgtime[MAX_EDICTS];
extern struct set_s cl_forcelink;
@ -291,7 +291,7 @@ void CL_NewTranslation (int slot, struct skin_s *skin);
void CL_SignonReply (void);
void CL_RelinkEntities (void);
void CL_ClearEnts (void);
entity_t *CL_GetEntity (int num);
struct entity_s *CL_GetEntity (int num);
extern double realtime;

View File

@ -41,7 +41,7 @@ void CL_ParsePacketEntities (qboolean delta);
void CL_SetSolidEntities (void);
void CL_ParsePlayerinfo (void);
void CL_Ents_Init (void);
entity_t *CL_GetEntity (int num);
struct entity_s *CL_GetEntity (int num);
extern struct cvar_s *cl_deadbodyfilter;
extern struct cvar_s *cl_gibfilter;