X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=model_shared.h;h=94112545dbf13bda5849a94f6c5a275dc65d658c;hb=fed221a2c140ee0d1b002ccc01eac33cf0a114c3;hp=c34890cad8af0c43ee088e057f387b2a303817a0;hpb=489ebac9babed0d5c863cd12801943254e74b84f;p=xonotic%2Fdarkplaces.git diff --git a/model_shared.h b/model_shared.h index c34890ca..94112545 100644 --- a/model_shared.h +++ b/model_shared.h @@ -30,7 +30,7 @@ m*_t structures are in-memory */ -typedef enum modtype_e {mod_invalid, mod_brushq1, mod_sprite, mod_alias, mod_brushq2, mod_brushq3, mod_obj, mod_null} modtype_t; +typedef enum modtype_e {mod_invalid, mod_brushq1, mod_sprite, mod_alias, mod_brushq2, mod_brushq3, mod_brushjk, mod_obj, mod_null} modtype_t; typedef struct animscene_s { @@ -251,6 +251,7 @@ shadowmesh_t; #define Q3TEXTUREFLAG_REFLECTION 512 #define Q3TEXTUREFLAG_WATERSHADER 1024 #define Q3TEXTUREFLAG_CAMERA 2048 +#define Q3TEXTUREFLAG_TRANSPARENTSORT 4096 #define Q3PATHLENGTH 64 #define TEXTURE_MAXFRAMES 64 @@ -426,12 +427,19 @@ typedef enum dpoffsetmapping_technique_s OFFSETMAPPING_RELIEF // relief }dpoffsetmapping_technique_t; +typedef enum dptransparentsort_category_e +{ + TRANSPARENTSORT_SKY, + TRANSPARENTSORT_DISTANCE, + TRANSPARENTSORT_HUD, +}dptransparentsortcategory_t; typedef struct q3shaderinfo_s { char name[Q3PATHLENGTH]; #define Q3SHADERINFO_COMPARE_START surfaceparms int surfaceparms; + int surfaceflags; int textureflags; int numlayers; qboolean lighting; @@ -452,6 +460,9 @@ typedef struct q3shaderinfo_s // add collisions to all triangles of the surface qboolean dpmeshcollisions; + // kill shader based on cvar checks + qboolean dpshaderkill; + // fake reflection char dpreflectcube[Q3PATHLENGTH]; @@ -468,14 +479,21 @@ typedef struct q3shaderinfo_s // offsetmapping dpoffsetmapping_technique_t offsetmapping; float offsetscale; + float offsetbias; // 0 is normal, 1 leads to alpha 0 being neutral and alpha 1 pushing "out" // polygonoffset (only used if Q3TEXTUREFLAG_POLYGONOFFSET) float biaspolygonoffset, biaspolygonfactor; + // transparent sort category + dptransparentsortcategory_t transparentsort; + // gloss float specularscalemod; float specularpowermod; -#define Q3SHADERINFO_COMPARE_END specularpowermod + + // rtlightning ambient addition + float rtlightambient; +#define Q3SHADERINFO_COMPARE_END rtlightambient } q3shaderinfo_t; @@ -592,7 +610,6 @@ typedef struct texture_s char name[64]; int surfaceflags; int supercontents; - int surfaceparms; int textureflags; // reflection @@ -609,10 +626,17 @@ typedef struct texture_s // offsetmapping dpoffsetmapping_technique_t offsetmapping; float offsetscale; + float offsetbias; + + // transparent sort category + dptransparentsortcategory_t transparentsort; // gloss float specularscalemod; float specularpowermod; + + // diffuse and ambient + float rtlightambient; } texture_t; @@ -713,6 +737,8 @@ typedef struct model_brush_s { // true if this model is a HalfLife .bsp file qboolean ishlbsp; + // true if this model is a BSP2 .bsp file (expanded 32bit bsp format for DarkPlaces, RMQ, others?) + qboolean isbsp2; // string of entity definitions (.map format) char *entities; @@ -788,7 +814,7 @@ typedef struct model_brush_s int (*FindBoxClusters)(struct model_s *model, const vec3_t mins, const vec3_t maxs, int maxclusters, int *clusterlist); void (*LightPoint)(struct model_s *model, const vec3_t p, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal); void (*FindNonSolidLocation)(struct model_s *model, const vec3_t in, vec3_t out, vec_t radius); - mleaf_t *(*PointInLeaf)(struct model_s *model, const float *p); + mleaf_t *(*PointInLeaf)(struct model_s *model, const vec3_t p); // these are actually only found on brushq1, but NULL is handled gracefully void (*AmbientSoundLevelsForPoint)(struct model_s *model, const vec3_t p, unsigned char *out, int outsize); void (*RoundUpToHullSize)(struct model_s *cmodel, const vec3_t inmins, const vec3_t inmaxs, vec3_t outmins, vec3_t outmaxs); @@ -810,7 +836,7 @@ model_brush_t; typedef struct model_brushq1_s { - dmodel_t *submodels; + mmodel_t *submodels; int numvertexes; mvertex_t *vertexes; @@ -910,6 +936,63 @@ typedef struct model_brushq3_s } model_brushq3_t; +typedef struct model_brushjk_s +{ + int num_models; + jkdmodel_t *data_models; + + // used only during loading - freed after loading! + int num_vertices; + float *data_vertex3f; + float *data_normal3f; + float *data_texcoordtexture2f; + float **data_texcoordlightmap2f; + float **data_color4f; + + // freed after loading! + int num_triangles; + int *data_element3i; + + int num_effects; + q3deffect_t *data_effects; + + // lightmap textures + int num_originallightmaps; + int num_mergedlightmaps; + int num_lightmapmergedwidthpower; + int num_lightmapmergedheightpower; + int num_lightmapmergedwidthheightdeluxepower; + int num_lightmapmerge; + rtexture_t **data_lightmaps; + rtexture_t **data_deluxemaps; + + // voxel light data with directional shading + int num_lightgrid; + jkdlightgrid_t *data_lightgrid; + // size of each cell (may vary by map, typically 64 64 128) + float num_lightgrid_cellsize[3]; + // 1.0 / num_lightgrid_cellsize + float num_lightgrid_scale[3]; + // dimensions of the world model in lightgrid cells + int num_lightgrid_imins[3]; + int num_lightgrid_imaxs[3]; + int num_lightgrid_isize[3]; + // transform modelspace coordinates to lightgrid index + matrix4x4_t num_lightgrid_indexfromworld; + + // true if this q3bsp file has been detected as using deluxemapping + // (lightmap texture pairs, every odd one is never directly refernced, + // and contains lighting normals, not colors) + qboolean deluxemapping; + // true if the detected deluxemaps are the modelspace kind, rather than + // the faster tangentspace kind + qboolean deluxemapping_modelspace; + // size of lightmaps (128 by default, but may be another poweroftwo if + // external lightmaps are used (q3map2 -lightmapsize) + int lightmapsize; +} +model_brushjk_t; + struct frameblend_s; struct skeleton_s; @@ -968,10 +1051,10 @@ typedef struct model_s // for skeletal models int num_bones; aliasbone_t *data_bones; - float num_posescale; // scaling factor from origin in poses6s format (includes divide by 32767) - float num_poseinvscale; // scaling factor to origin in poses6s format (includes multiply by 32767) + float num_posescale; // scaling factor from origin in poses7s format (includes divide by 32767) + float num_poseinvscale; // scaling factor to origin in poses7s format (includes multiply by 32767) int num_poses; - short *data_poses6s; // origin xyz, quat xyz, w implied negative, unit length, values normalized to +/-32767 range + short *data_poses7s; // origin xyz, quat xyzw, unit length, values normalized to +/-32767 range float *data_baseboneposeinverse; // textures of this model int num_textures; @@ -1033,11 +1116,13 @@ typedef struct model_s model_brushq2_t brushq2; */ model_brushq3_t brushq3; + model_brushjk_t brushjk; // flags this model for offseting sounds to the model center (used by brush models) int soundfromcenter; // if set, the model contains light information (lightmap, or vertexlight) qboolean lit; + float lightmapscale; } dp_model_t; @@ -1201,6 +1286,7 @@ void Mod_PSKMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend); void Mod_IDSP_Load(dp_model_t *mod, void *buffer, void *bufferend); void Mod_IDS2_Load(dp_model_t *mod, void *buffer, void *bufferend); void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend); +void Mod_RBSP_Load(dp_model_t *mod, void *buffer, void *bufferend); #endif // MODEL_SHARED_H