diff --git a/include/QF/GL/qf_iqm.h b/include/QF/GL/qf_iqm.h index 47a77d6da..f661bcde7 100644 --- a/include/QF/GL/qf_iqm.h +++ b/include/QF/GL/qf_iqm.h @@ -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 diff --git a/include/QF/render.h b/include/QF/render.h index b4f6c32d6..8a3feb5df 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -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); diff --git a/include/QF/scene/entity.h b/include/QF/scene/entity.h index fd5ca8bc0..2345ac3e2 100644 --- a/include/QF/scene/entity.h +++ b/include/QF/scene/entity.h @@ -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); ///@} diff --git a/include/r_internal.h b/include/r_internal.h index c4b5a15b7..456c4572a 100644 --- a/include/r_internal.h +++ b/include/r_internal.h @@ -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, diff --git a/include/r_local.h b/include/r_local.h index 4ae111026..d5ca6113c 100644 --- a/include/r_local.h +++ b/include/r_local.h @@ -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 ======================================= diff --git a/libs/client/cl_view.c b/libs/client/cl_view.c index 7668ca832..a4120eeab 100644 --- a/libs/client/cl_view.c +++ b/libs/client/cl_view.c @@ -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" diff --git a/libs/ruamoko/rua_scene.c b/libs/ruamoko/rua_scene.c index 9656ba0da..11aee7eb7 100644 --- a/libs/ruamoko/rua_scene.c +++ b/libs/ruamoko/rua_scene.c @@ -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" diff --git a/libs/video/renderer/gl/gl_mod_iqm.c b/libs/video/renderer/gl/gl_mod_iqm.c index f33828c29..2b2555020 100644 --- a/libs/video/renderer/gl/gl_mod_iqm.c +++ b/libs/video/renderer/gl/gl_mod_iqm.c @@ -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" diff --git a/libs/video/renderer/r_alias.c b/libs/video/renderer/r_alias.c index 6dea420b6..bd3b7b931 100644 --- a/libs/video/renderer/r_alias.c +++ b/libs/video/renderer/r_alias.c @@ -29,6 +29,7 @@ #endif #include "QF/sys.h" +#include "QF/scene/entity.h" #include "r_internal.h" diff --git a/libs/video/renderer/r_bsp.c b/libs/video/renderer/r_bsp.c index 2abb2c05d..53b778647 100644 --- a/libs/video/renderer/r_bsp.c +++ b/libs/video/renderer/r_bsp.c @@ -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; diff --git a/libs/video/renderer/r_iqm.c b/libs/video/renderer/r_iqm.c index 84ce67744..aaecb5aab 100644 --- a/libs/video/renderer/r_iqm.c +++ b/libs/video/renderer/r_iqm.c @@ -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" diff --git a/libs/video/renderer/r_main.c b/libs/video/renderer/r_main.c index 846a57dad..c93c8f467 100644 --- a/libs/video/renderer/r_main.c +++ b/libs/video/renderer/r_main.c @@ -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; diff --git a/libs/video/renderer/r_sprite.c b/libs/video/renderer/r_sprite.c index ecce7ad55..cfe0beb59 100644 --- a/libs/video/renderer/r_sprite.c +++ b/libs/video/renderer/r_sprite.c @@ -29,6 +29,7 @@ #endif #include "QF/sys.h" +#include "QF/scene/entity.h" #include "r_internal.h" diff --git a/libs/video/renderer/sw/d_surf.c b/libs/video/renderer/sw/d_surf.c index cc90bd95b..f16122d79 100644 --- a/libs/video/renderer/sw/d_surf.c +++ b/libs/video/renderer/sw/d_surf.c @@ -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" diff --git a/libs/video/renderer/sw/sw_rdraw.c b/libs/video/renderer/sw/sw_rdraw.c index 38e80cfd1..1d7a2a545 100644 --- a/libs/video/renderer/sw/sw_rdraw.c +++ b/libs/video/renderer/sw/sw_rdraw.c @@ -29,6 +29,7 @@ #endif #include "QF/render.h" +#include "QF/scene/entity.h" #include "r_internal.h" diff --git a/nq/include/client.h b/nq/include/client.h index 62b24a4d4..28394ce52 100644 --- a/nq/include/client.h +++ b/nq/include/client.h @@ -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; diff --git a/qw/include/cl_ents.h b/qw/include/cl_ents.h index 53ec080f7..93872edda 100644 --- a/qw/include/cl_ents.h +++ b/qw/include/cl_ents.h @@ -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;