mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-20 04:30:12 +02:00
Quake 4 integrated with DoomRTX
This commit is contained in:
+166
-13
@@ -41,6 +41,13 @@ class idImage;
|
||||
class idCinematic;
|
||||
class idUserInterface;
|
||||
class idMegaTexture;
|
||||
#ifdef QUAKE4
|
||||
class rvNewShaderStage;
|
||||
class rvGLSLShaderStage;
|
||||
class rvDeclMatType;
|
||||
class idVec2;
|
||||
class idVec3;
|
||||
#endif
|
||||
|
||||
#ifdef PREY
|
||||
// HUMANHEAD tmj: type of subview that this surface represents
|
||||
@@ -67,13 +74,20 @@ typedef enum {
|
||||
// set AFTER image format selection
|
||||
TR_CLAMP_TO_ZERO_ALPHA // guarantee 0 alpha edge for projected textures,
|
||||
// set AFTER image format selection
|
||||
#ifdef QUAKE4
|
||||
, TR_MIRRORED_REPEAT // RAVEN: mirrored texture repeat mode
|
||||
#endif
|
||||
} textureRepeat_t;
|
||||
|
||||
typedef struct {
|
||||
int stayTime; // msec for no change
|
||||
#ifdef QUAKE4
|
||||
float maxAngle; // maximum dot product to reject projection angles
|
||||
#else
|
||||
int fadeTime; // msec to fade vertex colors over
|
||||
float start[4]; // vertex color at spawn (possibly out of 0.0 - 1.0 range, will clamp after calc)
|
||||
float end[4]; // vertex color at fade-out (possibly out of 0.0 - 1.0 range, will clamp after calc)
|
||||
#endif
|
||||
} decalInfo_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -84,8 +98,12 @@ typedef enum {
|
||||
DFRM_EXPAND,
|
||||
DFRM_MOVE,
|
||||
DFRM_EYEBALL,
|
||||
#ifdef QUAKE4
|
||||
DFRM_RECTSPRITE, // RAVEN: rectangular sprites
|
||||
#else
|
||||
DFRM_PARTICLE,
|
||||
DFRM_PARTICLE2,
|
||||
#endif
|
||||
DFRM_TURB
|
||||
} deform_t;
|
||||
|
||||
@@ -94,7 +112,12 @@ typedef enum {
|
||||
DI_SCRATCH, // video, screen wipe, etc
|
||||
DI_CUBE_RENDER,
|
||||
DI_MIRROR_RENDER,
|
||||
#ifdef QUAKE4
|
||||
DI_REFLECTION_RENDER, // RAVEN: water reflection
|
||||
DI_REFRACTION_RENDER, // RAVEN: water refraction
|
||||
#else
|
||||
DI_XRAY_RENDER,
|
||||
#endif
|
||||
#ifdef PREY
|
||||
DI_PORTAL_RENDER, // HUMANHEAD
|
||||
DI_SKYBOX_RENDER, // HUMANHEAD tmj
|
||||
@@ -122,6 +145,11 @@ typedef enum {
|
||||
#ifdef PREY
|
||||
, OP_TYPE_FRAGMENTPROGRAMS // HUMANHEAD CJR: fragment program support toggle
|
||||
#endif
|
||||
#ifdef QUAKE4
|
||||
, OP_TYPE_GLSL_ENABLED,
|
||||
OP_TYPE_POT_X,
|
||||
OP_TYPE_POT_Y
|
||||
#endif
|
||||
} expOpType_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -149,6 +177,9 @@ typedef enum {
|
||||
EXP_REG_GLOBAL6,
|
||||
EXP_REG_GLOBAL7,
|
||||
|
||||
#ifdef QUAKE4
|
||||
EXP_REG_VERTEX_RANDOMIZER, // RAVEN: per-vertex randomizer
|
||||
#endif
|
||||
#ifdef PREY
|
||||
EXP_REG_DISTANCE, // HUMANHEAD: CJR
|
||||
#endif
|
||||
@@ -156,6 +187,14 @@ typedef enum {
|
||||
EXP_REG_NUM_PREDEFINED
|
||||
} expRegister_t;
|
||||
|
||||
#ifdef QUAKE4
|
||||
// RAVEN: decal expression aliases
|
||||
#define EXP_REG_DECAL_LIFE EXP_REG_PARM4
|
||||
#define REG_DECAL_LIFE 4
|
||||
#define EXP_REG_DECAL_SPAWN EXP_REG_PARM5
|
||||
#define REG_DECAL_SPAWN 5
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
expOpType_t opType;
|
||||
int a, b, c;
|
||||
@@ -174,6 +213,9 @@ typedef enum {
|
||||
TG_SCREEN, // screen aligned, for mirrorRenders and screen space temporaries
|
||||
TG_SCREEN2,
|
||||
TG_GLASSWARP
|
||||
#ifdef QUAKE4
|
||||
, TG_POT_CORRECTION // RAVEN: non-power-of-two correction texgen
|
||||
#endif
|
||||
} texgen_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -210,7 +252,10 @@ typedef enum {
|
||||
} stageVertexColor_t;
|
||||
|
||||
static const int MAX_FRAGMENT_IMAGES = 8;
|
||||
#ifdef PREY
|
||||
#ifdef QUAKE4
|
||||
static const int MAX_VERTEX_PARMS = 16;
|
||||
static const int MAX_FRAGMENT_PARMS = 8;
|
||||
#elif defined( PREY )
|
||||
static const int MAX_VERTEX_PARMS = 8;
|
||||
static const int MAX_FRAGMENT_PARMS = 8;
|
||||
#else
|
||||
@@ -219,9 +264,14 @@ static const int MAX_VERTEX_PARMS = 4;
|
||||
|
||||
typedef struct {
|
||||
int vertexProgram;
|
||||
#ifdef QUAKE4
|
||||
#if defined( _MD5R_SUPPORT ) || defined( Q4SDK_MD5R )
|
||||
int md5rVertexProgram; // RAVEN: MD5R-specific vertex program
|
||||
#endif
|
||||
#endif
|
||||
int numVertexParms;
|
||||
int vertexParms[MAX_VERTEX_PARMS][4]; // evaluated register indexes
|
||||
#ifdef PREY
|
||||
#if defined( PREY ) || defined( QUAKE4 )
|
||||
int numFragmentParms;
|
||||
int fragmentParms[MAX_FRAGMENT_PARMS][4]; // evaluated register indexes
|
||||
#endif
|
||||
@@ -229,6 +279,11 @@ typedef struct {
|
||||
int fragmentProgram;
|
||||
int numFragmentProgramImages;
|
||||
idImage* fragmentProgramImages[MAX_FRAGMENT_IMAGES];
|
||||
#ifdef QUAKE4
|
||||
bool vertexParmsBindings[MAX_VERTEX_PARMS];
|
||||
bool fragmentParmsBindings[MAX_FRAGMENT_PARMS];
|
||||
int fragmentProgramBindings[MAX_FRAGMENT_IMAGES];
|
||||
#endif
|
||||
|
||||
idMegaTexture* megaTexture; // handles all the binding and parameter setting
|
||||
} newShaderStage_t;
|
||||
@@ -247,6 +302,10 @@ typedef struct {
|
||||
int drawStateBits;
|
||||
colorStage_t color;
|
||||
bool hasAlphaTest;
|
||||
#ifdef QUAKE4
|
||||
bool hasAlphaFunc;
|
||||
int alphaTestMode;
|
||||
#endif
|
||||
int alphaTestRegister;
|
||||
textureStage_t texture;
|
||||
stageVertexColor_t vertexColor;
|
||||
@@ -264,6 +323,13 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
newShaderStage_t* newStage; // vertex / fragment program based stage
|
||||
#ifdef QUAKE4
|
||||
rvNewShaderStage* newShaderStage; // RAVEN: GLSL/new shader stage system
|
||||
int mStageRegisterStart;
|
||||
int mNumStageRegisters;
|
||||
int mStageOpsStart;
|
||||
int mNumStageOps;
|
||||
#endif
|
||||
#ifdef PREY
|
||||
specData_t specular; // HUMANHEAD bjk
|
||||
#endif
|
||||
@@ -277,7 +343,13 @@ typedef enum {
|
||||
} materialCoverage_t;
|
||||
|
||||
typedef enum {
|
||||
#ifdef QUAKE4
|
||||
SS_MIN = -10000,
|
||||
SS_SUBVIEW = -4, // mirrors, viewscreens, etc
|
||||
SS_PREGUI = -3, // RAVEN: pre-gui sort
|
||||
#else
|
||||
SS_SUBVIEW = -3, // mirrors, viewscreens, etc
|
||||
#endif
|
||||
SS_GUI = -2, // guis
|
||||
SS_BAD = -1,
|
||||
SS_OPAQUE, // opaque
|
||||
@@ -295,6 +367,9 @@ typedef enum {
|
||||
SS_NEAREST, // screen blood blobs
|
||||
|
||||
SS_POST_PROCESS = 100 // after a screen copy to texture
|
||||
#ifdef QUAKE4
|
||||
, SS_MAX = 10000
|
||||
#endif
|
||||
} materialSort_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -323,7 +398,10 @@ typedef enum {
|
||||
MF_NOSELFSHADOW = BIT(4),
|
||||
MF_NOPORTALFOG = BIT(5), // this fog volume won't ever consider a portal fogged out
|
||||
MF_EDITOR_VISIBLE = BIT(6), // in use (visible) per editor
|
||||
#ifdef PREY
|
||||
#ifdef QUAKE4
|
||||
MF_SKY = BIT(7), // RAVEN: portal/sky material marker
|
||||
MF_NEED_CURRENT_RENDER = BIT(8), // RAVEN: preserve GUI sort while requesting current render
|
||||
#elif defined( PREY )
|
||||
MF_USESDISTANCE = BIT(7), // HUMANHEAD pdm: distance optimization
|
||||
MF_LIGHT_WHOLE_MESH = BIT(8), // HUMANHEAD bjk: don't cull tris with light bounds
|
||||
#endif
|
||||
@@ -349,7 +427,20 @@ typedef enum {
|
||||
CONTENTS_AAS_OBSTACLE = BIT(14), // used to compile an obstacle into AAS that can be enabled/disabled
|
||||
CONTENTS_FLASHLIGHT_TRIGGER = BIT(15), // used for triggers that are activated by the flashlight
|
||||
|
||||
#ifdef PREY
|
||||
#ifdef QUAKE4
|
||||
// RAVEN: additional Quake 4 content flags
|
||||
CONTENTS_SIGHTCLIP = BIT(16), // blocks actor/camera sight
|
||||
CONTENTS_LARGESHOTCLIP = BIT(17), // blocks large projectiles
|
||||
CONTENTS_NOTACTICALFEATURES = BIT(18), // don't place tactical features here
|
||||
CONTENTS_VEHICLECLIP = BIT(19), // solid to vehicles
|
||||
|
||||
// contents used by utils
|
||||
CONTENTS_AREAPORTAL = BIT(20), // portal separating renderer areas
|
||||
CONTENTS_NOCSG = BIT(21), // don't cut this brush with CSG operations in the editor
|
||||
CONTENTS_FLYCLIP = BIT(22), // solid to flying/vehicle movement
|
||||
CONTENTS_ITEMCLIP = BIT(23), // item collision
|
||||
CONTENTS_PROJECTILECLIP = BIT(24), // projectile-only clip
|
||||
#elif defined( PREY )
|
||||
// HUMANHEAD CJR: Content flags. Note that for simplicity of merging, id's areaportal and nocsg flags were left as is
|
||||
CONTENTS_FORCEFIELD = BIT(16), // forcefield matter, only passable in spirit mode
|
||||
CONTENTS_SPIRITBRIDGE = BIT(17), // cjr - Collidable only by spiritwalking players
|
||||
@@ -374,7 +465,6 @@ typedef enum {
|
||||
CONTENTS_AREAPORTAL = BIT(20), // portal separating renderer areas
|
||||
CONTENTS_NOCSG = BIT(21), // don't cut this brush with CSG operations in the editor
|
||||
#endif
|
||||
|
||||
CONTENTS_REMOVE_UTIL = ~(CONTENTS_AREAPORTAL | CONTENTS_NOCSG)
|
||||
} contentsFlags_t;
|
||||
|
||||
@@ -440,11 +530,19 @@ typedef enum {
|
||||
SURF_NOFRAGMENT = BIT(11), // dmap won't cut surface at each bsp boundary
|
||||
SURF_NULLNORMAL = BIT(12) // renderbump will draw this surface as 0x80 0x80 0x80, which
|
||||
// won't collect light from any angle
|
||||
#ifdef QUAKE4
|
||||
, SURF_BOUNCE = BIT(13), // RAVEN: projectiles should bounce
|
||||
SURF_NO_T_FIX = BIT(14) // RAVEN: skip T-junction fixing
|
||||
#endif
|
||||
} surfaceFlags_t;
|
||||
|
||||
class idSoundEmitter;
|
||||
|
||||
class idMaterial : public idDecl {
|
||||
#ifdef QUAKE4
|
||||
friend class rvNewShaderStage;
|
||||
friend class rvGLSLShaderStage;
|
||||
#endif
|
||||
public:
|
||||
idMaterial();
|
||||
virtual ~idMaterial();
|
||||
@@ -452,7 +550,11 @@ public:
|
||||
virtual size_t Size(void) const;
|
||||
virtual bool SetDefaultText(void);
|
||||
virtual const char* DefaultDefinition(void) const;
|
||||
#ifdef QUAKE4
|
||||
virtual bool Parse(const char* text, const int textLength, bool noCaching = false);
|
||||
#else
|
||||
virtual bool Parse(const char* text, const int textLength);
|
||||
#endif
|
||||
virtual void FreeData(void);
|
||||
virtual void Print(void) const;
|
||||
|
||||
@@ -504,9 +606,9 @@ public:
|
||||
// returns true if the material will generate interactions with fog/blend lights
|
||||
// All non-translucent surfaces receive fog unless they are explicitly noFog
|
||||
bool ReceivesFog(void) const { return (IsDrawn() && !noFog && coverage != MC_TRANSLUCENT); }
|
||||
// jmarshall
|
||||
// Returns the diffuse/albedo image used by this material stage.
|
||||
idImage* GetDiffuseImage(const float *regs) const;
|
||||
// jmarshall
|
||||
// Returns the diffuse/albedo image used by this material stage.
|
||||
idImage* GetDiffuseImage(const float* regs) const;
|
||||
|
||||
// Returns the bump/normal map image used by this material stage.
|
||||
idImage* GetBumpImage(void) const;
|
||||
@@ -522,10 +624,10 @@ public:
|
||||
|
||||
// Returns true if this material is rendered as a sky surface.
|
||||
bool IsSky(void) const;
|
||||
// jmarshall end
|
||||
// returns true if the material will generate interactions with normal lights
|
||||
// Many special effect surfaces don't have any bump/diffuse/specular
|
||||
// stages, and don't interact with lights at all
|
||||
// jmarshall end
|
||||
// returns true if the material will generate interactions with normal lights
|
||||
// Many special effect surfaces don't have any bump/diffuse/specular
|
||||
// stages, and don't interact with lights at all
|
||||
bool ReceivesLighting(void) const { return numAmbientStages != numStages; }
|
||||
|
||||
// returns true if the material should generate interactions on sides facing away
|
||||
@@ -582,6 +684,22 @@ public:
|
||||
// should manually make the edges of your sky box exactly meet, instead of poking
|
||||
// into each other.
|
||||
bool NoFragment(void) const { return (surfaceFlags & SURF_NOFRAGMENT) != 0; }
|
||||
#ifdef QUAKE4
|
||||
bool NoTFix(void) const { return (surfaceFlags & SURF_NO_T_FIX) != 0; }
|
||||
|
||||
const rvDeclMatType* GetMaterialType(void) const { return materialType; }
|
||||
const rvDeclMatType* GetMaterialType(idVec2& tc) const;
|
||||
byte* GetMaterialTypeArray(void) const { return materialTypeArray; }
|
||||
const char* GetMaterialTypeArrayName(void) const { return materialTypeArrayName.c_str(); }
|
||||
int GetTexelCount(void) const;
|
||||
bool HasDefaultedImage(void) const;
|
||||
idImage* GetDiffuseImage(void) const;
|
||||
float GetPortalNear(void) const { return portalDistanceNear; }
|
||||
float GetPortalFar(void) const { return portalDistanceFar; }
|
||||
const idImage* GetPortalImage(void) const { return portalImage; }
|
||||
virtual bool RebuildTextSource(void) { return false; }
|
||||
virtual bool Validate(const char* psText, int iTextLength, idStr& strReportTo) const;
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// light shader specific functions, only called for light entities
|
||||
@@ -709,9 +827,18 @@ public:
|
||||
const int GetNumRegisters() const { return numRegisters; }
|
||||
|
||||
// regs should point to a float array large enough to hold GetNumRegisters() floats
|
||||
#ifdef QUAKE4
|
||||
void EvaluateStageRegisters(int stageIndex, float* registers, const float shaderParms[MAX_ENTITY_SHADER_PARMS], float floatTime) const;
|
||||
void ClearUseCount(void) { useCount = 0; }
|
||||
void IncreaseUseCount(void) { useCount++; globalUseCount++; }
|
||||
int GetUseCount(void) { return useCount; }
|
||||
int GetGlobalUseCount(void) const { return globalUseCount; }
|
||||
void ResolveUse(void);
|
||||
#endif
|
||||
void EvaluateRegisters(float* regs, const float entityParms[MAX_ENTITY_SHADER_PARMS],
|
||||
const struct viewDef_s* view, idSoundEmitter* soundEmitter = NULL) const;
|
||||
|
||||
|
||||
// if a material only uses constants (no entityParm or globalparm references), this
|
||||
// will return a pointer to an internal table, and EvaluateRegisters will not need
|
||||
// to be called. If NULL is returned, EvaluateRegisters must be used.
|
||||
@@ -733,7 +860,7 @@ private:
|
||||
void ParseSort(idLexer& src);
|
||||
void ParseBlend(idLexer& src, shaderStage_t* stage);
|
||||
void ParseVertexParm(idLexer& src, newShaderStage_t* newStage);
|
||||
#ifdef PREY
|
||||
#if defined( PREY ) || defined( QUAKE4 )
|
||||
void ParseFragmentParm(idLexer& src, newShaderStage_t* newStage);
|
||||
#endif
|
||||
void ParseFragmentMap(idLexer& src, newShaderStage_t* newStage);
|
||||
@@ -770,6 +897,19 @@ private:
|
||||
// non zero will draw gui, gui2, or gui3 from renderEnitty_t
|
||||
mutable idUserInterface* gui; // non-custom guis are shared by all users of a material
|
||||
|
||||
#ifdef QUAKE4
|
||||
const rvDeclMatType* materialType;
|
||||
byte* materialTypeArray; // material type indices generated from materialImage
|
||||
idStr materialTypeArrayName;
|
||||
int MTAWidth;
|
||||
int MTAHeight;
|
||||
int useCount;
|
||||
int globalUseCount;
|
||||
float portalDistanceNear;
|
||||
float portalDistanceFar;
|
||||
idImage* portalImage;
|
||||
#endif
|
||||
|
||||
bool noFog; // surface does not create fog interactions
|
||||
|
||||
int spectrum; // for invisible writing, used for both lights and surfaces
|
||||
@@ -835,4 +975,17 @@ private:
|
||||
|
||||
typedef idList<const idMaterial*> idMatList;
|
||||
|
||||
#ifdef QUAKE4
|
||||
// RAVEN: material editor bridge used by Radiant/editor code.
|
||||
class rvMaterialEdit {
|
||||
public:
|
||||
virtual ~rvMaterialEdit() {}
|
||||
virtual void SetGui(idMaterial* edit, const char* name) = 0;
|
||||
virtual int GetImageWidth(const idMaterial* edit) const = 0;
|
||||
virtual int GetImageHeight(const idMaterial* edit) const = 0;
|
||||
};
|
||||
|
||||
extern rvMaterialEdit* materialEdit;
|
||||
#endif
|
||||
|
||||
#endif /* !__MATERIAL_H__ */
|
||||
|
||||
Reference in New Issue
Block a user