From 734e62aad499a84f6c1558289541ddc8bd0924cb Mon Sep 17 00:00:00 2001 From: razor Date: Mon, 19 Feb 2024 18:31:27 +1100 Subject: [PATCH] [Meta] trim EOL whitespace (#1202) (cherry picked from commit 4547d40efd629e9adaa248e3803712d4f091c553) --- codemp/CMakeLists.txt | 4 +- codemp/client/cl_uiapi.cpp | 2 +- codemp/game/CMakeLists.txt | 2 +- codemp/qcommon/cvar.cpp | 14 +- codemp/rd-rend2/G2_API.cpp | 32 ++-- codemp/rd-rend2/G2_bolts.cpp | 12 +- codemp/rd-rend2/G2_bones.cpp | 212 +++++++++++----------- codemp/rd-rend2/G2_misc.cpp | 136 +++++++------- codemp/rd-rend2/G2_surfaces.cpp | 40 ++-- codemp/rd-vanilla/CMakeLists.txt | 2 +- codemp/rd-vanilla/tr_shader.cpp | 2 +- codemp/rd-vanilla/tr_shadows.cpp | 2 +- codemp/ui/ui_shared.c | 2 +- rv-readme.txt | 2 +- scripts/docker/server.cfg | 4 +- shared/qcommon/q_string.c | 2 +- shared/qcommon/safe/files.h | 2 +- shared/rd-rend2/MikkTSpace/mikktspace.c | 42 ++--- shared/rd-rend2/glsl/bokeh.glsl | 4 +- shared/rd-rend2/glsl/calclevels4x.glsl | 4 +- shared/rd-rend2/glsl/depthblur.glsl | 12 +- shared/rd-rend2/glsl/down4x.glsl | 6 +- shared/rd-rend2/glsl/fogpass.glsl | 2 +- shared/rd-rend2/glsl/generic.glsl | 18 +- shared/rd-rend2/glsl/lightall.glsl | 66 +++---- shared/rd-rend2/glsl/prefilterEnvMap.glsl | 10 +- shared/rd-rend2/glsl/refraction.glsl | 28 +-- shared/rd-rend2/glsl/shadowvolume.glsl | 6 +- shared/rd-rend2/glsl/ssao.glsl | 16 +- shared/rd-rend2/glsl/surface_sprites.glsl | 8 +- shared/rd-rend2/glsl/tonemap.glsl | 6 +- shared/rd-rend2/stb_image.h | 26 +-- shared/rd-rend2/tr_animation.cpp | 54 +++--- shared/rd-rend2/tr_backend.cpp | 40 ++-- shared/rd-rend2/tr_cache.cpp | 14 +- shared/rd-rend2/tr_cmds.cpp | 48 ++--- shared/rd-rend2/tr_decals.cpp | 32 ++-- shared/rd-rend2/tr_extensions.cpp | 8 +- shared/rd-rend2/tr_extramath.cpp | 14 +- shared/rd-rend2/tr_fbo.cpp | 6 +- shared/rd-rend2/tr_flares.cpp | 8 +- shared/rd-rend2/tr_ghoul2.cpp | 173 +++++++++--------- shared/rd-rend2/tr_glsl.cpp | 34 ++-- shared/rd-rend2/tr_image.cpp | 150 +++++++-------- shared/rd-rend2/tr_light.cpp | 20 +- shared/rd-rend2/tr_main.cpp | 72 ++++---- shared/rd-rend2/tr_marks.cpp | 8 +- shared/rd-rend2/tr_mesh.cpp | 22 +-- shared/rd-rend2/tr_model.cpp | 172 +++++++++--------- shared/rd-rend2/tr_model_iqm.cpp | 28 +-- shared/rd-rend2/tr_postprocess.cpp | 20 +- shared/rd-rend2/tr_scene.cpp | 12 +- shared/rd-rend2/tr_shade.cpp | 78 ++++---- shared/rd-rend2/tr_shade_calc.cpp | 28 +-- shared/rd-rend2/tr_shader.cpp | 136 +++++++------- shared/rd-rend2/tr_skin.cpp | 18 +- shared/rd-rend2/tr_sky.cpp | 72 ++++---- shared/rd-rend2/tr_surface.cpp | 92 +++++----- shared/rd-rend2/tr_weather.cpp | 26 +-- shared/rd-rend2/tr_world.cpp | 28 +-- ui/menudef.h | 40 ++-- 61 files changed, 1088 insertions(+), 1091 deletions(-) diff --git a/codemp/CMakeLists.txt b/codemp/CMakeLists.txt index 78f618014c..1245f6d596 100644 --- a/codemp/CMakeLists.txt +++ b/codemp/CMakeLists.txt @@ -163,7 +163,7 @@ if(BuildMPEngine OR BuildMPDed) "${MPDir}/qcommon/qcommon.h" "${MPDir}/qcommon/qfiles.h" "${MPDir}/qcommon/tags.h" - + ${SharedCommonFiles} ) source_group("common" FILES ${MPBotlibCommonFiles}) @@ -298,7 +298,7 @@ if(BuildMPEngine OR BuildMPDed) endif(WIN32) source_group("common" FILES ${MPEngineAndDedCommonFiles}) set(MPEngineAndDedFiles ${MPEngineAndDedFiles} ${MPEngineAndDedCommonFiles}) - + set(MPEngineAndDedCommonSafeFiles "${SharedDir}/qcommon/safe/files.cpp" "${SharedDir}/qcommon/safe/files.h" diff --git a/codemp/client/cl_uiapi.cpp b/codemp/client/cl_uiapi.cpp index f5135bbada..29d4c430bd 100644 --- a/codemp/client/cl_uiapi.cpp +++ b/codemp/client/cl_uiapi.cpp @@ -304,7 +304,7 @@ static qboolean CL_G2API_HaveWeGhoul2Models( void *ghoul2) { static qboolean CL_G2API_GetBoltMatrix( void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale ) { if ( !ghoul2 ) { return qfalse; - + } return re->G2API_GetBoltMatrix( *((CGhoul2Info_v *)ghoul2), modelIndex, boltIndex, matrix, angles, position, frameNum, modelList, scale ); } diff --git a/codemp/game/CMakeLists.txt b/codemp/game/CMakeLists.txt index 6f88b045a4..918d8bba9a 100644 --- a/codemp/game/CMakeLists.txt +++ b/codemp/game/CMakeLists.txt @@ -153,7 +153,7 @@ set(MPGameCommonFiles "${MPDir}/qcommon/disablewarnings.h" "${MPDir}/qcommon/q_shared.h" "${MPDir}/qcommon/tags.h" - + ${SharedCommonFiles} ) source_group("common" FILES ${MPGameCommonFiles}) diff --git a/codemp/qcommon/cvar.cpp b/codemp/qcommon/cvar.cpp index f39a0cf597..118794f2c6 100644 --- a/codemp/qcommon/cvar.cpp +++ b/codemp/qcommon/cvar.cpp @@ -518,11 +518,11 @@ cvar_t *Cvar_Get( const char *var_name, const char *var_value, uint32_t flags, c return var; } -static void Cvar_QSortByName( cvar_t **a, int n ) +static void Cvar_QSortByName( cvar_t **a, int n ) { cvar_t *temp; cvar_t *m; - int i, j; + int i, j; i = 0; j = n; @@ -534,10 +534,10 @@ static void Cvar_QSortByName( cvar_t **a, int n ) while ( strcmp( a[j]->name, m->name ) < 0 ) j--; if ( i <= j ) { - temp = a[i]; - a[i] = a[j]; + temp = a[i]; + a[i] = a[j]; a[j] = temp; - i++; + i++; j--; } } while ( i <= j ); @@ -547,7 +547,7 @@ static void Cvar_QSortByName( cvar_t **a, int n ) } -static void Cvar_Sort( void ) +static void Cvar_Sort( void ) { cvar_t *list[ MAX_CVARS ], *var; int count; @@ -566,7 +566,7 @@ static void Cvar_Sort( void ) } Cvar_QSortByName( &list[0], count-1 ); - + cvar_vars = NULL; // relink cvars diff --git a/codemp/rd-rend2/G2_API.cpp b/codemp/rd-rend2/G2_API.cpp index aa152699c8..f93a2ad8fb 100644 --- a/codemp/rd-rend2/G2_API.cpp +++ b/codemp/rd-rend2/G2_API.cpp @@ -289,7 +289,7 @@ qboolean G2API_OverrideServerWithClientData(CGhoul2Info_v& ghoul2, int modelInde static size_t GetSizeOfGhoul2Info ( const CGhoul2Info& g2Info ) { size_t size = 0; - + // This is pretty ugly, but we don't want to save everything in the CGhoul2Info object. size += offsetof (CGhoul2Info, mTransformedVertsArray) - offsetof (CGhoul2Info, mModelindex); @@ -312,7 +312,7 @@ static size_t SerializeGhoul2Info ( char *buffer, const CGhoul2Info& g2Info ) { char *base = buffer; size_t blockSize; - + // Oh the ugliness... blockSize = offsetof (CGhoul2Info, mTransformedVertsArray) - offsetof (CGhoul2Info, mModelindex); memcpy (buffer, &g2Info.mModelindex, blockSize); @@ -329,7 +329,7 @@ static size_t SerializeGhoul2Info ( char *buffer, const CGhoul2Info& g2Info ) // Bones vector + size *(int *)buffer = g2Info.mBlist.size(); buffer += sizeof (int); - + blockSize = g2Info.mBlist.size() * sizeof (boneInfo_t); memcpy (buffer, g2Info.mBlist.data(), g2Info.mBlist.size() * sizeof (boneInfo_t)); buffer += blockSize; @@ -337,7 +337,7 @@ static size_t SerializeGhoul2Info ( char *buffer, const CGhoul2Info& g2Info ) // Bolts vector + size *(int *)buffer = g2Info.mBltlist.size(); buffer += sizeof (int); - + blockSize = g2Info.mBltlist.size() * sizeof (boltInfo_t); memcpy (buffer, g2Info.mBltlist.data(), g2Info.mBltlist.size() * sizeof (boltInfo_t)); buffer += blockSize; @@ -420,7 +420,7 @@ class Ghoul2InfoArray : public IGhoul2InfoArray size_t GetSerializedSize() const { - size_t size = 0; + size_t size = 0; size += sizeof (int); // size of mFreeIndecies linked list size += mFreeIndecies.size() * sizeof (int); @@ -495,7 +495,7 @@ class Ghoul2InfoArray : public IGhoul2InfoArray buffer += sizeof (int); mInfos[i].resize (count); - + for ( size_t j = 0; j < count; j++ ) { buffer += DeserializeGhoul2Info (buffer, mInfos[i][j]); @@ -548,7 +548,7 @@ class Ghoul2InfoArray : public IGhoul2InfoArray Com_Error(ERR_FATAL, "Out of ghoul2 info slots"); } - // gonna pull from the front, doing a + // gonna pull from the front, doing a int idx=*mFreeIndecies.begin(); mFreeIndecies.erase(mFreeIndecies.begin()); return mIds[idx]; @@ -585,7 +585,7 @@ class Ghoul2InfoArray : public IGhoul2InfoArray assert((handle&G2_INDEX_MASK)>=0&&(handle&G2_INDEX_MASK)=MAX_G2_MODELS||mIds[handle&G2_INDEX_MASK]!=handle)); - + return mInfos[handle&G2_INDEX_MASK]; } const std::vector &Get(int handle) const @@ -747,7 +747,7 @@ void G2API_CleanGhoul2Models(CGhoul2Info_v **ghoul2Ptr) delete *ghoul2Ptr; *ghoul2Ptr = NULL; - } + } } qboolean G2_ShouldRegisterServer(void) @@ -822,7 +822,7 @@ int G2API_InitGhoul2Model(CGhoul2Info_v **ghoul2Ptr, const char *fileName, int m if (model==ghoul2.size()) { //init should not be used to create additional models, only the first one assert(ghoul2.size() < 4); //use G2API_CopySpecificG2Model to add models - ghoul2.push_back(CGhoul2Info()); + ghoul2.push_back(CGhoul2Info()); } strcpy(ghoul2[model].mFileName, fileName); @@ -1291,7 +1291,7 @@ qboolean G2API_SetBoneAnim(CGhoul2Info_v &ghoul2, const int modelIndex, const ch CGhoul2Info *ghlInfo = &ghoul2[modelIndex]; qboolean setPtrs = qfalse; qboolean res = qfalse; - + //rww - RAGDOLL_BEGIN if (ghlInfo) { @@ -2274,7 +2274,7 @@ void G2API_SetGhoul2ModelIndexes( // broken into 3 lines for debugging, STL is a pain to view... // int iModelIndex = ghoul2[i].mModelindex; - qhandle_t mModel = modelList[iModelIndex]; + qhandle_t mModel = modelList[iModelIndex]; ghoul2[i].mModel = mModel; ghoul2[i].mSkin = skinList[ghoul2[i].mCustomSkin]; @@ -2600,7 +2600,7 @@ int G2API_CopyGhoul2Instance(CGhoul2Info_v &g2From, CGhoul2Info_v &g2To, int mod { assert(modelIndex==-1); // copy individual bolted parts is not used in jk2 and I didn't want to deal with it // if ya want it, we will add it back correctly - + //G2ERROR(ghoul2From.IsValid(),"Invalid ghlInfo"); if (g2From.IsValid()) { @@ -2709,7 +2709,7 @@ void G2API_DuplicateGhoul2Instance(CGhoul2Info_v &g2From, CGhoul2Info_v **g2To) CGhoul2Info_v &ghoul2 = *(*g2To); /*ignore = */G2API_CopyGhoul2Instance(g2From, ghoul2, -1); - + return; } @@ -2874,7 +2874,7 @@ qboolean G2API_SkinlessModel(CGhoul2Info_v& ghoul2, int modelIndex) surf = (mdxmSurfHierarchy_t *) ( (byte *)mdxm + mdxm->ofsSurfHierarchy ); - for (i = 0; i < mdxm->numSurfaces; i++) + for (i = 0; i < mdxm->numSurfaces; i++) { if (surf->shader[0]) { //found a surface with a shader name, ok. @@ -3070,7 +3070,7 @@ qboolean G2_SetupModelPointers(CGhoul2Info *ghlInfo) // returns true if the mode // RJ - experimental optimization! if (!ghlInfo->mModel || 1) - { + { if (ri.Cvar_VariableIntegerValue( "dedicated" ) || (G2_ShouldRegisterServer())) //supreme hackery! { diff --git a/codemp/rd-rend2/G2_bolts.cpp b/codemp/rd-rend2/G2_bolts.cpp index cddbc5a067..c0eceb3119 100644 --- a/codemp/rd-rend2/G2_bolts.cpp +++ b/codemp/rd-rend2/G2_bolts.cpp @@ -48,7 +48,7 @@ int G2_Find_Bolt_Surface_Num(boltInfo_v &bltlist, const int surfaceNum, const in // didn't find it return -1; } - + //========================================================================================= //// Public Bolt Routines int G2_Add_Bolt_Surf_Num(CGhoul2Info *ghlInfo, boltInfo_v &bltlist, surfaceInfo_v &slist, const int surfNum) @@ -74,7 +74,7 @@ int G2_Add_Bolt_Surf_Num(CGhoul2Info *ghlInfo, boltInfo_v &bltlist, surfaceInfo_ } } - // we have a surface + // we have a surface // look through entire list - see if it's already there first for(size_t i=0; i #else #include -#endif +#endif #include "ghoul2/G2_gore.h" //#define RAG_TRACE_DEBUG_LINES @@ -20,7 +20,7 @@ //===================================================================================================================== // Bone List handling routines - so entities can override bone info on a bone by bone level, and also interrogate this info -// Given a bone name, see if that bone is already in our bone list - note the model_t pointer that gets passed in here MUST point at the +// Given a bone name, see if that bone is already in our bone list - note the model_t pointer that gets passed in here MUST point at the // gla file, not the glm file type. int G2_Find_Bone(const model_t *mod, boneInfo_v &blist, const char *boneName) { @@ -65,7 +65,7 @@ int G2_Add_Bone (const model_t *mod, boneInfo_v &blist, const char *boneName) //rww - RAGDOLL_BEGIN memset(&tempBone, 0, sizeof(tempBone)); //rww - RAGDOLL_END - + offsets = (mdxaSkelOffsets_t *)((byte *)mdxa + sizeof(mdxaHeader_t)); // walk the entire list of bones in the gla file for this model and see if any match the name of the bone we want to find @@ -168,7 +168,7 @@ qboolean G2_Remove_Bone_Index ( boneInfo_v &blist, int index) // yes, so lets do it blist.resize(newSize); } - + return qtrue; } } @@ -308,7 +308,7 @@ void G2_Generate_Matrix(const model_t *mod, boneInfo_v &blist, int index, const Mat3x4_Multiply(&temp1, boneOverride,&skel->BasePoseMatInv); Mat3x4_Multiply(boneOverride,&skel->BasePoseMat, &temp1); - + } else { @@ -421,7 +421,7 @@ qboolean G2_Remove_Bone (CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *bo assert(ghlInfo->animModel); index = G2_Find_Bone(ghlInfo->animModel, blist, boneName); - + return G2_Remove_Bone_Index(blist, index); } @@ -457,7 +457,7 @@ qboolean G2_Set_Bone_Angles_Index( return qtrue; } } - + if (flags & (BONE_ANGLES_PREMULT | BONE_ANGLES_POSTMULT)) { // you CANNOT call this with an index with these kinds of bone @@ -501,7 +501,7 @@ qboolean G2_Set_Bone_Angles(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char mod_a = (model_t *)ghlInfo->animModel; int index = G2_Find_Bone(mod_a, blist, boneName); - + // did we find it? if (index != -1) { @@ -592,9 +592,9 @@ qboolean G2_Set_Bone_Angles_Matrix(const char *fileName, boneInfo_v &blist, cons { mod_m = R_GetModelByHandle(RE_RegisterModel(fileName)); } - model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); + model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); int index = G2_Find_Bone(mod_a, blist, boneName); - + if (index != -1) { if (blist[index].flags & BONE_ANGLES_RAGDOLL) @@ -639,19 +639,19 @@ qboolean G2_Set_Bone_Angles_Matrix(const char *fileName, boneInfo_v &blist, cons // given a model, bone name, a bonelist, a start/end frame number, a anim speed and some anim flags, set up or modify an existing bone entry for a new set of anims qboolean G2_Set_Bone_Anim_Index( - boneInfo_v &blist, - const int index, - const int startFrame, - const int endFrame, - const int flags, - const float animSpeed, - const int currentTime, - const float setFrame, + boneInfo_v &blist, + const int index, + const int startFrame, + const int endFrame, + const int flags, + const float animSpeed, + const int currentTime, + const float setFrame, const int blendTime, const int numFrames) { int modFlags = flags; - + if ((index >= (int)blist.size()) || (blist[index].boneNumber == -1)) { // we are attempting to set a bone override that doesn't exist @@ -676,7 +676,7 @@ qboolean G2_Set_Bone_Anim_Index( } if (flags & BONE_ANIM_BLEND) { - float currentFrame, animSpeed; + float currentFrame, animSpeed; int startFrame, endFrame, flags; // figure out where we are now if (G2_Get_Bone_Anim_Index(blist, index, currentTime, ¤tFrame, &startFrame, &endFrame, &flags, &animSpeed, NULL, numFrames)) @@ -697,11 +697,11 @@ qboolean G2_Set_Bone_Anim_Index( { blist[index].blendFrame = currentFrame; blist[index].blendLerpFrame = currentFrame+1; - + // cope with if the lerp frame is actually off the end of the anim if (blist[index].blendFrame >= endFrame ) { - // we only want to lerp with the first frame of the anim if we are looping + // we only want to lerp with the first frame of the anim if we are looping if (blist[index].flags & BONE_ANIM_OVERRIDE_LOOP) { blist[index].blendFrame = startFrame; @@ -720,11 +720,11 @@ qboolean G2_Set_Bone_Anim_Index( } } } - + // cope with if the lerp frame is actually off the end of the anim if (blist[index].blendLerpFrame >= endFrame ) { - // we only want to lerp with the first frame of the anim if we are looping + // we only want to lerp with the first frame of the anim if we are looping if (blist[index].flags & BONE_ANIM_OVERRIDE_LOOP) { blist[index].blendLerpFrame = startFrame; @@ -828,18 +828,18 @@ qboolean G2_Set_Bone_Anim_Index( } // given a model, bone name, a bonelist, a start/end frame number, a anim speed and some anim flags, set up or modify an existing bone entry for a new set of anims -qboolean G2_Set_Bone_Anim(CGhoul2Info *ghlInfo, - boneInfo_v &blist, - const char *boneName, - const int startFrame, - const int endFrame, - const int flags, - const float animSpeed, - const int currentTime, - const float setFrame, +qboolean G2_Set_Bone_Anim(CGhoul2Info *ghlInfo, + boneInfo_v &blist, + const char *boneName, + const int startFrame, + const int endFrame, + const int flags, + const float animSpeed, + const int currentTime, + const float setFrame, const int blendTime) { - model_t *mod_a = (model_t *)ghlInfo->animModel; + model_t *mod_a = (model_t *)ghlInfo->animModel; int index = G2_Find_Bone(mod_a, blist, boneName); if (index == -1) @@ -866,10 +866,10 @@ qboolean G2_Get_Bone_Anim_Range(CGhoul2Info *ghlInfo, boneInfo_v &blist, const c { model_t *mod_a = (model_t *)ghlInfo->animModel; int index = G2_Find_Bone(mod_a, blist, boneName); - + // did we find it? if (index != -1) - { + { // are we an animating bone? if (blist[index].flags & (BONE_ANIM_OVERRIDE_LOOP | BONE_ANIM_OVERRIDE)) { @@ -885,13 +885,13 @@ qboolean G2_Get_Bone_Anim_Range(CGhoul2Info *ghlInfo, boneInfo_v &blist, const c // NOTE if we aren't running an animation, then qfalse is returned void G2_TimingModel(boneInfo_t &bone,int currentTime,int numFramesInFile,int ¤tFrame,int &newFrame,float &lerp); -qboolean G2_Get_Bone_Anim_Index( boneInfo_v &blist, const int index, const int currentTime, +qboolean G2_Get_Bone_Anim_Index( boneInfo_v &blist, const int index, const int currentTime, float *currentFrame, int *startFrame, int *endFrame, int *flags, float *retAnimSpeed, qhandle_t *modelList, int numFrames) { - + // did we find it? if ((index>=0) && !((index >= (int)blist.size()) || (blist[index].boneNumber == -1))) - { + { // are we an animating bone? if (blist[index].flags & (BONE_ANIM_OVERRIDE_LOOP | BONE_ANIM_OVERRIDE)) @@ -918,13 +918,13 @@ qboolean G2_Get_Bone_Anim_Index( boneInfo_v &blist, const int index, const int c // given a model, bonelist and bonename, return the current frame, startframe and endframe of the current animation // NOTE if we aren't running an animation, then qfalse is returned -qboolean G2_Get_Bone_Anim(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName, const int currentTime, +qboolean G2_Get_Bone_Anim(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName, const int currentTime, float *currentFrame, int *startFrame, int *endFrame, int *flags, float *retAnimSpeed, qhandle_t *modelList, int modelIndex) { model_t *mod_a = (model_t *)ghlInfo->animModel; int index = G2_Find_Bone(mod_a, blist, boneName); - + if (index==-1) { index = G2_Add_Bone(mod_a, blist, boneName); @@ -934,7 +934,7 @@ qboolean G2_Get_Bone_Anim(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *b return qfalse; } } - + assert(ghlInfo->aHeader); if (G2_Get_Bone_Anim_Index(blist, index, currentTime, currentFrame, startFrame, endFrame, flags, retAnimSpeed, modelList, ghlInfo->aHeader->numFrames)) @@ -951,10 +951,10 @@ qboolean G2_Get_Bone_Anim(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *b // given a model, bonelist and bonename, lets pause an anim if it's playing. qboolean G2_Pause_Bone_Anim(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName, const int currentTime) { - model_t *mod_a = (model_t *)ghlInfo->animModel; + model_t *mod_a = (model_t *)ghlInfo->animModel; int index = G2_Find_Bone(mod_a, blist, boneName); - + // did we find it? if (index != -1) { @@ -976,7 +976,7 @@ qboolean G2_Pause_Bone_Anim(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char { blist[index].pauseTime = currentTime; } - + return qtrue; } assert(0); @@ -986,10 +986,10 @@ qboolean G2_Pause_Bone_Anim(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char qboolean G2_IsPaused(const char *fileName, boneInfo_v &blist, const char *boneName) { - model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName)); - model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); + model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName)); + model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); int index = G2_Find_Bone(mod_a, blist, boneName); - + // did we find it? if (index != -1) { @@ -1008,7 +1008,7 @@ qboolean G2_IsPaused(const char *fileName, boneInfo_v &blist, const char *boneNa // given a model, bonelist and bonename, lets stop an anim if it's playing. qboolean G2_Stop_Bone_Anim_Index(boneInfo_v &blist, const int index) { - + if ((index >= (int)blist.size()) || (blist[index].boneNumber == -1)) { // we are attempting to set a bone override that doesn't exist @@ -1024,10 +1024,10 @@ qboolean G2_Stop_Bone_Anim_Index(boneInfo_v &blist, const int index) // given a model, bonelist and bonename, lets stop an anim if it's playing. qboolean G2_Stop_Bone_Anim(const char *fileName, boneInfo_v &blist, const char *boneName) { - model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName)); - model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); + model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName)); + model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); int index = G2_Find_Bone(mod_a, blist, boneName); - + // did we find it? if (index != -1) { @@ -1043,13 +1043,13 @@ qboolean G2_Stop_Bone_Anim(const char *fileName, boneInfo_v &blist, const char * // given a model, bonelist and bonename, lets stop an anim if it's playing. qboolean G2_Stop_Bone_Angles_Index(boneInfo_v &blist, const int index) { - + if ((index >= (int)blist.size()) || (blist[index].boneNumber == -1)) { // we are attempting to set a bone override that doesn't exist assert(0); return qfalse; - } + } blist[index].flags &= ~(BONE_ANGLES_TOTAL); // try and remove this bone if we can @@ -1060,10 +1060,10 @@ qboolean G2_Stop_Bone_Angles_Index(boneInfo_v &blist, const int index) // given a model, bonelist and bonename, lets stop an anim if it's playing. qboolean G2_Stop_Bone_Angles(const char *fileName, boneInfo_v &blist, const char *boneName) { - model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName)); - model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); + model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName)); + model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); int index = G2_Find_Bone(mod_a, blist, boneName); - + // did we find it? if (index != -1) { @@ -1111,7 +1111,7 @@ void G2_Animate_Bone_List(CGhoul2Info_v &ghoul2, const int currentTime, const in if (animSize) { // did we run off the end? - if (((animSpeed > 0.0f) && (newFrame_g > endFrame-1 )) || + if (((animSpeed > 0.0f) && (newFrame_g > endFrame-1 )) || ((animSpeed < 0.0f) && (newFrame_g < endFrame+1 ))) { // yep - decide what to do @@ -1260,7 +1260,7 @@ static std::vector rag; // once we get the dependents precompute static void G2_Generate_MatrixRag( // caution this must not be called before the whole skeleton is "remembered" - boneInfo_v &blist, + boneInfo_v &blist, int index) { @@ -1326,13 +1326,13 @@ int G2_Find_Bone_Rag(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneNa } #if _DEBUG // G2_Bone_Not_Found(boneName,ghlInfo->mFileName); -#endif +#endif // didn't find it return -1; } static int G2_Set_Bone_Rag(const mdxaHeader_t *mod_a, - boneInfo_v &blist, + boneInfo_v &blist, const char *boneName, CGhoul2Info &ghoul2, const vec3_t scale, @@ -1365,7 +1365,7 @@ static int G2_Set_Bone_Rag(const mdxaHeader_t *mod_a, static int G2_Set_Bone_Angles_Rag( CGhoul2Info &ghoul2, const mdxaHeader_t *mod_a, - boneInfo_v &blist, + boneInfo_v &blist, const char *boneName, const int flags, const float radius, @@ -1436,8 +1436,8 @@ static int G2_Set_Bone_Angles_Rag( } if (!bone.lastTimeUpdated) { - static mdxaBone_t id = - { + static mdxaBone_t id = + { { { 1.0f, 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f }, @@ -1524,12 +1524,12 @@ static void G2_RagDollMatchPosition() VectorSubtract(desiredPos,e.currentOrigin,desiredPelvisOffset); // last arg is dest haveDesiredPelvisOffset=true; VectorCopy(e.currentOrigin,bone.lastPosition); // last arg is dest - continue; + continue; } if (!(bone.RagFlags & RAG_EFFECTOR)) { - continue; + continue; } VectorCopy(bone.originalOrigin,desiredPos); VectorSubtract(desiredPos,e.currentOrigin,e.desiredDirection); @@ -1564,7 +1564,7 @@ qboolean G2_Set_Bone_Anim_No_BS(CGhoul2Info &ghoul2, const mdxaHeader_t *mod,bon return qtrue; } - + index = G2_Add_Bone(ghoul2.animModel, blist, boneName); if (index != -1) @@ -1599,7 +1599,7 @@ void G2_ResetRagDoll(CGhoul2Info_v &ghoul2V) break; } } - + if (model == ghoul2V.size()) { return; @@ -2969,12 +2969,12 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve VectorSubtract(desiredPos,e.currentOrigin,desiredPelvisOffset); // last arg is dest haveDesiredPelvisOffset=true; VectorCopy(e.currentOrigin,bone.lastPosition); // last arg is dest - continue; + continue; } if (!(bone.RagFlags & RAG_EFFECTOR)) { - continue; + continue; } vec3_t testMins; vec3_t testMaxs; @@ -3008,12 +3008,12 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve // above the origin, so lets try lower if (e.currentOrigin[2] > groundSpot[2]) { - testStart[2]=groundSpot[2]+(e.radius-10.0f); + testStart[2]=groundSpot[2]+(e.radius-10.0f); } else { // lets try higher - testStart[2]=groundSpot[2]+8.0f; + testStart[2]=groundSpot[2]+8.0f; Rag_Trace(&tr,testStart,testMins,testMaxs,testEnd,ignoreNum,RAG_MASK,G2_NOCOLLIDE,0); if (tr.entityNum==0) { @@ -3053,7 +3053,7 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve else { vertEffectorTraceFraction=tr.fraction; - if (params && + if (params && vertEffectorTraceFraction < .95f && fabsf(tr.plane.normal[2]) < .707f) { @@ -3076,7 +3076,7 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve vec3_t effectorGroundSpot; VectorAdvance(testStart,vertEffectorTraceFraction,testEnd,effectorGroundSpot);// VA(a,t,b,c)-> c := (1-t)a+tb // trace from the quake origin horzontally to the effector - // gonna choose the maximum of the ground spot or the effector location + // gonna choose the maximum of the ground spot or the effector location // and clamp it to be roughly in the bbox VectorCopy(groundSpot,testStart); //last arg is dest if (iAmStartSolid) @@ -3111,7 +3111,7 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve } if (ztestvelocity, givenVelocity); vSpeed = VectorNormalize(givenVelocity); @@ -3310,7 +3310,7 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve static inline int G2_RagIndexForBoneNum(int boneNum) { for (int i = 0; i < numRags; i++) - { + { // these are used for affecting the end result if (ragBoneData[i].boneNum == boneNum) { @@ -3512,12 +3512,12 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve VectorSubtract(goalSpot, e.currentOrigin, desiredPelvisOffset); haveDesiredPelvisOffset = true; VectorCopy(e.currentOrigin, bone.lastPosition); - continue; + continue; } if (!(bone.RagFlags & RAG_EFFECTOR)) { - continue; + continue; } if (bone.hasOverGoal) @@ -3728,7 +3728,7 @@ static bool G2_RagDollSettlePositionNumeroTrois(CGhoul2Info_v &ghoul2V, const ve { if (hasBasePos) { - VectorSubtract(basePos, e.currentOrigin, velDir); + VectorSubtract(basePos, e.currentOrigin, velDir); } else { @@ -3955,7 +3955,7 @@ static void G2_RagDollSolve(CGhoul2Info_v &ghoul2V,int g2Index,float decay,int f // END this is the objective function thing for (i=0;i=0.0f); #if 0 - if (bone.RagFlags & RAG_PCJ_PELVIS) + if (bone.RagFlags & RAG_PCJ_PELVIS) { magicFactor9=.85f; // we don't want this swinging radically, make the whole thing kindof unstable } @@ -4233,16 +4233,16 @@ static void G2_IKReposition(const vec3_t currentOrg,CRagDollUpdateParams *params if (!(bone.RagFlags & RAG_EFFECTOR)) { - continue; + continue; } - + //Most effectors are not going to be PCJ, so this is not appplicable. //The actual desired angle of the PCJ is factored around the desired //directions of the effectors which are dependant on it. /* if (!(bone.RagFlags & RAG_PCJ_IK_CONTROLLED)) { - continue; + continue; } */ @@ -4280,7 +4280,7 @@ static void G2_IKSolve(CGhoul2Info_v &ghoul2V,int g2Index,float decay,int frameN // END this is the objective function thing for (i = 0; i < numRags; i++) - { + { // these are used for affecting the end result boneInfo_t &bone = *ragBoneData[i]; @@ -4295,7 +4295,7 @@ static void G2_IKSolve(CGhoul2Info_v &ghoul2V,int g2Index,float decay,int frameN } Inverse_Matrix(&ragBones[i], &N); // dest 2nd arg - + int k; vec3_t tAngles; VectorCopy(bone.currentAngles, tAngles); @@ -4371,7 +4371,7 @@ static void G2_IKSolve(CGhoul2Info_v &ghoul2V,int g2Index,float decay,int frameN { magicFactor1 = 0.40f; } - + recip = sqrt(4.0f/1.0f); float fac = (decay*recip*magicFactor1); @@ -4500,7 +4500,7 @@ void G2_Animate_Bone_List(CGhoul2Info_v &ghoul2, const int currentTime, const in static int G2_Set_Bone_Angles_IK( CGhoul2Info &ghoul2, const mdxaHeader_t *mod_a, - boneInfo_v &blist, + boneInfo_v &blist, const char *boneName, const int flags, const float radius, @@ -4536,8 +4536,8 @@ static int G2_Set_Bone_Angles_IK( } if (!bone.lastTimeUpdated) { - static mdxaBone_t id = - { + static mdxaBone_t id = + { { { 1.0f, 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f }, @@ -4657,7 +4657,7 @@ qboolean G2_SetBoneIKState(CGhoul2Info_v &ghoul2, int time, const char *boneName } int index = G2_Find_Bone(mod_a, blist, boneName); - + if (index == -1) { index = G2_Add_Bone(mod_a, blist, boneName); @@ -4753,7 +4753,7 @@ qboolean G2_IKMove(CGhoul2Info_v &ghoul2, int time, sharedIKMoveParams_t *params } int index = G2_Find_Bone(mod_a, blist, params->boneName); - + //don't add here if you can't find it.. ik bones should already be there, because they need to have special stuff done to them anyway. if (index == -1) { //couldn't find the bone.. @@ -4823,8 +4823,8 @@ void G2_RemoveRedundantBoneOverrides(boneInfo_v &blist, int *activeBones) int G2_Get_Bone_Index(CGhoul2Info *ghoul2, const char *boneName) { - model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(ghoul2->mFileName)); - model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); + model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(ghoul2->mFileName)); + model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); return (G2_Find_Bone(mod_a, ghoul2->mBlist, boneName)); } diff --git a/codemp/rd-rend2/G2_misc.cpp b/codemp/rd-rend2/G2_misc.cpp index ac64001c4e..d5cf343366 100644 --- a/codemp/rd-rend2/G2_misc.cpp +++ b/codemp/rd-rend2/G2_misc.cpp @@ -16,7 +16,7 @@ static int CurrentTag=GORE_TAG_UPPER+1; static int CurrentTagUpper=GORE_TAG_UPPER; static std::map GoreRecords; -static std::map,int> GoreTagsTemp; // this is a surface index to gore tag map used only +static std::map,int> GoreTagsTemp; // this is a surface index to gore tag map used only // temporarily during the generation phase so we reuse gore tags per LOD int goreModelIndex; @@ -218,11 +218,11 @@ class CTraceSurface #endif surfaceNum(initsurfaceNum), - rootSList(initrootSList), + rootSList(initrootSList), currentModel(initcurrentModel), - lod(initlod), - collRecMap(initcollRecMap), - entNum(initentNum), + lod(initlod), + collRecMap(initcollRecMap), + entNum(initentNum), modelIndex(initmodelIndex), skin(initskin), cust_shader(initcust_shader), @@ -243,7 +243,7 @@ class CTraceSurface VectorCopy(initrayStart, rayStart); VectorCopy(initrayEnd, rayEnd); hitOne = false; - } + } }; @@ -259,7 +259,7 @@ void G2_List_Model_Surfaces(const char *fileName) surf = (mdxmSurfHierarchy_t *) ( (byte *)mdxm + mdxm->ofsSurfHierarchy ); mdxmSurface_t *surface = (mdxmSurface_t *)((byte *)mdxm + mdxm->ofsLODs + sizeof(mdxmLOD_t)); - for ( x = 0 ; x < mdxm->numSurfaces ; x++) + for ( x = 0 ; x < mdxm->numSurfaces ; x++) { Com_Printf("Surface %i Name %s\n", x, surf->name); if ( r_verbose->integer ) @@ -283,7 +283,7 @@ void G2_List_Model_Bones(const char *fileName, int frame) int x, i; mdxaSkel_t *skel; mdxaSkelOffsets_t *offsets; - model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName)); + model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName)); model_t *mod_a = R_GetModelByHandle(mod_m->data.glm->header->animIndex); // mdxaFrame_t *aframe=0; // int frameSize; @@ -292,7 +292,7 @@ void G2_List_Model_Bones(const char *fileName, int frame) // figure out where the offset list is offsets = (mdxaSkelOffsets_t *)((byte *)header + sizeof(mdxaHeader_t)); -// frameSize = (size_t)( &((mdxaFrame_t *)0)->boneIndexes[ header->numBones ] ); +// frameSize = (size_t)( &((mdxaFrame_t *)0)->boneIndexes[ header->numBones ] ); // aframe = (mdxaFrame_t *)((byte *)header + header->ofsFrames + (frame * frameSize)); // walk each bone and list it's name @@ -321,7 +321,7 @@ void G2_List_Model_Bones(const char *fileName, int frame) * obtain the .gla filename for a model * * Input - * filename of model + * filename of model * * Output * true if we successfully obtained a filename, false otherwise @@ -346,7 +346,7 @@ qboolean G2_GetAnimFileName(const char *fileName, char **filename) ///////////////////////////////////////////////////////////////////// -// +// // Code for collision detection for models gameside // ///////////////////////////////////////////////////////////////////// @@ -361,7 +361,7 @@ int G2_DecideTraceLod(CGhoul2Info &ghoul2, int useLod) returnLod = ghoul2.mLodBias; } // assert(G2_MODEL_OK(&ghoul2)); - + mdxmHeader_t *mdxm = ghoul2.currentModel->data.glm->header; assert(ghoul2.currentModel); assert(mdxm); @@ -376,7 +376,7 @@ int G2_DecideTraceLod(CGhoul2Info &ghoul2, int useLod) return returnLod; } -void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, IHeapAllocator *G2VertSpace, size_t *TransformedVertsArray,CBoneCache *boneCache) +void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, IHeapAllocator *G2VertSpace, size_t *TransformedVertsArray,CBoneCache *boneCache) { int j, k; mdxmVertex_t *v; @@ -386,7 +386,7 @@ void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, IHeapAl // deform the vertexes by the lerped bones // int *piBoneReferences = (int*) ((byte*)surface + surface->ofsBoneReferences); - + // alloc some space for the transformed verts to get put in TransformedVerts = (float *)G2VertSpace->MiniHeapAlloc(surface->numVerts * 5 * 4); TransformedVertsArray[surface->thisSurfaceIndex] = (size_t)TransformedVerts; @@ -403,7 +403,7 @@ void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, IHeapAl // optimisation issue if ((scale[0] != 1.0) || (scale[1] != 1.0) || (scale[2] != 1.0)) { - for ( j = 0; j < numVerts; j++ ) + for ( j = 0; j < numVerts; j++ ) { vec3_t tempVert, tempNormal; // mdxmWeight_t *w; @@ -415,7 +415,7 @@ void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, IHeapAl const int iNumWeights = G2_GetVertWeights( v ); float fTotalWeight = 0.0f; - for ( k = 0 ; k < iNumWeights ; k++ ) + for ( k = 0 ; k < iNumWeights ; k++ ) { int iBoneIndex = G2_GetVertBoneIndex( v, k ); float fBoneWeight = G2_GetVertBoneWeight( v, k, fTotalWeight, iNumWeights ); @@ -446,7 +446,7 @@ void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, IHeapAl else { int pos = 0; - for ( j = 0; j < numVerts; j++ ) + for ( j = 0; j < numVerts; j++ ) { vec3_t tempVert, tempNormal; // const mdxmWeight_t *w; @@ -458,7 +458,7 @@ void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, IHeapAl const int iNumWeights = G2_GetVertWeights( v ); float fTotalWeight = 0.0f; - for ( k = 0 ; k < iNumWeights ; k++ ) + for ( k = 0 ; k < iNumWeights ; k++ ) { int iBoneIndex = G2_GetVertBoneIndex( v, k ); float fBoneWeight = G2_GetVertBoneWeight( v, k, fTotalWeight, iNumWeights ); @@ -487,7 +487,7 @@ void R_TransformEachSurface( const mdxmSurface_t *surface, vec3_t scale, IHeapAl } } -void G2_TransformSurfaces(int surfaceNum, surfaceInfo_v &rootSList, +void G2_TransformSurfaces(int surfaceNum, surfaceInfo_v &rootSList, CBoneCache *boneCache, const model_t *currentModel, int lod, vec3_t scale, IHeapAllocator *G2VertSpace, size_t *TransformedVertArray, bool secondTimeAround) { int i; @@ -497,7 +497,7 @@ void G2_TransformSurfaces(int surfaceNum, surfaceInfo_v &rootSList, const mdxmSurface_t *surface = (mdxmSurface_t *)G2_FindSurface((void*)currentModel, surfaceNum, lod); const mdxmHierarchyOffsets_t *surfIndexes = (mdxmHierarchyOffsets_t *)((byte *)currentModel->data.glm->header + sizeof(mdxmHeader_t)); const mdxmSurfHierarchy_t *surfInfo = (mdxmSurfHierarchy_t *)((byte *)surfIndexes + surfIndexes->offsets[surface->thisSurfaceIndex]); - + // see if we have an override surface in the surface list const surfaceInfo_t *surfOverride = G2_FindOverrideSurface(surfaceNum, rootSList); @@ -619,7 +619,7 @@ void G2_TransformModel(CGhoul2Info_v &ghoul2, const int frameNum, vec3_t scale, } } - memset(g.mTransformedVertsArray, 0,mdxm->numSurfaces * sizeof (size_t)); + memset(g.mTransformedVertsArray, 0,mdxm->numSurfaces * sizeof (size_t)); G2_FindOverrideSurface(-1,g.mSlist); //reset the quick surface override lookup; // recursively call the model surface transform @@ -691,15 +691,15 @@ qboolean G2_SegmentTriangleTest( const vec3_t start, const vec3_t end, vec3_t edgeAC; VectorSubtract(C, A, edgeAC); - VectorSubtract(B, A, returnedNormalT); + VectorSubtract(B, A, returnedNormalT); CrossProduct(returnedNormalT, edgeAC, returnedNormal); - + vec3_t ray; VectorSubtract(end, start, ray); *denom=DotProduct(ray, returnedNormal); - + if (fabs(*denom)0)|| // not accepting back faces (!frontFaces && *denom<0)) //not accepting front faces @@ -709,16 +709,16 @@ qboolean G2_SegmentTriangleTest( const vec3_t start, const vec3_t end, vec3_t toPlane; VectorSubtract(A, start, toPlane); - + float t=DotProduct(toPlane, returnedNormal)/ *denom; - + if (t<0.0f||t>1.0f) { return qfalse; // off segment } - + VectorScale(ray, t, ray); - + VectorAdd(ray, start, returnedPoint); vec3_t edgePA; @@ -729,9 +729,9 @@ qboolean G2_SegmentTriangleTest( const vec3_t start, const vec3_t end, vec3_t edgePC; VectorSubtract(C, returnedPoint, edgePC); - + vec3_t temp; - + CrossProduct(edgePA, edgePB, temp); if (DotProduct(temp, returnedNormal)<0.0f) { @@ -743,12 +743,12 @@ qboolean G2_SegmentTriangleTest( const vec3_t start, const vec3_t end, { return qfalse; // off triangle } - + CrossProduct(edgePB, edgePC, temp); if (DotProduct(temp, returnedNormal)<0.0f) { return qfalse; // off triangle - } + } return qtrue; } @@ -775,7 +775,7 @@ int G2API_GetTime(int argTime); // now we at poly level, check each model space transformed poly against the model world transfomed ray void G2_GorePolys( const mdxmSurface_t *surface, CTraceSurface &TS, const mdxmSurfHierarchy_t *surfInfo) -{ +{ int j; vec3_t basis1; vec3_t basis2; @@ -817,7 +817,7 @@ void G2_GorePolys( const mdxmSurface_t *surface, CTraceSurface &TS, const mdxmSu int numVerts = surface->numVerts; int flags=15; assert(numVerts=0&&tris[j].indexes[0]=0&&tris[j].indexes[1]growDuration != 0); add.mGoreGrowFactor = ( 1.0f - TS.gore->goreScaleStartFraction) / (float)(TS.gore->growDuration); //curscale = (curtime-mGoreGrowStartTime)*mGoreGrowFactor; - add.mGoreGrowOffset = TS.gore->goreScaleStartFraction; + add.mGoreGrowOffset = TS.gore->goreScaleStartFraction; goreSet->mGoreRecords.insert(std::pair(TS.surfaceNum,add)); GoreTagsTemp[std::pair(goreModelIndex,TS.surfaceNum)]=newTag; @@ -1007,7 +1007,7 @@ void G2_GorePolys( const mdxmSurface_t *surface, CTraceSurface &TS, const mdxmSu mdxmVertex_t currentVert = v[GoreIndexCopy[j]]; VectorCopy(currentVert.vertCoords, goreSurface->verts[j].position); goreSurface->verts[j].normal = R_VboPackNormal(currentVert.normal); - + int numWeights = G2_GetVertWeights(¤tVert); float fTotalWeight = 0.0f; for (int w = 0; w < numWeights; w++) @@ -1050,12 +1050,12 @@ static SVertexTemp GoreVerts[MAX_GORE_VERTS]; static bool G2_TracePolys(const mdxmSurface_t *surface, const mdxmSurfHierarchy_t *surfInfo, CTraceSurface &TS) { int j, numTris; - + // whip through and actually transform each vertex const mdxmTriangle_t *tris = (mdxmTriangle_t *) ((byte *)surface + surface->ofsTriangles); const float *verts = (float *)TS.TransformedVertsArray[surface->thisSurfaceIndex]; numTris = surface->numTriangles; - for ( j = 0; j < numTris; j++ ) + for ( j = 0; j < numTris; j++ ) { float face; vec3_t hitPoint, normal; @@ -1074,7 +1074,7 @@ static bool G2_TracePolys(const mdxmSurface_t *surface, const mdxmSurfHierarchy_ CollisionRecord_t &newCol = TS.collRecMap[i]; vec3_t distVect; float x_pos = 0, y_pos = 0; - + newCol.mPolyIndex = j; newCol.mEntityNum = TS.entNum; newCol.mSurfaceIndex = surface->thisSurfaceIndex; @@ -1104,32 +1104,32 @@ static bool G2_TracePolys(const mdxmSurface_t *surface, const mdxmSurfHierarchy_ G2_BuildHitPointST(point1, point1[3], point1[4], point2, point2[3], point2[4], point3, point3[3], point3[4], - hitPoint, &x_pos, &y_pos,newCol.mBarycentricI,newCol.mBarycentricJ); - + hitPoint, &x_pos, &y_pos,newCol.mBarycentricI,newCol.mBarycentricJ); + /* const shader_t *shader = 0; // now, we know what surface this hit belongs to, we need to go get the shader handle so we can get the correct hit location and hit material info - if ( cust_shader ) + if ( cust_shader ) { shader = cust_shader; - } - else if ( skin ) + } + else if ( skin ) { int j; - + // match the surface name to something in the skin file shader = tr.defaultShader; for ( j = 0 ; j < skin->numSurfaces ; j++ ) { // the names have both been lowercased - if ( !strcmp( skin->surfaces[j]->name, surfInfo->name ) ) + if ( !strcmp( skin->surfaces[j]->name, surfInfo->name ) ) { shader = skin->surfaces[j]->shader; break; } } - } - else + } + else { shader = R_GetShaderByHandle( surfInfo->shaderIndex ); } @@ -1143,7 +1143,7 @@ static bool G2_TracePolys(const mdxmSurface_t *surface, const mdxmSurfHierarchy_ newCol.mLocation = *(hitMatReg[shader->hitLocation].loc + ((int)(y_pos * hitMatReg[shader->hitLocation].height) * hitMatReg[shader->hitLocation].width) + ((int)(x_pos * hitMatReg[shader->hitLocation].width))); - Com_Printf("G2_TracePolys hit location: %d\n", newCol.mLocation); + Com_Printf("G2_TracePolys hit location: %d\n", newCol.mLocation); } if (shader->hitMaterial) @@ -1178,7 +1178,7 @@ static bool G2_TracePolys(const mdxmSurface_t *surface, const mdxmSurfHierarchy_ // now we're at poly level, check each model space transformed poly against the model world transfomed ray static bool G2_RadiusTracePolys( - const mdxmSurface_t *surface, + const mdxmSurface_t *surface, CTraceSurface &TS ) { @@ -1224,15 +1224,15 @@ static bool G2_RadiusTracePolys( const float * const verts = (float *)TS.TransformedVertsArray[surface->thisSurfaceIndex]; const int numVerts = surface->numVerts; - + int flags=63; //rayDir/=lengthSquared(raydir); - const float f = VectorLengthSquared(v3RayDir); + const float f = VectorLengthSquared(v3RayDir); v3RayDir[0]/=f; v3RayDir[1]/=f; v3RayDir[2]/=f; - for ( j = 0; j < numVerts; j++ ) + for ( j = 0; j < numVerts; j++ ) { const int pos=j*5; vec3_t delta; @@ -1281,7 +1281,7 @@ static bool G2_RadiusTracePolys( const int numTris = surface->numTriangles; const mdxmTriangle_t * const tris = (mdxmTriangle_t *) ((byte *)surface + surface->ofsTriangles); - for ( j = 0; j < numTris; j++ ) + for ( j = 0; j < numTris; j++ ) { assert(tris[j].indexes[0]>=0&&tris[j].indexes[0]=0&&tris[j].indexes[1]thisSurfaceIndex; @@ -1318,7 +1318,7 @@ static bool G2_RadiusTracePolys( // newCol.mFlags = G2_BACKFACE; // } - //get normal from triangle + //get normal from triangle const float *A = &verts[(tris[j].indexes[0] * 5)]; const float *B = &verts[(tris[j].indexes[1] * 5)]; const float *C = &verts[(tris[j].indexes[2] * 5)]; @@ -1392,7 +1392,7 @@ static void G2_TraceSurfaces(CTraceSurface &TS) const mdxmSurface_t *surface = (mdxmSurface_t *)G2_FindSurface(TS.currentModel, TS.surfaceNum, TS.lod); const mdxmHierarchyOffsets_t *surfIndexes = (mdxmHierarchyOffsets_t *)((byte *)TS.currentModel->data.glm->header + sizeof(mdxmHeader_t)); const mdxmSurfHierarchy_t *surfInfo = (mdxmSurfHierarchy_t *)((byte *)surfIndexes + surfIndexes->offsets[surface->thisSurfaceIndex]); - + // see if we have an override surface in the surface list const surfaceInfo_t *surfOverride = G2_FindOverrideSurface(TS.surfaceNum, TS.rootSList); @@ -1422,7 +1422,7 @@ static void G2_TraceSurfaces(CTraceSurface &TS) { // .. then use radius check // - if (G2_RadiusTracePolys(surface, // const mdxmSurface_t *surface, + if (G2_RadiusTracePolys(surface, // const mdxmSurface_t *surface, TS ) && (TS.traceFlags == G2_RETURNONHIT) @@ -1511,11 +1511,11 @@ void G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, Colli } // assert(G2_MODEL_OK(&ghoul2[i])); // do we really want to collide with this object? - if (ghoul2[i].mFlags & GHOUL2_NOCOLLIDE) + if (ghoul2[i].mFlags & GHOUL2_NOCOLLIDE) { continue; } - + if (ghoul2[i].mCustomShader && ghoul2[i].mCustomShader != -20) //rww - -20 is a server instance (hack) { cust_shader = (shader_t *)R_GetShaderByHandle( ghoul2[i].mCustomShader ); @@ -1526,7 +1526,7 @@ void G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, Colli } // figure out the custom skin thing - if ( ghoul2[i].mSkin > 0 && ghoul2[i].mSkin < tr.numSkins ) + if ( ghoul2[i].mSkin > 0 && ghoul2[i].mSkin < tr.numSkins ) { skin = R_GetSkinByHandle( ghoul2[i].mSkin ); } @@ -1546,7 +1546,7 @@ void G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, Colli } #endif //reset the quick surface override lookup - G2_FindOverrideSurface(-1, ghoul2[i].mSlist); + G2_FindOverrideSurface(-1, ghoul2[i].mSlist); #ifdef _G2_GORE CTraceSurface TS(ghoul2[i].mSurfaceRoot, ghoul2[i].mSlist, (model_t *)ghoul2[i].currentModel, lod, rayStart, rayEnd, collRecMap, entNum, i, skin, cust_shader, ghoul2[i].mTransformedVertsArray, eG2TraceType, fRadius, ssize, tsize, theta, shader, &ghoul2[i], gore); @@ -1698,20 +1698,20 @@ qboolean G2_SaveGhoul2Models(CGhoul2Info_v &ghoul2, char **buffer, int *size) int ghoul2BlockSize = (size_t)&ghoul2[0].mTransformedVertsArray - (size_t)&ghoul2[0].mModelindex; // add in count for number of ghoul2 models - *size += 4; + *size += 4; // start out working out the total size of the buffer we need to allocate int i; // Linux GCC is forcing new scoping rules for (i=0; idata.glm->header; surf = (mdxmSurfHierarchy_t *) ( (byte *)mdxm + mdxm->ofsSurfHierarchy ); - for ( int i = 0 ; i < mdxm->numSurfaces ; i++) + for ( int i = 0 ; i < mdxm->numSurfaces ; i++) { if (!Q_stricmp(surfaceName, surf->name)) { @@ -104,7 +104,7 @@ mdxmSurface_t *G2_FindSurface(CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const } return 0; } - + // first find if we already have this surface in the list for (i = slist.size() - 1; i >= 0; i--) { @@ -139,7 +139,7 @@ qboolean G2_SetSurfaceOnOff (CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const c { int surfIndex = -1; surfaceInfo_t temp_slist_entry; - mdxmSurface_t *surf; + mdxmSurface_t *surf; // find the model we want model_t *mod = (model_t *)ghlInfo->currentModel; @@ -149,7 +149,7 @@ qboolean G2_SetSurfaceOnOff (CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const c assert(0); return qfalse; } - + // first find if we already have this surface in the list surf = G2_FindSurface(ghlInfo, slist, surfaceName, &surfIndex); if (surf) @@ -179,7 +179,7 @@ qboolean G2_SetSurfaceOnOff (CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const c { // insert here then because it changed, no need to add an override otherwise temp_slist_entry.offFlags = newflags; temp_slist_entry.surface = surfaceNum; - + slist.push_back(temp_slist_entry); } return qtrue; @@ -203,7 +203,7 @@ void G2_SetSurfaceOnOffFromSkin (CGhoul2Info *ghlInfo, qhandle_t renderSkin) if ( !strcmp( ((shader_t *)skin->surfaces[j]->shader)->name, "*off") ) { G2_SetSurfaceOnOff(ghlInfo, ghlInfo->mSlist, skin->surfaces[j]->name, G2SURFACEFLAG_OFF); } - else + else { int flags; int surfaceNum = G2_IsSurfaceLegal((void *)ghlInfo->currentModel, skin->surfaces[j]->name, &flags); @@ -228,7 +228,7 @@ int G2_IsSurfaceOff (CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const char *sur { return 0; } - + // first find if we already have this surface in the list surf = G2_FindSurface(ghlInfo, slist, surfaceName, &surfIndex); if (surf) @@ -240,7 +240,7 @@ int G2_IsSurfaceOff (CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const char *sur mdxmSurfHierarchy_t *surface = (mdxmSurfHierarchy_t *) ( (byte *)mdxm + mdxm->ofsSurfHierarchy ); - for ( int i = 0 ; i < mdxm->numSurfaces ; i++) + for ( int i = 0 ; i < mdxm->numSurfaces ; i++) { if (!Q_stricmp(surfaceName, surface->name)) { @@ -367,7 +367,7 @@ qboolean G2_SetRootSurface(CGhoul2Info_v &ghoul2, const int modelIndex, const ch G2_FindRecursiveSurface(mod_m, surf, ghoul2[modelIndex].mSlist, activeSurfaces); // now generate the used bone list - CConstructBoneList CBL(ghoul2[modelIndex].mSurfaceRoot, + CConstructBoneList CBL(ghoul2[modelIndex].mSurfaceRoot, activeBones, ghoul2[modelIndex].mSlist, mod_m, @@ -393,8 +393,8 @@ qboolean G2_SetRootSurface(CGhoul2Info_v &ghoul2, const int modelIndex, const ch int boltMod = (ghoul2[i].mModelBoltLink >> MODEL_SHIFT) & MODEL_AND; int boltNum = (ghoul2[i].mModelBoltLink >> BOLT_SHIFT) & BOLT_AND; // if either the bolt list is too small, or the bolt we are pointing at references nothing, remove this model - if (((int)ghoul2[boltMod].mBltlist.size() <= boltNum) || - ((ghoul2[boltMod].mBltlist[boltNum].boneNumber == -1) && + if (((int)ghoul2[boltMod].mBltlist.size() <= boltNum) || + ((ghoul2[boltMod].mBltlist[boltNum].boneNumber == -1) && (ghoul2[boltMod].mBltlist[boltNum].surfaceNumber == -1))) { CGhoul2Info_v *g2i = &ghoul2; @@ -415,7 +415,7 @@ qboolean G2_SetRootSurface(CGhoul2Info_v &ghoul2, const int modelIndex, const ch { CGhoul2Info_v &ghoul2 = *((CGhoul2Info_v *)entstate->ghoul2); model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(ghoul2[modelIndex].mFileName)); - model_t *mod_a = R_GetModelByHandle(mod_m->mdxm->animIndex); + model_t *mod_a = R_GetModelByHandle(mod_m->mdxm->animIndex); int surf; int flags; int *activeSurfaces, *activeBones; @@ -451,7 +451,7 @@ qboolean G2_SetRootSurface(CGhoul2Info_v &ghoul2, const int modelIndex, const ch G2_FindRecursiveSurface(mod_m, surf, ghoul2[modelIndex].mSlist, activeSurfaces); // now generate the used bone list - CConstructBoneList CBL(ghoul2[modelIndex].mSurfaceRoot, + CConstructBoneList CBL(ghoul2[modelIndex].mSurfaceRoot, activeBones, ghoul2[modelIndex].mSlist, mod_m, @@ -477,8 +477,8 @@ qboolean G2_SetRootSurface(CGhoul2Info_v &ghoul2, const int modelIndex, const ch int boltMod = (ghoul2[i].mModelBoltLink >> MODEL_SHIFT) & MODEL_AND; int boltNum = (ghoul2[i].mModelBoltLink >> BOLT_SHIFT) & BOLT_AND; // if either the bolt list is too small, or the bolt we are pointing at references nothing, remove this model - if ((ghoul2[boltMod].mBltlist.size() <= boltNum) || - ((ghoul2[boltMod].mBltlist[boltNum].boneNumber == -1) && + if ((ghoul2[boltMod].mBltlist.size() <= boltNum) || + ((ghoul2[boltMod].mBltlist[boltNum].boneNumber == -1) && (ghoul2[boltMod].mBltlist[boltNum].surfaceNumber == -1))) { G2API_RemoveGhoul2Model(entstate, i); @@ -595,7 +595,7 @@ int G2_GetSurfaceIndex(CGhoul2Info *ghlInfo, const char *surfaceName) { model_t *mod = (model_t *)ghlInfo->currentModel; int flags; - + return G2_IsSurfaceLegal(mod, surfaceName, &flags); } @@ -632,7 +632,7 @@ int G2_IsSurfaceRendered(CGhoul2Info *ghlInfo, const char *surfaceName, surfaceI //G2 was bug, above comment was accurate, but we don't want the original flags, we want the parent flags G2_IsSurfaceLegal((model_t *)ghlInfo->currentModel, parentSurfInfo->name, &parentFlags); - // now see if we already have overriden this surface in the slist + // now see if we already have overriden this surface in the slist parentSurf = G2_FindSurface(ghlInfo, slist, parentSurfInfo->name, &surfIndex); if (parentSurf) { @@ -643,7 +643,7 @@ int G2_IsSurfaceRendered(CGhoul2Info *ghlInfo, const char *surfaceName, surfaceI if (parentFlags & G2SURFACEFLAG_NODESCENDANTS) { flags |= G2SURFACEFLAG_OFF; - break; + break; } // set up scan of next parent surfNum = parentSurfInfo->parentIndex; @@ -655,7 +655,7 @@ int G2_IsSurfaceRendered(CGhoul2Info *ghlInfo, const char *surfaceName, surfaceI } if ( flags == 0 ) {//it's not being overridden by a parent - // now see if we already have overriden this surface in the slist + // now see if we already have overriden this surface in the slist const mdxmSurface_t *surf = G2_FindSurface(ghlInfo, slist, surfaceName, &surfIndex); if (surf) { diff --git a/codemp/rd-vanilla/CMakeLists.txt b/codemp/rd-vanilla/CMakeLists.txt index 288997556e..b7909a608a 100644 --- a/codemp/rd-vanilla/CMakeLists.txt +++ b/codemp/rd-vanilla/CMakeLists.txt @@ -99,7 +99,7 @@ set(MPVanillaRendererFiles ${MPVanillaRendererFiles} ${MPVanillaRendererRdCommon set(MPVanillaRendererCommonFiles "${MPDir}/qcommon/matcomp.cpp" "${MPDir}/qcommon/q_shared.cpp" - + ${SharedCommonFiles}) source_group("common" FILES ${MPVanillaRendererCommonFiles}) set(MPVanillaRendererFiles ${MPVanillaRendererFiles} ${MPVanillaRendererCommonFiles}) diff --git a/codemp/rd-vanilla/tr_shader.cpp b/codemp/rd-vanilla/tr_shader.cpp index cedbffd638..1a2cdd561f 100644 --- a/codemp/rd-vanilla/tr_shader.cpp +++ b/codemp/rd-vanilla/tr_shader.cpp @@ -2373,7 +2373,7 @@ static qboolean ParseShader( const char **text ) // functioned because rgbGen identity doesn't work with setcolor. // // We match against retail version of gfx/menus/radar/arrow_w by calculating - // the hash value of the shader text, and comparing it against a + // the hash value of the shader text, and comparing it against a // precalculated value. if ( shaderHash == RETAIL_ARROW_W_SHADER_HASH && Q_stricmp( shader.name, "gfx/menus/radar/arrow_w" ) == 0 ) diff --git a/codemp/rd-vanilla/tr_shadows.cpp b/codemp/rd-vanilla/tr_shadows.cpp index d5480fc62c..334b5faa77 100644 --- a/codemp/rd-vanilla/tr_shadows.cpp +++ b/codemp/rd-vanilla/tr_shadows.cpp @@ -400,7 +400,7 @@ void RB_DoShadowTessEnd( vec3_t lightPos ) // reenable writing to the color buffer qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); - + #ifdef _DEBUG_STENCIL_SHADOWS qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL); #endif diff --git a/codemp/ui/ui_shared.c b/codemp/ui/ui_shared.c index 6b05151f94..d1f0e8dbb1 100644 --- a/codemp/ui/ui_shared.c +++ b/codemp/ui/ui_shared.c @@ -8706,7 +8706,7 @@ static void Item_ApplyHacks( itemDef_t *item ) { } } #endif - + // Fix length of favorite address in createfavorite.menu if ( item->type == ITEM_TYPE_EDITFIELD && item->cvar && !Q_stricmp( item->cvar, "ui_favoriteAddress" ) ) { editFieldDef_t *editField = item->typeData.edit; diff --git a/rv-readme.txt b/rv-readme.txt index 779675e6e3..8c5bfb3916 100644 --- a/rv-readme.txt +++ b/rv-readme.txt @@ -1,4 +1,4 @@ -Activision and Raven are releasing this code for people to learn from and play with. +Activision and Raven are releasing this code for people to learn from and play with. This code is copyright Activision 2003. This source is released under GNU GPLv2. diff --git a/scripts/docker/server.cfg b/scripts/docker/server.cfg index cfdd09e7e7..5bbdc5a213 100644 --- a/scripts/docker/server.cfg +++ b/scripts/docker/server.cfg @@ -1,9 +1,9 @@ // Server Config seta sv_hostname "Sample OpenJK server" -//seta g_motd "woot" +//seta g_motd "woot" //rconpassword "my secret password" -seta sv_maxclients 16 +seta sv_maxclients 16 set timelimit 20 // gametypes // 0 = FFA diff --git a/shared/qcommon/q_string.c b/shared/qcommon/q_string.c index 67ecc17012..b7c182cbf7 100644 --- a/shared/qcommon/q_string.c +++ b/shared/qcommon/q_string.c @@ -109,7 +109,7 @@ void Q_strncpyz( char *dest, const char *src, int destsize ) { assert(src); assert(dest); assert(destsize); - + strncpy( dest, src, destsize-1 ); dest[destsize-1] = 0; } diff --git a/shared/qcommon/safe/files.h b/shared/qcommon/safe/files.h index e82d3964e7..c477ddea35 100644 --- a/shared/qcommon/safe/files.h +++ b/shared/qcommon/safe/files.h @@ -87,7 +87,7 @@ namespace FS { return static_cast< std::size_t >( _end - begin() ); } - + private: // TODO: this should really be const; it's a matter of making FS_ListFiles' result const. char** _begin = nullptr; diff --git a/shared/rd-rend2/MikkTSpace/mikktspace.c b/shared/rd-rend2/MikkTSpace/mikktspace.c index b40d96d2db..55f0097e7c 100644 --- a/shared/rd-rend2/MikkTSpace/mikktspace.c +++ b/shared/rd-rend2/MikkTSpace/mikktspace.c @@ -130,7 +130,7 @@ typedef struct { tbool bOrientPreservering; } SGroup; -// +// #define MARK_DEGENERATE 1 #define QUAD_ONE_DEGEN_TRI 2 #define GROUP_WITH_ANY 4 @@ -141,7 +141,7 @@ typedef struct { typedef struct { int FaceNeighbors[3]; SGroup * AssignedGroup[3]; - + // normalized first order face derivatives SVec3 vOs, vOt; float fMagS, fMagT; // original magnitudes @@ -301,13 +301,13 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre // put the degenerate triangles last. DegenPrologue(pTriInfos, piTriListIn, iNrTrianglesIn, iTotTris); - + // evaluate triangle level attributes and neighbor list //printf("gen neighbors list begin\n"); InitTriInfo(pTriInfos, piTriListIn, pContext, iNrTrianglesIn); //printf("gen neighbors list end\n"); - + // based on the 4 rules, identify groups based on connectivity iNrMaxGroups = iNrTrianglesIn*3; pGroups = (SGroup *) malloc(sizeof(SGroup)*iNrMaxGroups); @@ -349,7 +349,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre //printf("gen tspaces begin\n"); bRes = GenerateTSpaces(psTspace, pTriInfos, pGroups, iNrActiveGroups, piTriListIn, fThresCos, pContext); //printf("gen tspaces end\n"); - + // clean up free(pGroups); free(piGroupTrianglesBuffer); @@ -375,7 +375,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre { const int verts = pContext->m_pInterface->m_getNumVerticesOfFace(pContext, f); if (verts!=3 && verts!=4) continue; - + // I've decided to let degenerate triangles and group-with-anythings // vary between left/right hand coordinate systems at the vertices. @@ -415,7 +415,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre free(psTspace); - + return TTRUE; } @@ -544,7 +544,7 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM if (iMaxCountiNrFaces; j++) { @@ -1298,7 +1298,7 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con bFound = CompareSubGroups(&tmp_group, &pUniSubGroups[l]); if (!bFound) ++l; } - + // assign tangent space index assert(bFound || l==iUniqueSubGroups); //piTempTangIndices[f*3+index] = iUniqueTspaces+l; @@ -1626,7 +1626,7 @@ static void BuildNeighborsSlow(STriInfo pTriInfos[], const int piTriListIn[], co ++j; } } - + if (!bFound) ++t; } @@ -1703,7 +1703,7 @@ static void QuickSortEdges(SEdge * pSortBuffer, int iLeft, int iRight, const int static void GetEdge(int * i0_out, int * i1_out, int * edgenum_out, const int indices[], const int i0_in, const int i1_in) { *edgenum_out = -1; - + // test if first index is on the edge if (indices[0]==i0_in || indices[0]==i1_in) { @@ -1851,7 +1851,7 @@ static void DegenEpilogue(STSpace psTspace[], STriInfo pTriInfos[], int piTriLis const int iSrcOffs=pTriInfos[iTri].iTSpacesOffs; const int iDstVert=pTriInfos[t].vert_num[i]; const int iDstOffs=pTriInfos[t].iTSpacesOffs; - + // copy tspace psTspace[iDstOffs+iDstVert] = psTspace[iSrcOffs+iSrcVert]; } diff --git a/shared/rd-rend2/glsl/bokeh.glsl b/shared/rd-rend2/glsl/bokeh.glsl index c2337c28be..5d53884d5e 100644 --- a/shared/rd-rend2/glsl/bokeh.glsl +++ b/shared/rd-rend2/glsl/bokeh.glsl @@ -56,7 +56,7 @@ void main() tc = var_TexCoords + u_InvTexRes * vec2( -c[3], -c[3]); color += texture(u_TextureMap, tc); tc = var_TexCoords + u_InvTexRes * vec2( -c[4], -c[2]); color += texture(u_TextureMap, tc); tc = var_TexCoords + u_InvTexRes * vec2( -c[5], -c[1]); color += texture(u_TextureMap, tc); - + out_Color = color * 0.04166667 * u_Color; #endif @@ -81,6 +81,6 @@ void main() tc = var_TexCoords + u_InvTexRes * vec2( -c[1], -c[3]); color += texture(u_TextureMap, tc); tc = var_TexCoords + u_InvTexRes * vec2( -c[2], -c[2]); color += texture(u_TextureMap, tc); tc = var_TexCoords + u_InvTexRes * vec2( -c[3], -c[1]); color += texture(u_TextureMap, tc); - + out_Color = color * 0.0625 * u_Color; } diff --git a/shared/rd-rend2/glsl/calclevels4x.glsl b/shared/rd-rend2/glsl/calclevels4x.glsl index 4c9252230e..da58eeea16 100644 --- a/shared/rd-rend2/glsl/calclevels4x.glsl +++ b/shared/rd-rend2/glsl/calclevels4x.glsl @@ -51,12 +51,12 @@ void main() current = GetValues(vec2(-0.5, -1.5), current); current = GetValues(vec2( 0.5, -1.5), current); current = GetValues(vec2( 1.5, -1.5), current); - + current = GetValues(vec2(-1.5, -0.5), current); current = GetValues(vec2(-0.5, -0.5), current); current = GetValues(vec2( 0.5, -0.5), current); current = GetValues(vec2( 1.5, -0.5), current); - + current = GetValues(vec2(-1.5, 0.5), current); current = GetValues(vec2(-0.5, 0.5), current); current = GetValues(vec2( 0.5, 0.5), current); diff --git a/shared/rd-rend2/glsl/depthblur.glsl b/shared/rd-rend2/glsl/depthblur.glsl index ab32f9c000..50fc22cb79 100644 --- a/shared/rd-rend2/glsl/depthblur.glsl +++ b/shared/rd-rend2/glsl/depthblur.glsl @@ -48,10 +48,10 @@ vec4 depthGaussian1D(sampler2D imageMap, sampler2D depthMap, vec2 tex, float zFa #else // if defined(USE_VERTICAL_BLUR) vec2 direction = vec2(0.0, 1.0) * scale; #endif - + float depthCenter = zFar * getLinearDepth(depthMap, tex, zFarDivZNear); vec2 centerSlope = vec2(dFdx(depthCenter), dFdy(depthCenter)) / vec2(dFdx(tex.x), dFdy(tex.y)); - + vec4 result = texture(imageMap, tex) * gauss[0]; float total = gauss[0]; @@ -69,14 +69,14 @@ vec4 depthGaussian1D(sampler2D imageMap, sampler2D depthMap, vec2 tex, float zFa total += gauss[j]; } } - + direction = -direction; - } - + } + return result / total; } void main() -{ +{ out_Color = depthGaussian1D(u_ScreenImageMap, u_ScreenDepthMap, var_ScreenTex, u_ViewInfo.x, u_ViewInfo.y); } diff --git a/shared/rd-rend2/glsl/down4x.glsl b/shared/rd-rend2/glsl/down4x.glsl index 7034cb81e9..b89e7f0172 100644 --- a/shared/rd-rend2/glsl/down4x.glsl +++ b/shared/rd-rend2/glsl/down4x.glsl @@ -25,7 +25,7 @@ void main() { vec4 color; vec2 tc; - + tc = var_TexCoords + u_InvTexRes * vec2(-1.5, -1.5); color = texture(u_TextureMap, tc); tc = var_TexCoords + u_InvTexRes * vec2(-0.5, -1.5); color += texture(u_TextureMap, tc); tc = var_TexCoords + u_InvTexRes * vec2( 0.5, -1.5); color += texture(u_TextureMap, tc); @@ -45,8 +45,8 @@ void main() tc = var_TexCoords + u_InvTexRes * vec2(-0.5, 1.5); color += texture(u_TextureMap, tc); tc = var_TexCoords + u_InvTexRes * vec2( 0.5, 1.5); color += texture(u_TextureMap, tc); tc = var_TexCoords + u_InvTexRes * vec2( 1.5, 1.5); color += texture(u_TextureMap, tc); - + color *= 0.0625; - + out_Color = color; } diff --git a/shared/rd-rend2/glsl/fogpass.glsl b/shared/rd-rend2/glsl/fogpass.glsl index 633feaae54..25595c1b75 100644 --- a/shared/rd-rend2/glsl/fogpass.glsl +++ b/shared/rd-rend2/glsl/fogpass.glsl @@ -166,7 +166,7 @@ vec3 DeformNormal( const in vec3 position, const in vec3 normal ) vec3 outNormal = normal; const float scale = 0.98; - + outNormal.x += amplitude * GetNoiseValue( position.x * scale, position.y * scale, diff --git a/shared/rd-rend2/glsl/generic.glsl b/shared/rd-rend2/glsl/generic.glsl index 4958bc9ffc..c99819758a 100644 --- a/shared/rd-rend2/glsl/generic.glsl +++ b/shared/rd-rend2/glsl/generic.glsl @@ -237,7 +237,7 @@ vec3 DeformNormal( const in vec3 position, const in vec3 normal ) vec3 outNormal = normal; const float scale = 0.98; - + outNormal.x += amplitude * GetNoiseValue( position.x * scale, position.y * scale, @@ -315,7 +315,7 @@ vec2 GenTexCoords(int TCGen, vec3 position, vec3 normal, vec3 TCGenVector0, vec3 } break; } - + return tex; } #endif @@ -330,10 +330,10 @@ vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix, vec4 offTurb) st2.y = st.x * texMatrix.y + (st.y * texMatrix.w + offTurb.y); vec2 offsetPos = vec2(position.x + position.z, position.y); - + vec2 texOffset = sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(phase)); - - return st2 + texOffset * amplitude; + + return st2 + texOffset * amplitude; } #endif @@ -341,7 +341,7 @@ vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix, vec4 offTurb) vec4 CalcColor(vec3 position, vec3 normal) { vec4 color = u_VertColor * attr_Color + u_BaseColor; - + if (u_ColorGen == CGEN_LIGHTING_DIFFUSE) { float incoming = clamp(dot(normal, u_ModelLightDir), 0.0, 1.0); @@ -387,7 +387,7 @@ vec4 CalcColor(vec3 position, vec3 normal) { vec3 lightDir = normalize(vec3(-960.0, 1980.0, 96.0) - position); vec3 reflected = -reflect(lightDir, normal); - + color.a = clamp(dot(reflected, normalize(viewer)), 0.0, 1.0); color.a *= color.a; color.a *= color.a; @@ -396,7 +396,7 @@ vec4 CalcColor(vec3 position, vec3 normal) { color.a = clamp(length(viewer) / u_PortalRange, 0.0, 1.0); } - + return color; } #endif @@ -549,7 +549,7 @@ float CalcFog(in vec3 viewOrigin, in vec3 position, in Fog fog) // fogPlane is inverted in tr_bsp for some reason. float t = -(fog.plane.w + dot(viewOrigin, -fog.plane.xyz)) / dot(V, -fog.plane.xyz); - + bool intersects = (t > 0.0 && t < 0.995); if (inFog == intersects) return 0.0; diff --git a/shared/rd-rend2/glsl/lightall.glsl b/shared/rd-rend2/glsl/lightall.glsl index 685c40ef39..e06dfdbd05 100644 --- a/shared/rd-rend2/glsl/lightall.glsl +++ b/shared/rd-rend2/glsl/lightall.glsl @@ -207,7 +207,7 @@ vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix, vec4 offTurb) vec2 texOffset = sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(phase)); - return st2 + texOffset * amplitude; + return st2 + texOffset * amplitude; } #endif @@ -479,26 +479,26 @@ float random( const vec2 p ) 23.1406926327792690, // e^pi (Gelfond's constant) 2.6651441426902251); // 2^sqrt(2) (Gelfond-Schneider constant) //return fract( cos( mod( 123456789., 1e-7 + 256. * dot(p,r) ) ) ); - return mod( 123456789., 1e-7 + 256. * dot(p,r) ); + return mod( 123456789., 1e-7 + 256. * dot(p,r) ); } -const vec2 poissonDisk[16] = vec2[16]( - vec2( -0.94201624, -0.39906216 ), - vec2( 0.94558609, -0.76890725 ), - vec2( -0.094184101, -0.92938870 ), - vec2( 0.34495938, 0.29387760 ), - vec2( -0.91588581, 0.45771432 ), - vec2( -0.81544232, -0.87912464 ), - vec2( -0.38277543, 0.27676845 ), - vec2( 0.97484398, 0.75648379 ), - vec2( 0.44323325, -0.97511554 ), - vec2( 0.53742981, -0.47373420 ), - vec2( -0.26496911, -0.41893023 ), - vec2( 0.79197514, 0.19090188 ), - vec2( -0.24188840, 0.99706507 ), - vec2( -0.81409955, 0.91437590 ), - vec2( 0.19984126, 0.78641367 ), - vec2( 0.14383161, -0.14100790 ) +const vec2 poissonDisk[16] = vec2[16]( + vec2( -0.94201624, -0.39906216 ), + vec2( 0.94558609, -0.76890725 ), + vec2( -0.094184101, -0.92938870 ), + vec2( 0.34495938, 0.29387760 ), + vec2( -0.91588581, 0.45771432 ), + vec2( -0.81544232, -0.87912464 ), + vec2( -0.38277543, 0.27676845 ), + vec2( 0.97484398, 0.75648379 ), + vec2( 0.44323325, -0.97511554 ), + vec2( 0.53742981, -0.47373420 ), + vec2( -0.26496911, -0.41893023 ), + vec2( 0.79197514, 0.19090188 ), + vec2( -0.24188840, 0.99706507 ), + vec2( -0.81409955, 0.91437590 ), + vec2( 0.19984126, 0.78641367 ), + vec2( 0.14383161, -0.14100790 ) ); float PCF(const sampler2DArrayShadow shadowmap, const float layer, const vec2 st, const float dist, float PCFScale) @@ -541,7 +541,7 @@ float PCF(const sampler2DArrayShadow shadowmap, const float layer, const vec2 st } mult *= 1.0 / 17.0; #endif - + return mult; } @@ -598,7 +598,7 @@ float sunShadow(in vec3 viewOrigin, in vec3 viewDir, in vec3 biasOffset) } } } - + return result; } #endif @@ -627,10 +627,10 @@ float RayIntersectDisplaceMap(in vec2 inDp, in vec2 ds, in sampler2D normalMap, for(int i = 0; i < linearSearchSteps - 1; ++i) { depth += size; - + // height is flipped before uploaded to the gpu float t = textureGrad(normalMap, dp + ds * depth, dx, dy).r; - + if(depth >= t) { bestDepth = depth; // store best depth @@ -644,10 +644,10 @@ float RayIntersectDisplaceMap(in vec2 inDp, in vec2 ds, in sampler2D normalMap, for(int i = 0; i < binarySearchSteps; ++i) { size *= 0.5; - + // height is flipped before uploaded to the gpu float t = textureGrad(normalMap, dp + ds * depth, dx, dy).r; - + if(depth >= t) { bestDepth = depth; @@ -875,7 +875,7 @@ float pcfShadow(in sampler2DArrayShadow depthMap, in vec3 L, in float distance, { const int samples = 9; const float diskRadius = M_PI / 512.0; - + vec2 polarL = vec2(atan(L.z, L.x), acos(L.y)); float shadow = 0.0; @@ -929,7 +929,7 @@ vec3 CalcDynamicLightContribution( continue; } Light light = u_Lights[i]; - + vec3 L = light.origin.xyz - position; float sqrLightDist = dot(L, L); @@ -1083,7 +1083,7 @@ void main() float shadowValue = sunShadow(u_ViewOrigin, viewDir, normalBias) * NPL; // surfaces not facing the light are always shadowed - + //shadowValue = mix(0.0, shadowValue, dot(N, primaryLightDir) > 0.0); #if defined(SHADOWMAP_MODULATE) @@ -1130,7 +1130,7 @@ void main() specular.rgb = mix(vec3(0.08) * ORMS.w, diffuse.rgb, ORMS.z); diffuse.rgb *= vec3(1.0 - ORMS.z); - + roughness = mix(0.01, 1.0, ORMS.y); AO = min(ORMS.x, AO); #else @@ -1165,7 +1165,7 @@ void main() out_Color.rgb = lightColor * reflectance * (attenuation * NL); out_Color.rgb += ambientColor * diffuse.rgb; - + #if defined(USE_PRIMARY_LIGHT) vec3 L2 = normalize(u_PrimaryLightOrigin.xyz); vec3 H2 = normalize(L2 + E); @@ -1183,18 +1183,18 @@ void main() out_Color.rgb += lightColor * reflectance * NL2; #endif - + out_Color.rgb += CalcDynamicLightContribution(roughness, N, E, u_ViewOrigin, viewDir, NE, diffuse.rgb, specular.rgb, vertexNormal); out_Color.rgb += CalcIBLContribution(roughness, N, E, u_ViewOrigin, viewDir, NE, specular.rgb * AO); #else lightColor = var_Color.rgb; - #if defined(USE_LIGHTMAP) + #if defined(USE_LIGHTMAP) lightColor *= lightmapColor.rgb; #endif out_Color.rgb = diffuse.rgb * lightColor; #endif - + out_Color.a = diffuse.a; #if defined(USE_GLOW_BUFFER) diff --git a/shared/rd-rend2/glsl/prefilterEnvMap.glsl b/shared/rd-rend2/glsl/prefilterEnvMap.glsl index 6df85b582b..273ccf532a 100644 --- a/shared/rd-rend2/glsl/prefilterEnvMap.glsl +++ b/shared/rd-rend2/glsl/prefilterEnvMap.glsl @@ -99,12 +99,12 @@ vec3 PrefilterEnvMap( float Roughness, vec3 R ) float NH = max(dot ( N, H ), 0.0); float HV = max(dot ( H, V ), 0.0); float D = D_GGX(NH, Roughness); - float pdf = (D * NH / (4.0 * HV)) + 0.0001; + float pdf = (D * NH / (4.0 * HV)) + 0.0001; float saTexel = 4.0 * M_PI / (6.0 * CUBEMAP_RESOLUTION * CUBEMAP_RESOLUTION); float saSample = 1.0 / (float(NumSamples) * pdf + 0.0001); - float mipLevel = Roughness == 0.0 ? 0.0 : 0.5 * log2(saSample / saTexel); + float mipLevel = Roughness == 0.0 ? 0.0 : 0.5 * log2(saSample / saTexel); PrefilteredColor += textureLod(u_CubeMap, L, mipLevel).rgb * NoL; TotalWeight += NoL; @@ -119,7 +119,7 @@ void main() // from http://www.codinglabs.net/article_physically_based_rendering.aspx vec3 normal = normalize(vec3(-vector.x, -vector.y, -1.0)); - + if (cubeFace == 0) normal = normalize(vec3(1.0, -vector.y, -vector.x)); else if (cubeFace == 1) @@ -129,13 +129,13 @@ void main() else if (cubeFace == 3) normal = normalize(vec3(vector.x, -1.0, -vector.y)); else if (cubeFace == 4) - normal = normalize(vec3(vector.x, -vector.y, 1.0)); + normal = normalize(vec3(vector.x, -vector.y, 1.0)); float roughness = u_ViewInfo.w; vec3 result = PrefilterEnvMap(roughness, normal); if (roughness == 0.0) result = textureLod(u_CubeMap, normal, 0.0).rgb; - + out_Color = vec4(result, 1.0); } \ No newline at end of file diff --git a/shared/rd-rend2/glsl/refraction.glsl b/shared/rd-rend2/glsl/refraction.glsl index 7c78cdf187..473f05c74a 100644 --- a/shared/rd-rend2/glsl/refraction.glsl +++ b/shared/rd-rend2/glsl/refraction.glsl @@ -197,7 +197,7 @@ vec3 DeformNormal( const in vec3 position, const in vec3 normal ) vec3 outNormal = normal; const float scale = 0.98; - + outNormal.x += amplitude * GetNoiseValue( position.x * scale, position.y * scale, @@ -254,7 +254,7 @@ vec2 GenTexCoords(int TCGen, vec3 position, vec3 normal, vec3 TCGenVector0, vec3 { tex = vec2(dot(position, TCGenVector0), dot(position, TCGenVector1)); } - + return tex; } #endif @@ -269,10 +269,10 @@ vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix, vec4 offTurb) st2.y = st.x * texMatrix.y + (st.y * texMatrix.w + offTurb.y); vec2 offsetPos = vec2(position.x + position.z, position.y); - + vec2 texOffset = sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(phase)); - - return st2 + texOffset * amplitude; + + return st2 + texOffset * amplitude; } #endif @@ -280,7 +280,7 @@ vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix, vec4 offTurb) vec4 CalcColor(vec3 position, vec3 normal) { vec4 color = u_VertColor * attr_Color + u_BaseColor; - + if (u_ColorGen == CGEN_LIGHTING_DIFFUSE) { float incoming = clamp(dot(normal, u_ModelLightDir), 0.0, 1.0); @@ -294,7 +294,7 @@ vec4 CalcColor(vec3 position, vec3 normal) { vec3 lightDir = normalize(vec3(-960.0, 1980.0, 96.0) - position); vec3 reflected = -reflect(lightDir, normal); - + color.a = clamp(dot(reflected, normalize(viewer)), 0.0, 1.0); color.a *= color.a; color.a *= color.a; @@ -303,7 +303,7 @@ vec4 CalcColor(vec3 position, vec3 normal) { color.a = clamp(length(viewer) / u_PortalRange, 0.0, 1.0); } - + return color; } #endif @@ -398,12 +398,12 @@ void main() vec3 new_pos = (distance * refraction_vec) + ws_Position; var_RefractPosR = vec4(inverseModel * new_pos, 1.0); var_RefractPosR = MVP * var_RefractPosR; - + refraction_vec = normalize(refract(ws_ViewDir, ws_Normal, etaG)); new_pos = (distance * refraction_vec) + ws_Position; var_RefractPosG = vec4(inverseModel * new_pos, 1.0); var_RefractPosG = MVP * var_RefractPosG; - + refraction_vec = normalize(refract(ws_ViewDir, ws_Normal, etaB)); new_pos = (distance * refraction_vec) + ws_Position; var_RefractPosB = vec4(inverseModel * new_pos, 1.0); @@ -471,11 +471,11 @@ vec3 FilmicTonemap(vec3 x) const float TS = 0.20; // Toe Strength const float TAN = 0.01; // Toe Angle Numerator const float TAD = 0.30; // Toe Angle Denominator - + vec3 SSxx = SS * x * x; vec3 LSx = LS * x; vec3 LALSx = LSx * LA; - + return ((SSxx + LALSx + TS * TAN) / (SSxx + LSx + TS * TAD)) - TAN / TAD; } @@ -492,7 +492,7 @@ void main() color.a = var_Color.a; color.rgb *= var_Color.rgb; color.rgb *= u_Color.rgb; - + #if defined(USE_ALPHA_TEST) if (u_AlphaTestType == ALPHA_TEST_GT0) { @@ -520,7 +520,7 @@ void main() vec3 minAvgMax = texture(u_LevelsMap, texG).rgb; vec3 logMinAvgMaxLum = clamp(minAvgMax * 20.0 - 10.0, -u_AutoExposureMinMax.y, -u_AutoExposureMinMax.x); float avgLum = exp2(logMinAvgMaxLum.y); - + color.rgb *= u_ToneMinAvgMaxLinear.y / avgLum; color.rgb = max(vec3(0.0), color.rgb - vec3(u_ToneMinAvgMaxLinear.x)); diff --git a/shared/rd-rend2/glsl/shadowvolume.glsl b/shared/rd-rend2/glsl/shadowvolume.glsl index e0a1dcbb03..fe7d45d3c3 100644 --- a/shared/rd-rend2/glsl/shadowvolume.glsl +++ b/shared/rd-rend2/glsl/shadowvolume.glsl @@ -108,7 +108,7 @@ void main() if (dot(cross(BmA,CmA), -u_ModelLightDir.xyz) > 0.0) { vec3 L = u_ModelLightDir.xyz*u_LocalLightRadius; - + // front cap gl_Position = MVP * vec4(var_Position[0].xyz, 1.0); EmitVertex(); @@ -117,12 +117,12 @@ void main() gl_Position = MVP * vec4(var_Position[2].xyz, 1.0); EmitVertex(); EndPrimitive(); - + // sides quad(var_Position[0], var_Position[1], L, MVP); quad(var_Position[1], var_Position[2], L, MVP); quad(var_Position[2], var_Position[0], L, MVP); - + // back cap gl_Position = MVP * vec4(var_Position[2].xyz - L, 1.0); EmitVertex(); diff --git a/shared/rd-rend2/glsl/ssao.glsl b/shared/rd-rend2/glsl/ssao.glsl index 53aeb67630..10dcedadad 100644 --- a/shared/rd-rend2/glsl/ssao.glsl +++ b/shared/rd-rend2/glsl/ssao.glsl @@ -49,7 +49,7 @@ float random( const vec2 p ) 23.1406926327792690, // e^pi (Gelfond's constant) 2.6651441426902251); // 2^sqrt(2) (Gelfond-Schneider constant) //return fract( cos( mod( 123456789., 1e-7 + 256. * dot(p,r) ) ) ); - return mod( 123456789., 1e-7 + 256. * dot(p,r) ); + return mod( 123456789., 1e-7 + 256. * dot(p,r) ); } mat2 randomRotation( const vec2 p ) @@ -73,14 +73,14 @@ float ambientOcclusion(sampler2D depthMap, const vec2 tex, const float zFarDivZN float sampleZ = zFar * getLinearDepth(depthMap, tex, zFarDivZNear); vec2 expectedSlope = vec2(dFdx(sampleZ), dFdy(sampleZ)) / vec2(dFdx(tex.x), dFdy(tex.y)); - + if (length(expectedSlope) > 5000.0) return 1.0; - + vec2 offsetScale = vec2(3.0 / sampleZ); - + mat2 rmat = randomRotation(tex); - + int i; for (i = 0; i < 9; i++) { @@ -95,15 +95,15 @@ float ambientOcclusion(sampler2D depthMap, const vec2 tex, const float zFarDivZN result += step(expectedZ - 1.0, sampleZ2); } } - + result *= 0.11111; - + return result; } void main() { float result = ambientOcclusion(u_ScreenDepthMap, var_ScreenTex, u_ViewInfo.x, u_ViewInfo.y); - + out_Color = vec4(vec3(result), 1.0); } diff --git a/shared/rd-rend2/glsl/surface_sprites.glsl b/shared/rd-rend2/glsl/surface_sprites.glsl index 2b0ad2406f..653a7aec77 100644 --- a/shared/rd-rend2/glsl/surface_sprites.glsl +++ b/shared/rd-rend2/glsl/surface_sprites.glsl @@ -77,7 +77,7 @@ void main() vec3( halfWidth, halfWidth, 0.0), vec3(-halfWidth, halfWidth, 0.0), vec3(-halfWidth, -halfWidth, 0.0) -#else +#else vec3( halfWidth, 0.0, 0.0), vec3( halfWidth, 0.0, height), vec3(-halfWidth, 0.0, height), @@ -236,7 +236,7 @@ void main() #else const float alphaTestValue = 0.5; #endif - + out_Color = texture(u_DiffuseMap, var_TexCoords); out_Color.rgb *= var_Color; out_Color.a *= var_Alpha*(1.0 - alphaTestValue) + alphaTestValue; @@ -278,7 +278,7 @@ void main() discard; } #endif - + #if defined(USE_FOG) Fog fog = u_Fogs[u_FogIndex]; float fogFactor = CalcFog(u_ViewOrigin, var_WSPosition, fog); @@ -292,6 +292,6 @@ void main() #if defined(ADDITIVE_BLEND) out_Color.rgb *= out_Color.a; #endif - + out_Glow = vec4(0.0); } diff --git a/shared/rd-rend2/glsl/tonemap.glsl b/shared/rd-rend2/glsl/tonemap.glsl index 58162d7ed2..05b8ba2e63 100644 --- a/shared/rd-rend2/glsl/tonemap.glsl +++ b/shared/rd-rend2/glsl/tonemap.glsl @@ -39,11 +39,11 @@ vec3 FilmicTonemap(vec3 x) const float TS = 0.20; // Toe Strength const float TAN = 0.01; // Toe Angle Numerator const float TAD = 0.30; // Toe Angle Denominator - + vec3 SSxx = SS * x * x; vec3 LSx = LS * x; vec3 LALSx = LSx * LA; - + return ((SSxx + LALSx + TS * TAN) / (SSxx + LSx + TS * TAD)) - TAN / TAD; //return ((x*(SS*x+LA*LS)+TS*TAN)/(x*(SS*x+LS)+TS*TAD)) - TAN/TAD; @@ -96,7 +96,7 @@ void main() vec4 color = texture(u_TextureMap, var_TexCoords) * u_Color; vec3 minAvgMax = texture(u_LevelsMap, var_TexCoords).rgb; vec3 logMinAvgMaxLum = clamp(minAvgMax * 20.0 - 10.0, -u_AutoExposureMinMax.y, -u_AutoExposureMinMax.x); - + float avgLum = exp2(logMinAvgMaxLum.y); //float maxLum = exp2(logMinAvgMaxLum.z); diff --git a/shared/rd-rend2/stb_image.h b/shared/rd-rend2/stb_image.h index 52322e9919..0dcecefae9 100644 --- a/shared/rd-rend2/stb_image.h +++ b/shared/rd-rend2/stb_image.h @@ -6300,7 +6300,7 @@ static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code) g->history[idx / 4] = 1; c = &g->color_table[g->codes[code].suffix * 4]; - if (c[3] > 128) { // don't render transparent pixels; + if (c[3] > 128) { // don't render transparent pixels; p[0] = c[2]; p[1] = c[1]; p[2] = c[0]; @@ -6428,9 +6428,9 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i g->history = (stbi_uc *)stbi__malloc(g->w * g->h); if (g->out == 0) return stbi__errpuc("outofmem", "Out of memory"); - // image is treated as "tranparent" at the start - ie, nothing overwrites the current background; + // image is treated as "tranparent" at the start - ie, nothing overwrites the current background; // background colour is only used for pixels that are not rendered first frame, after that "background" - // color refers to teh color that was there the previous frame. + // color refers to teh color that was there the previous frame. memset(g->out, 0x00, 4 * g->w * g->h); memset(g->background, 0x00, 4 * g->w * g->h); // state of the background (starts transparent) memset(g->history, 0x00, g->w * g->h); // pixels that were affected previous frame @@ -6453,7 +6453,7 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i } } else if (dispose == 2) { - // restore what was changed last frame to background before that frame; + // restore what was changed last frame to background before that frame; for (pi = 0; pi < pcount; ++pi) { if (g->history[pi]) { memcpy(&g->out[pi * 4], &g->background[pi * 4], 4); @@ -6461,17 +6461,17 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i } } else { - // This is a non-disposal case eithe way, so just + // This is a non-disposal case eithe way, so just // leave the pixels as is, and they will become the new background // 1: do not dispose // 0: not specified. } - // background is what out is after the undoing of the previou frame; + // background is what out is after the undoing of the previou frame; memcpy(g->background, g->out, 4 * g->w * g->h); } - // clear my history; + // clear my history; memset(g->history, 0x00, g->w * g->h); // pixels that were affected previous frame for (;;) { @@ -6521,13 +6521,13 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i o = stbi__process_gif_raster(s, g); if (o == NULL) return NULL; - // if this was the first frame, + // if this was the first frame, pcount = g->w * g->h; if (first_frame && (g->bgindex > 0)) { // if first frame, any pixel not drawn to gets the background color for (pi = 0; pi < pcount; ++pi) { if (g->history[pi] == 0) { - g->pal[g->bgindex][3] = 255; // just in case it was made transparent, undo that; It will be reset next frame if need be; + g->pal[g->bgindex][3] = 255; // just in case it was made transparent, undo that; It will be reset next frame if need be; memcpy(&g->out[pi * 4], &g->pal[g->bgindex], 4); } } @@ -6629,12 +6629,12 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, } } while (u != 0); - // free temp buffer; + // free temp buffer; STBI_FREE(g.out); STBI_FREE(g.history); STBI_FREE(g.background); - // do the final conversion after loading everything; + // do the final conversion after loading everything; if (req_comp && req_comp != 4) out = stbi__convert_format(out, 4, req_comp, layers * g.w, g.h); @@ -6659,12 +6659,12 @@ static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req *y = g.h; // moved conversion to after successful load so that the same - // can be done for multiple frames. + // can be done for multiple frames. if (req_comp && req_comp != 4) u = stbi__convert_format(u, 4, req_comp, g.w, g.h); } - // free buffers needed for multiple frame loading; + // free buffers needed for multiple frame loading; STBI_FREE(g.history); STBI_FREE(g.background); diff --git a/shared/rd-rend2/tr_animation.cpp b/shared/rd-rend2/tr_animation.cpp index 63af468f08..fcde1de1da 100644 --- a/shared/rd-rend2/tr_animation.cpp +++ b/shared/rd-rend2/tr_animation.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA All bones should be an identity orientation to display the mesh exactly as it is specified. -For all other frames, the bones represent the transformation from the +For all other frames, the bones represent the transformation from the orientation of the bone in the base frame to the orientation in this frame. @@ -48,7 +48,7 @@ static int R_MDRCullModel( mdrHeader_t *header, trRefEntity_t *ent ) { int i, frameSize; frameSize = (size_t)( &((mdrFrame_t *)0)->bones[ header->numBones ] ); - + // compute frame pointers newFrame = ( mdrFrame_t * ) ( ( byte * ) header + header->ofsFrames + frameSize * ent->e.frame); oldFrame = ( mdrFrame_t * ) ( ( byte * ) header + header->ofsFrames + frameSize * ent->e.oldframe); @@ -62,7 +62,7 @@ static int R_MDRCullModel( mdrHeader_t *header, trRefEntity_t *ent ) { { // Ummm... yeah yeah I know we don't really have an md3 here.. but we pretend // we do. After all, the purpose of mdrs are not that different, are they? - + case CULL_OUT: tr.pc.c_sphere_cull_md3_out++; return CULL_OUT; @@ -106,7 +106,7 @@ static int R_MDRCullModel( mdrHeader_t *header, trRefEntity_t *ent ) { } } } - + // calculate a bounding box in the current coordinate system for (i = 0 ; i < 3 ; i++) { bounds[0][i] = oldFrame->bounds[0][i] < newFrame->bounds[0][i] ? oldFrame->bounds[0][i] : newFrame->bounds[0][i]; @@ -146,7 +146,7 @@ int R_MDRComputeFogNum( mdrHeader_t *header, trRefEntity_t *ent ) { if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) { return 0; } - + frameSize = (size_t)( &((mdrFrame_t *)0)->bones[ header->numBones ] ); // FIXME: non-normalized axis issues @@ -227,25 +227,25 @@ void R_MDRAddAnimSurfaces( trRefEntity_t *ent, int entityNum ) { qboolean personalModel; header = (mdrHeader_t *)tr.currentModel->data.mdr; - + personalModel = (qboolean)( (ent->e.renderfx & RF_THIRD_PERSON) && !(tr.viewParms.isPortal || (tr.viewParms.flags & VPF_DEPTHSHADOW))); - + if ( ent->e.renderfx & RF_WRAP_FRAMES ) { ent->e.frame %= header->numFrames; ent->e.oldframe %= header->numFrames; - } - + } + // // Validate the frames so there is no chance of a crash. // This will write directly into the entity structure, so // when the surfaces are rendered, they don't need to be // range checked again. // - if ((ent->e.frame >= header->numFrames) + if ((ent->e.frame >= header->numFrames) || (ent->e.frame < 0) || (ent->e.oldframe >= header->numFrames) || (ent->e.oldframe < 0) ) @@ -263,7 +263,7 @@ void R_MDRAddAnimSurfaces( trRefEntity_t *ent, int entityNum ) { cull = R_MDRCullModel (header, ent); if ( cull == CULL_OUT ) { return; - } + } // figure out the current LOD of the model we're rendering, and set the lod pointer respectively. lodnum = R_ComputeLOD(ent); @@ -288,14 +288,14 @@ void R_MDRAddAnimSurfaces( trRefEntity_t *ent, int entityNum ) { for ( i = 0 ; i < lod->numSurfaces ; i++ ) { - + if(ent->e.customShader) shader = R_GetShaderByHandle(ent->e.customShader); else if(ent->e.customSkin > 0 && ent->e.customSkin < tr.numSkins) { skin = R_GetSkinByHandle(ent->e.customSkin); shader = tr.defaultShader; - + for(j = 0; j < skin->numSurfaces; j++) { if (!strcmp(skin->surfaces[j]->name, surface->name)) @@ -361,12 +361,12 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) // don't lerp if lerping off, or this is the only frame, or the last frame... // - if (backEnd.currentEntity->e.oldframe == backEnd.currentEntity->e.frame) + if (backEnd.currentEntity->e.oldframe == backEnd.currentEntity->e.frame) { backlerp = 0; // if backlerp is 0, lerping is off and frontlerp is never used frontlerp = 1; - } - else + } + else { backlerp = backEnd.currentEntity->e.backlerp; frontlerp = 1.0f - backlerp; @@ -387,9 +387,9 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) indexes = surface->numTriangles * 3; baseIndex = tess.numIndexes; baseVertex = tess.numVertexes; - + // Set up all triangles. - for (j = 0 ; j < indexes ; j++) + for (j = 0 ; j < indexes ; j++) { tess.indexes[baseIndex + j] = baseVertex + triangles[j]; } @@ -398,16 +398,16 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) // // lerp all the needed bones // - if ( !backlerp ) + if ( !backlerp ) { // no lerping needed bonePtr = frame->bones; - } - else + } + else { bonePtr = bones; - - for ( i = 0 ; i < header->numBones*12 ; i++ ) + + for ( i = 0 ; i < header->numBones*12 ; i++ ) { ((float *)bonePtr)[i] = frontlerp * ((float *)frame->bones)[i] + backlerp * ((float *)oldFrame->bones)[i]; } @@ -418,7 +418,7 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) // numVerts = surface->numVerts; v = (mdrVertex_t *) ((byte *)surface + surface->ofsVerts); - for ( j = 0; j < numVerts; j++ ) + for ( j = 0; j < numVerts; j++ ) { vec3_t tempVert, tempNormal; mdrWeight_t *w; @@ -426,14 +426,14 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) VectorClear( tempVert ); VectorClear( tempNormal ); w = v->weights; - for ( k = 0 ; k < v->numWeights ; k++, w++ ) + for ( k = 0 ; k < v->numWeights ; k++, w++ ) { bone = bonePtr + w->boneIndex; - + tempVert[0] += w->boneWeight * ( DotProduct( bone->matrix[0], w->offset ) + bone->matrix[0][3] ); tempVert[1] += w->boneWeight * ( DotProduct( bone->matrix[1], w->offset ) + bone->matrix[1][3] ); tempVert[2] += w->boneWeight * ( DotProduct( bone->matrix[2], w->offset ) + bone->matrix[2][3] ); - + tempNormal[0] += w->boneWeight * DotProduct( bone->matrix[0], v->normal ); tempNormal[1] += w->boneWeight * DotProduct( bone->matrix[1], v->normal ); tempNormal[2] += w->boneWeight * DotProduct( bone->matrix[2], v->normal ); diff --git a/shared/rd-rend2/tr_backend.cpp b/shared/rd-rend2/tr_backend.cpp index 562ad1f325..17b3701cb2 100644 --- a/shared/rd-rend2/tr_backend.cpp +++ b/shared/rd-rend2/tr_backend.cpp @@ -130,15 +130,15 @@ void GL_Cull( int cullType ) { if ( backEnd.projection2D ) cullType = CT_TWO_SIDED; - if ( cullType == CT_TWO_SIDED ) + if ( cullType == CT_TWO_SIDED ) { if ( glState.faceCulling != CT_TWO_SIDED ) qglDisable( GL_CULL_FACE ); - } - else + } + else { qboolean cullFront = (qboolean)(cullType == CT_FRONT_SIDED); - + if ( glState.faceCulling == CT_TWO_SIDED ) qglEnable( GL_CULL_FACE ); @@ -476,14 +476,14 @@ void GL_Draw( GLenum primitiveType, int firstVertex, int numVertices, int numIns void GL_SetProjectionMatrix(matrix_t matrix) { Matrix16Copy(matrix, glState.projection); - Matrix16Multiply(glState.projection, glState.modelview, glState.modelviewProjection); + Matrix16Multiply(glState.projection, glState.modelview, glState.modelviewProjection); } void GL_SetModelviewMatrix(matrix_t matrix) { Matrix16Copy(matrix, glState.modelview); - Matrix16Multiply(glState.projection, glState.modelview, glState.modelviewProjection); + Matrix16Multiply(glState.projection, glState.modelview, glState.modelviewProjection); } @@ -505,18 +505,18 @@ static void SetViewportAndScissor( void ) { GL_SetProjectionMatrix( backEnd.viewParms.projectionMatrix ); // set the window clipping - qglViewport( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, + qglViewport( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight ); if ( !backEnd.viewParms.scissorX && !backEnd.viewParms.scissorY && !backEnd.viewParms.scissorWidth && !backEnd.viewParms.scissorHeight ) { - qglScissor( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, + qglScissor( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY, backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight ); } else { - qglScissor( backEnd.viewParms.scissorX, backEnd.viewParms.scissorY, + qglScissor( backEnd.viewParms.scissorX, backEnd.viewParms.scissorY, backEnd.viewParms.scissorWidth, backEnd.viewParms.scissorHeight ); } } @@ -599,7 +599,7 @@ void RB_BeginDrawingView (void) { (!(backEnd.refdef.rdflags & RDF_NOWORLDMODEL))) { if (tr.world && tr.world->globalFog) - { + { const fog_t *fog = tr.world->globalFog; clearBits |= GL_COLOR_BUFFER_BIT; @@ -1121,7 +1121,7 @@ static void RB_DrawItems( drawItem.draw.params.indexed.numIndices, drawItem.draw.params.indexed.indexType, drawItem.draw.params.indexed.firstIndex, - drawItem.draw.numInstances, + drawItem.draw.numInstances, drawItem.draw.params.indexed.baseVertex); break; } @@ -1623,7 +1623,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte * VectorSet2(texCoords[3], 0.5f / cols, (rows - 0.5f) / rows); GLSL_BindProgram(&tr.textureColorShader); - + GLSL_SetUniformMatrix4x4(&tr.textureColorShader, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformVec4(&tr.textureColorShader, UNIFORM_COLOR, colorWhite); @@ -1642,7 +1642,7 @@ void RE_UploadCinematic (int cols, int rows, const byte *data, int client, qbool qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); } else { if (dirty) { // otherwise, just subimage upload it so that drivers can tell we are going to be changing @@ -1759,7 +1759,7 @@ static const void *RB_StretchPic ( const void *data ) { RB_DrawRotatePic ============= */ -static const void *RB_RotatePic ( const void *data ) +static const void *RB_RotatePic ( const void *data ) { const rotatePicCommand_t *cmd; shader_t *shader; @@ -1852,7 +1852,7 @@ static const void *RB_RotatePic ( const void *data ) RB_DrawRotatePic2 ============= */ -static const void *RB_RotatePic2 ( const void *data ) +static const void *RB_RotatePic2 ( const void *data ) { const rotatePicCommand_t *cmd; shader_t *shader; @@ -2154,7 +2154,7 @@ static void RB_RenderMainPass( drawSurf_t *drawSurfs, int numDrawSurfs ) { FBO_t *oldFbo = glState.currentFBO; FBO_Bind(tr.sunRaysFbo); - + qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); qglClear( GL_COLOR_BUFFER_BIT ); @@ -2529,7 +2529,7 @@ void RB_AddShaderToShaderInstanceUBO(shader_t *shader) shader->ShaderInstanceUboOffset = -1; return; } - + ShaderInstanceBlock shaderInstanceBlock = {}; ComputeDeformValues( shader, @@ -2713,7 +2713,7 @@ static const void *RB_ColorMask(const void *data) backEnd.colorMask[3] = (qboolean)(!cmd->rgba[3]); qglColorMask(cmd->rgba[0], cmd->rgba[1], cmd->rgba[2], cmd->rgba[3]); - + return (const void *)(cmd + 1); } @@ -2726,7 +2726,7 @@ RB_ClearDepth static const void *RB_ClearDepth(const void *data) { const clearDepthCommand_t *cmd = (clearDepthCommand_t *)data; - + // finish any 2D drawing if needed if(tess.numIndexes) RB_EndSurface(); @@ -2753,7 +2753,7 @@ static const void *RB_ClearDepth(const void *data) qglClear(GL_DEPTH_BUFFER_BIT); } - + return (const void *)(cmd + 1); } diff --git a/shared/rd-rend2/tr_cache.cpp b/shared/rd-rend2/tr_cache.cpp index df62c616e6..76e74e1252 100644 --- a/shared/rd-rend2/tr_cache.cpp +++ b/shared/rd-rend2/tr_cache.cpp @@ -38,7 +38,7 @@ CModelCacheManager::FileCache::iterator CModelCacheManager::FindFile( const char }); } -static const byte FakeGLAFile[] = +static const byte FakeGLAFile[] = { 0x32, 0x4C, 0x47, 0x41, 0x06, 0x00, 0x00, 0x00, 0x2A, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -86,7 +86,7 @@ qboolean CModelCacheManager::LoadFile( const char *pFileName, void **ppFileBuffe memcpy(pvFakeGLAFile, &FakeGLAFile[0], sizeof (FakeGLAFile)); *ppFileBuffer = pvFakeGLAFile; - return qtrue; + return qtrue; } int len = ri.FS_ReadFile(path, ppFileBuffer); @@ -203,7 +203,7 @@ void CModelCacheManager::DumpNonPure( void ) } } - ri.Printf( PRINT_DEVELOPER, "CCacheManager::DumpNonPure(): Ok\n"); + ri.Printf( PRINT_DEVELOPER, "CCacheManager::DumpNonPure(): Ok\n"); } CModelCacheManager::AssetCache::iterator CModelCacheManager::FindAsset( const char *path ) @@ -270,7 +270,7 @@ qboolean CModelCacheManager::LevelLoadEnd( qboolean deleteUnusedByLevel ) } } - ri.Printf( PRINT_DEVELOPER, S_COLOR_GREEN "CModelCacheManager::LevelLoadEnd(): Ok\n"); + ri.Printf( PRINT_DEVELOPER, S_COLOR_GREEN "CModelCacheManager::LevelLoadEnd(): Ok\n"); return bAtLeastOneModelFreed; } @@ -310,7 +310,7 @@ void CModelCacheManager::StoreShaderRequest( const char *psModelFileName, const assert(0); return; } - + int iNameOffset = psShaderName - (char *)file->pDiskImage; int iPokeOffset = (char*) piShaderIndexPoke - (char *)file->pDiskImage; @@ -343,9 +343,9 @@ void CModelCacheManager::AllocateShaders( const char *psFileName ) int *piShaderPokePtr = (int *)((char*)file->pDiskImage + shader.pokeOffset); shader_t *sh = R_FindShader(psShaderName, lightmapsNone, stylesDefault, qtrue); - if ( sh->defaultShader ) + if ( sh->defaultShader ) *piShaderPokePtr = 0; - else + else *piShaderPokePtr = sh->index; } } diff --git a/shared/rd-rend2/tr_cmds.cpp b/shared/rd-rend2/tr_cmds.cpp index d10e620691..4cfd012d49 100644 --- a/shared/rd-rend2/tr_cmds.cpp +++ b/shared/rd-rend2/tr_cmds.cpp @@ -41,32 +41,32 @@ void R_PerformanceCounters( void ) { if (r_speeds->integer == 1) { ri.Printf (PRINT_ALL, "%i/%i/%i shaders/batches/surfs %i leafs %i verts %i/%i tris %.2f mtex %.2f dc\n", - backEnd.pc.c_shaders, backEnd.pc.c_surfBatches, backEnd.pc.c_surfaces, tr.pc.c_leafs, backEnd.pc.c_vertexes, - backEnd.pc.c_indexes/3, backEnd.pc.c_totalIndexes/3, - R_SumOfUsedImages()/(1000000.0f), backEnd.pc.c_overDraw / (float)(glConfig.vidWidth * glConfig.vidHeight) ); + backEnd.pc.c_shaders, backEnd.pc.c_surfBatches, backEnd.pc.c_surfaces, tr.pc.c_leafs, backEnd.pc.c_vertexes, + backEnd.pc.c_indexes/3, backEnd.pc.c_totalIndexes/3, + R_SumOfUsedImages()/(1000000.0f), backEnd.pc.c_overDraw / (float)(glConfig.vidWidth * glConfig.vidHeight) ); } else if (r_speeds->integer == 2) { ri.Printf (PRINT_ALL, "(patch) %i sin %i sclip %i sout %i bin %i bclip %i bout\n", - tr.pc.c_sphere_cull_patch_in, tr.pc.c_sphere_cull_patch_clip, tr.pc.c_sphere_cull_patch_out, + tr.pc.c_sphere_cull_patch_in, tr.pc.c_sphere_cull_patch_clip, tr.pc.c_sphere_cull_patch_out, tr.pc.c_box_cull_patch_in, tr.pc.c_box_cull_patch_clip, tr.pc.c_box_cull_patch_out ); ri.Printf (PRINT_ALL, "(md3) %i sin %i sclip %i sout %i bin %i bclip %i bout\n", - tr.pc.c_sphere_cull_md3_in, tr.pc.c_sphere_cull_md3_clip, tr.pc.c_sphere_cull_md3_out, + tr.pc.c_sphere_cull_md3_in, tr.pc.c_sphere_cull_md3_clip, tr.pc.c_sphere_cull_md3_out, tr.pc.c_box_cull_md3_in, tr.pc.c_box_cull_md3_clip, tr.pc.c_box_cull_md3_out ); } else if (r_speeds->integer == 3) { ri.Printf (PRINT_ALL, "viewcluster: %i\n", tr.viewCluster ); } else if (r_speeds->integer == 4) { if ( backEnd.pc.c_dlightVertexes ) { - ri.Printf (PRINT_ALL, "dlight srf:%i culled:%i verts:%i tris:%i\n", + ri.Printf (PRINT_ALL, "dlight srf:%i culled:%i verts:%i tris:%i\n", tr.pc.c_dlightSurfaces, tr.pc.c_dlightSurfacesCulled, backEnd.pc.c_dlightVertexes, backEnd.pc.c_dlightIndexes / 3 ); } - } + } else if (r_speeds->integer == 5 ) { ri.Printf( PRINT_ALL, "zFar: %.0f\n", tr.viewParms.zFar ); } else if (r_speeds->integer == 6 ) { - ri.Printf( PRINT_ALL, "flare adds:%i tests:%i renders:%i\n", + ri.Printf( PRINT_ALL, "flare adds:%i tests:%i renders:%i\n", backEnd.pc.c_flareAdds, backEnd.pc.c_flareTests, backEnd.pc.c_flareRenders ); } else if (r_speeds->integer == 7 ) @@ -245,7 +245,7 @@ R_AddConvolveCubemapsCmd */ void R_AddConvolveCubemapCmd( cubemap_t *cubemap , int cubemapId ) { convolveCubemapCommand_t *cmd; - + if (!tr.registered) { return; } @@ -254,7 +254,7 @@ void R_AddConvolveCubemapCmd( cubemap_t *cubemap , int cubemapId ) { return; } cmd->commandId = RC_CONVOLVECUBEMAP; - + cmd->cubemap = cubemap; cmd->cubemapId = cubemapId; } @@ -363,7 +363,7 @@ void RE_SetColor( const float *rgba ) { RE_RotatePic ============= */ -void RE_RotatePic ( float x, float y, float w, float h, +void RE_RotatePic ( float x, float y, float w, float h, float s1, float t1, float s2, float t2,float a, qhandle_t hShader ) { rotatePicCommand_t *cmd; @@ -392,7 +392,7 @@ void RE_RotatePic ( float x, float y, float w, float h, RE_RotatePic2 ============= */ -void RE_RotatePic2 ( float x, float y, float w, float h, +void RE_RotatePic2 ( float x, float y, float w, float h, float s1, float t1, float s2, float t2,float a, qhandle_t hShader ) { rotatePicCommand_t *cmd; @@ -421,7 +421,7 @@ void RE_RotatePic2 ( float x, float y, float w, float h, RE_StretchPic ============= */ -void RE_StretchPic ( float x, float y, float w, float h, +void RE_StretchPic ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { stretchPicCommand_t *cmd; @@ -453,17 +453,17 @@ void RE_StretchPic ( float x, float y, float w, float h, void R_SetColorMode(GLboolean *rgba, stereoFrame_t stereoFrame, int colormode) { rgba[0] = rgba[1] = rgba[2] = rgba[3] = GL_TRUE; - + if(colormode > MODE_MAX) { if(stereoFrame == STEREO_LEFT) stereoFrame = STEREO_RIGHT; else if(stereoFrame == STEREO_RIGHT) stereoFrame = STEREO_LEFT; - + colormode -= MODE_MAX; } - + if(colormode == MODE_GREEN_MAGENTA) { if(stereoFrame == STEREO_LEFT) @@ -478,7 +478,7 @@ void R_SetColorMode(GLboolean *rgba, stereoFrame_t stereoFrame, int colormode) else if(stereoFrame == STEREO_RIGHT) { rgba[0] = GL_FALSE; - + if(colormode == MODE_RED_BLUE) rgba[1] = GL_FALSE; else if(colormode == MODE_RED_GREEN) @@ -672,9 +672,9 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) { if (glConfig.stereoEnabled) { if( !(cmd = (drawBufferCommand_t *)R_GetCommandBuffer(sizeof(*cmd))) ) return; - + cmd->commandId = RC_DRAW_BUFFER; - + if ( stereoFrame == STEREO_LEFT ) { cmd->buffer = (int)GL_BACK_LEFT; } else if ( stereoFrame == STEREO_RIGHT ) { @@ -696,7 +696,7 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) { backEnd.colorMask[2] = qfalse; backEnd.colorMask[3] = qfalse; qglClearColor(0.0f, 0.0f, 0.0f, 1.0f); - + // clear all framebuffers if (tr.msaaResolveFbo) { @@ -719,19 +719,19 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) { r_anaglyphMode->modified = qfalse; } - + if(stereoFrame == STEREO_LEFT) { if( !(cmd = (drawBufferCommand_t *)R_GetCommandBuffer(sizeof(*cmd))) ) return; - + if( !(colcmd = (colorMaskCommand_t *)R_GetCommandBuffer(sizeof(*colcmd))) ) return; } else if(stereoFrame == STEREO_RIGHT) { clearDepthCommand_t *cldcmd; - + if( !(cldcmd = (clearDepthCommand_t *)R_GetCommandBuffer(sizeof(*cldcmd))) ) return; @@ -775,7 +775,7 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) { cmd->buffer = (int)GL_BACK; } } - + tr.refdef.stereoFrame = stereoFrame; } diff --git a/shared/rd-rend2/tr_decals.cpp b/shared/rd-rend2/tr_decals.cpp index fe6a7d7f99..87fd5e3097 100644 --- a/shared/rd-rend2/tr_decals.cpp +++ b/shared/rd-rend2/tr_decals.cpp @@ -3,7 +3,7 @@ #define MAX_VERTS_ON_DECAL_POLY 10 #define MAX_DECAL_POLYS 500 -typedef struct decalPoly_s +typedef struct decalPoly_s { int time; int fadetime; @@ -49,7 +49,7 @@ void R_InitDecals( void ) { void RE_FreeDecal( int type, int index ) { if ( !re_decalPolys[type][index].time ) return; - + if ( type == DECALPOLY_TYPE_NORMAL ) { decalPoly_t* fade; @@ -75,7 +75,7 @@ Will allways succeed, even if it requires freeing an old active mark */ decalPoly_t* RE_AllocDecal( int type ) { decalPoly_t *le; - + // See if the cvar changed if ( re_decalPolyTotal[type] > r_markcount->integer ) RE_ClearDecals(); @@ -85,9 +85,9 @@ decalPoly_t* RE_AllocDecal( int type ) { // If it has no time its the first occasion its been used if ( le->time ) { if ( le->time != tr.refdef.time ) { - int i = re_decalPolyHead[type]; + int i = re_decalPolyHead[type]; - // since we are killing one that existed before, make sure we + // since we are killing one that existed before, make sure we // kill all the other marks that belong to the group do { i++; @@ -99,7 +99,7 @@ decalPoly_t* RE_AllocDecal( int type ) { break; RE_FreeDecal ( type, i ); - } while ( i != re_decalPolyHead[type] ); + } while ( i != re_decalPolyHead[type] ); RE_FreeDecal( type, re_decalPolyHead[type] ); } @@ -151,7 +151,7 @@ void RE_AddDecalToScene( qhandle_t decalShader, const vec3_t origin, const vec3_ if ( r_markcount->integer <= 0 && !temporary ) return; - if ( radius <= 0 ) + if ( radius <= 0 ) Com_Error( ERR_FATAL, "RE_AddDecalToScene: called with <= 0 radius" ); // create the texture axis @@ -163,7 +163,7 @@ void RE_AddDecalToScene( qhandle_t decalShader, const vec3_t origin, const vec3_ texCoordScale = 0.5 * 1.0 / radius; // create the full polygon - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0 ; i < 3 ; i++ ) { originalPoints[0][i] = origin[i] - radius * axis[1][i] - radius * axis[2][i]; originalPoints[1][i] = origin[i] + radius * axis[1][i] - radius * axis[2][i]; @@ -182,7 +182,7 @@ void RE_AddDecalToScene( qhandle_t decalShader, const vec3_t origin, const vec3_ colors[2] = blue * 255; colors[3] = alpha * 255; - for ( i = 0, mf = markFragments ; i < numFragments ; i++, mf++ ) + for ( i = 0, mf = markFragments ; i < numFragments ; i++, mf++ ) { polyVert_t *v; polyVert_t verts[MAX_VERTS_ON_DECAL_POLY]; @@ -193,7 +193,7 @@ void RE_AddDecalToScene( qhandle_t decalShader, const vec3_t origin, const vec3_ if ( mf->numPoints > MAX_VERTS_ON_DECAL_POLY ) mf->numPoints = MAX_VERTS_ON_DECAL_POLY; - for ( j = 0, v = verts ; j < mf->numPoints ; j++, v++ ) + for ( j = 0, v = verts ; j < mf->numPoints ; j++, v++ ) { vec3_t delta; @@ -207,7 +207,7 @@ void RE_AddDecalToScene( qhandle_t decalShader, const vec3_t origin, const vec3_ } // if it is a temporary (shadow) mark, add it immediately and forget about it - if ( temporary ) + if ( temporary ) { RE_AddPolyToScene( decalShader, mf->numPoints, verts ); continue; @@ -231,7 +231,7 @@ void RE_AddDecalToScene( qhandle_t decalShader, const vec3_t origin, const vec3_ R_AddDecals =============== */ -void R_AddDecals( void ) +void R_AddDecals( void ) { int decalPoly; int type; @@ -256,21 +256,21 @@ void R_AddDecals( void ) decalPoly_t* p = &re_decalPolys[type][decalPoly]; if ( p->time ) - { + { if ( p->fadetime ) { int t; // fade all marks out with time t = tr.refdef.time - p->time; - if ( t < DECAL_FADE_TIME ) + if ( t < DECAL_FADE_TIME ) { float fade; int j; fade = 255.0f * (1.0f - ((float)t / DECAL_FADE_TIME)); - - for ( j = 0 ; j < p->poly.numVerts ; j++ ) + + for ( j = 0 ; j < p->poly.numVerts ; j++ ) { p->verts[j].modulate[3] = fade; } diff --git a/shared/rd-rend2/tr_extensions.cpp b/shared/rd-rend2/tr_extensions.cpp index 55bf6c9ffe..83190a3425 100644 --- a/shared/rd-rend2/tr_extensions.cpp +++ b/shared/rd-rend2/tr_extensions.cpp @@ -337,7 +337,7 @@ void GLimp_InitCoreFunctions() GetGLFunction (qglVertexAttrib2f, "glVertexAttrib2f", qtrue); GetGLFunction (qglVertexAttrib3f, "glVertexAttrib3f", qtrue); GetGLFunction (qglVertexAttrib4f, "glVertexAttrib4f", qtrue); - + // Buffer objects qglGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &glRefConfig.uniformBufferOffsetAlignment); qglGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &glRefConfig.maxUniformBlockSize); @@ -518,7 +518,7 @@ void GLimp_InitCoreFunctions() GetGLFunction (qglDeleteSync, "glDeleteSync", qtrue); GetGLFunction (qglClientWaitSync, "glClientWaitSync", qtrue); GetGLFunction (qglWaitSync, "glWaitSync", qtrue); - + } void GLW_InitTextureCompression( void ); @@ -606,7 +606,7 @@ void GLimp_InitExtensions() if( GLimp_HaveExtension( extension ) ) { qboolean loaded = qtrue; - + loaded = (qboolean)(loaded && GetGLFunction (qglTexStorage3D, "glTexStorage3D", qfalse)); loaded = (qboolean)(loaded && GetGLFunction (qglTexStorage1D, "glTexStorage1D", qfalse)); loaded = (qboolean)(loaded && GetGLFunction (qglTexStorage2D, "glTexStorage2D", qfalse)); @@ -626,7 +626,7 @@ void GLimp_InitExtensions() if( GLimp_HaveExtension( extension ) ) { qboolean loaded = qtrue; - + if ( r_arb_buffer_storage->integer ) { loaded = (qboolean)(loaded && GetGLFunction (qglBufferStorage, "glBufferStorage", qfalse)); diff --git a/shared/rd-rend2/tr_extramath.cpp b/shared/rd-rend2/tr_extramath.cpp index 76cf7c5cb5..09b8015d45 100644 --- a/shared/rd-rend2/tr_extramath.cpp +++ b/shared/rd-rend2/tr_extramath.cpp @@ -44,10 +44,10 @@ void Matrix16Identity( matrix_t out ) void Matrix16Copy( const matrix_t in, matrix_t out ) { - out[ 0] = in[ 0]; out[ 4] = in[ 4]; out[ 8] = in[ 8]; out[12] = in[12]; - out[ 1] = in[ 1]; out[ 5] = in[ 5]; out[ 9] = in[ 9]; out[13] = in[13]; - out[ 2] = in[ 2]; out[ 6] = in[ 6]; out[10] = in[10]; out[14] = in[14]; - out[ 3] = in[ 3]; out[ 7] = in[ 7]; out[11] = in[11]; out[15] = in[15]; + out[ 0] = in[ 0]; out[ 4] = in[ 4]; out[ 8] = in[ 8]; out[12] = in[12]; + out[ 1] = in[ 1]; out[ 5] = in[ 5]; out[ 9] = in[ 9]; out[13] = in[13]; + out[ 2] = in[ 2]; out[ 6] = in[ 6]; out[10] = in[10]; out[14] = in[14]; + out[ 3] = in[ 3]; out[ 7] = in[ 7]; out[11] = in[11]; out[15] = in[15]; } void Matrix16Multiply( const matrix_t in1, const matrix_t in2, matrix_t out ) @@ -140,7 +140,7 @@ void Matrix16SimpleInverse( const matrix_t in, matrix_t out) { vec3_t v; float invSqrLen; - + VectorCopy(in + 0, v); invSqrLen = 1.0f / DotProduct(v, v); VectorScale(v, invSqrLen, v); out[ 0] = v[0]; out[ 4] = v[1]; out[ 8] = v[2]; out[12] = -DotProduct(v, &in[12]); @@ -167,7 +167,7 @@ qboolean SpheresIntersect(vec3_t origin1, float radius1, vec3_t origin2, float r { float radiusSum = radius1 + radius2; vec3_t diff; - + VectorSubtract(origin1, origin2, diff); if (DotProduct(diff, diff) <= radiusSum * radiusSum) @@ -202,7 +202,7 @@ int NextPowerOfTwo(int in) unsigned short FloatToHalf(float in) { unsigned short out; - + union { float f; diff --git a/shared/rd-rend2/tr_fbo.cpp b/shared/rd-rend2/tr_fbo.cpp index 80a395ed49..f7eb79857c 100644 --- a/shared/rd-rend2/tr_fbo.cpp +++ b/shared/rd-rend2/tr_fbo.cpp @@ -344,7 +344,7 @@ void FBO_Bind(FBO_t * fbo) { if (glState.currentFBO == fbo) return; - + if (r_logFile->integer) { // don't just call LogComment, or we will get a call to va() every frame! @@ -415,7 +415,7 @@ void FBO_Init(void) { ri.Cvar_SetValue("r_ext_framebuffer_multisample", (float)multisample); } - + // only create a render FBO if we need to resolve MSAA or do HDR // otherwise just render straight to the screen (tr.renderFbo = NULL) if (multisample) @@ -844,7 +844,7 @@ void FBO_BlitFromTexture(struct image_s *src, vec4i_t inSrcBox, vec2_t inSrcTexS GL_State( blend ); GLSL_BindProgram(shaderProgram); - + GLSL_SetUniformMatrix4x4(shaderProgram, UNIFORM_MODELVIEWPROJECTIONMATRIX, projection); GLSL_SetUniformVec4(shaderProgram, UNIFORM_COLOR, color); GLSL_SetUniformVec2(shaderProgram, UNIFORM_INVTEXRES, invTexRes); diff --git a/shared/rd-rend2/tr_flares.cpp b/shared/rd-rend2/tr_flares.cpp index be6d4120e1..3a4637d81a 100644 --- a/shared/rd-rend2/tr_flares.cpp +++ b/shared/rd-rend2/tr_flares.cpp @@ -185,7 +185,7 @@ void RB_AddFlare( void *surface, int fogNum, vec3_t point, vec3_t color, vec3_t // fade the intensity of the flare down as the // light surface turns away from the viewer - VectorScale( f->color, d, f->color ); + VectorScale( f->color, d, f->color ); // save info needed to test f->windowX = backEnd.viewParms.viewportX + window[0]; @@ -217,7 +217,7 @@ void RB_AddDlightFlares( void ) { if(fog) { - // find which fog volume the light is in + // find which fog volume the light is in for ( j = 1 ; j < tr.world->numfogs ; j++ ) { fog = &tr.world->fogs[j]; for ( k = 0 ; k < 3 ; k++ ) { @@ -279,7 +279,7 @@ void RB_TestFlare( flare_t *f ) { FBO_Bind(oldFbo); } - screenZ = backEnd.viewParms.projectionMatrix[14] / + screenZ = backEnd.viewParms.projectionMatrix[14] / ( ( 2*depth - 1 ) * backEnd.viewParms.projectionMatrix[11] - backEnd.viewParms.projectionMatrix[10] ); visible = (qboolean)(( -f->eyeZ - -screenZ ) < 24); @@ -291,7 +291,7 @@ void RB_TestFlare( flare_t *f ) { } fade = ( ( backEnd.refdef.time - f->fadeTime ) / 500.0f ); } else { - // Dont fade out when flare is occluded. Will result in the ability to see + // Dont fade out when flare is occluded. Will result in the ability to see // flares through surfaces on high movement speeds /*if ( f->visible ) { f->visible = qfalse; diff --git a/shared/rd-rend2/tr_ghoul2.cpp b/shared/rd-rend2/tr_ghoul2.cpp index 2b7ddf24c9..28397c38b8 100644 --- a/shared/rd-rend2/tr_ghoul2.cpp +++ b/shared/rd-rend2/tr_ghoul2.cpp @@ -1,4 +1,4 @@ -#include "client/client.h" //FIXME!! EVIL - just include the definitions needed +#include "client/client.h" //FIXME!! EVIL - just include the definitions needed #include "tr_local.h" #include "qcommon/matcomp.h" #include "qcommon/qcommon.h" @@ -121,8 +121,8 @@ qboolean G2_SetupModelPointers(CGhoul2Info_v &ghoul2); extern cvar_t *r_Ghoul2AnimSmooth; extern cvar_t *r_Ghoul2UnSqashAfterSmooth; -static const mdxaBone_t identityMatrix = -{ +static const mdxaBone_t identityMatrix = +{ { { 0.0f, -1.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f }, @@ -170,7 +170,7 @@ void Mat3x4_Multiply(mdxaBone_t *out, const mdxaBone_t *in2, const mdxaBone_t *i const float m21 = in->matrix[2][1]; const float m22 = in->matrix[2][2]; const float m23 = in->matrix[2][3]; - + // first row of out out->matrix[0][0] = (n00 * m00) + (n01 * m10) + (n02 * m20); out->matrix[0][1] = (n00 * m01) + (n01 * m11) + (n02 * m21); @@ -275,7 +275,7 @@ class CConstructBoneList int *boneUsedList; surfaceInfo_v &rootSList; model_t *currentModel; - boneInfo_v &boneList; + boneInfo_v &boneList; CConstructBoneList( int initsurfaceNum, @@ -398,9 +398,9 @@ class CBoneCache } public: - int frameSize; - const mdxaHeader_t *header; - const model_t *mod; + int frameSize; + const mdxaHeader_t *header; + const model_t *mod; // these are split for better cpu cache behavior std::vector mBones; @@ -413,7 +413,7 @@ class CBoneCache int mCurrentTouch; int mCurrentTouchRender; - int mLastTouch; + int mLastTouch; int mLastLastTouch; // for render smoothing @@ -443,7 +443,7 @@ class CBoneCache { assert(amod); assert(aheader); - + Com_Memset(boneMatrices, 0, sizeof(boneMatrices)); int numBones = header->numBones; @@ -868,7 +868,7 @@ class CRenderSurface All bones should be an identity orientation to display the mesh exactly as it is specified. -For all other frames, the bones represent the transformation from the +For all other frames, the bones represent the transformation from the orientation of the bone in the base frame to the orientation in this frame. @@ -898,7 +898,7 @@ static int R_GCullModel( trRefEntity_t *ent ) { largestScale = 1; } - // cull bounding sphere + // cull bounding sphere switch ( R_CullLocalPointAndRadius( vec3_origin, ent->e.radius * largestScale) ) { case CULL_OUT: @@ -976,7 +976,7 @@ static int R_GComputeFogNum( trRefEntity_t *ent ) { // return i; // break; //} - //else + //else if (!partialFog) {//first partialFog partialFog = i; @@ -988,7 +988,7 @@ static int R_GComputeFogNum( trRefEntity_t *ent ) { } // work out lod for this entity. -static int G2_ComputeLOD( trRefEntity_t *ent, const model_t *currentModel, int lodBias ) +static int G2_ComputeLOD( trRefEntity_t *ent, const model_t *currentModel, int lodBias ) { float flod, lodscale; float projectedRadius; @@ -999,7 +999,7 @@ static int G2_ComputeLOD( trRefEntity_t *ent, const model_t *currentModel, int l return(0); } - if ( r_lodbias->integer > lodBias ) + if ( r_lodbias->integer > lodBias ) { lodBias = r_lodbias->integer; } @@ -1024,12 +1024,12 @@ static int G2_ComputeLOD( trRefEntity_t *ent, const model_t *currentModel, int l // we reduce the radius to make the LOD match other model types which use // the actual bound box size - if ( projectedRadius != 0 ) + if ( projectedRadius != 0 ) { lodscale = (r_lodscale->value+r_autolodscalevalue->value); - if ( lodscale > 20 ) + if ( lodscale > 20 ) { - lodscale = 20; + lodscale = 20; } else if ( lodscale < 0 ) { @@ -1056,7 +1056,7 @@ static int G2_ComputeLOD( trRefEntity_t *ent, const model_t *currentModel, int l lod += lodBias; - + if ( lod >= currentModel->numLods ) lod = currentModel->numLods - 1; if ( lod < 0 ) @@ -1095,15 +1095,15 @@ void G2_CreateQuaterion(mdxaBone_t *mat, vec4_t quat) // Depending on this, calculate the following: if ( mat->matrix[0][0] > mat->matrix[1][1] && mat->matrix[0][0] > mat->matrix[2][2] ) { - // Column 0: + // Column 0: s = sqrt( 1.0 + mat->matrix[0][0] - mat->matrix[1][1] - mat->matrix[2][2])* 2; quat[0] = 0.25 * s; quat[1] = (mat->matrix[0][1] + mat->matrix[1][0] ) / s; quat[2] = (mat->matrix[2][0] + mat->matrix[0][2] ) / s; quat[3] = (mat->matrix[1][2] - mat->matrix[2][1] ) / s; - + } else if ( mat->matrix[1][1] > mat->matrix[2][2] ) { - // Column 1: + // Column 1: s = sqrt( 1.0 + mat->matrix[1][1] - mat->matrix[0][0] - mat->matrix[2][2] ) * 2; quat[0] = (mat->matrix[0][1] + mat->matrix[1][0] ) / s; quat[1] = 0.25 * s; @@ -1195,7 +1195,7 @@ void G2_TimingModel( time = (bone.pauseTime - bone.startTime) / 50.0f; } else - { + { time = (currentTime - bone.startTime) / 50.0f; } @@ -1209,7 +1209,7 @@ void G2_TimingModel( if ( numFramesInAnim != 0 ) { // did we run off the end? - if ( (animSpeed > 0.0f && newLerpFrame > (endFrame - 1)) || + if ( (animSpeed > 0.0f && newLerpFrame > (endFrame - 1)) || (animSpeed < 0.0f && newLerpFrame < (endFrame + 1)) ) { // yep - decide what to do @@ -1348,7 +1348,7 @@ void G2_TimingModel( if (newFrame >= (int)endFrame) { // we only want to lerp with the first frame of the anim if - // we are looping + // we are looping if (bone.flags & BONE_ANIM_OVERRIDE_LOOP) { newFrame = bone.startFrame; @@ -1381,7 +1381,7 @@ void G2_TimingModel( if (newFrame < endFrame+1) { // we only want to lerp with the first frame of the - // anim if we are looping + // anim if we are looping if (bone.flags & BONE_ANIM_OVERRIDE_LOOP) { newFrame = bone.startFrame; @@ -1510,7 +1510,7 @@ void G2_RagGetAnimMatrix( boneInfo_t &pbone = ghoul2.mBlist[parentBlistIndex]; // this should have been calc'd in the recursive call - assert(pbone.hasAnimFrameMatrix == frame); + assert(pbone.hasAnimFrameMatrix == frame); Mat3x4_Multiply(&bone.animFrameMatrix, &pbone.animFrameMatrix, &animMatrix); @@ -1572,7 +1572,7 @@ static void G2_TransformBone( int child, CBoneCache& BC ) // we found a bone in the list - we need to override something here. boneInfo_t& bone = boneList[boneListIndex]; int boneFlags = bone.flags; - + // do we override the rotational angles? if ( boneFlags & BONE_ANGLES_TOTAL ) { @@ -1721,7 +1721,7 @@ static void G2_TransformBone( int child, CBoneCache& BC ) assert(child >=0 && child < BC.header->numBones); // decide where the transformed bone is going - + // lerp this bone - use the temp space on the ref entity to put the bone // transforms into if ( !TB.backlerp ) @@ -1733,7 +1733,7 @@ static void G2_TransformBone( int child, CBoneCache& BC ) mdxaBone_t newFrameBone; mdxaBone_t currentFrameBone; UnCompressBone(newFrameBone.matrix, child, BC.header, TB.newFrame); - UnCompressBone(currentFrameBone.matrix, child, BC.header, TB.currentFrame); + UnCompressBone(currentFrameBone.matrix, child, BC.header, TB.currentFrame); Mat3x4_Lerp(¤tBone, &newFrameBone, ¤tFrameBone, TB.backlerp); } @@ -1785,8 +1785,8 @@ static void G2_TransformBone( int child, CBoneCache& BC ) // are doing post mults to compensate. mdxaBone_t temp = firstPass * skel->BasePoseMat; const float matrixScale = VectorLength((float*)&temp); - mdxaBone_t toMatrix = - { + mdxaBone_t toMatrix = + { { { 1.0f, 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f }, @@ -1975,7 +1975,7 @@ static void G2_TransformGhoulBones( #endif } ghoul2.mBoneCache->mod=currentModel; - ghoul2.mBoneCache->header=aHeader; + ghoul2.mBoneCache->header=aHeader; assert(ghoul2.mBoneCache->mBones.size()==(unsigned)aHeader->numBones); ghoul2.mBoneCache->mSmoothingActive=false; @@ -2074,7 +2074,7 @@ static void G2_TransformGhoulBones( //====================================================================== // -// Surface Manipulation code +// Surface Manipulation code #ifndef REND2_SP // We've come across a surface that's designated as a bolt surface, process it and put it in the appropriate bolt place @@ -2409,27 +2409,27 @@ void RenderSurfaces( CRenderSurface &RS, const trRefEntity_t *ent, int entityNum // if this surface is not off, add it to the shader render list if (!offFlags) { - if ( RS.cust_shader ) + if ( RS.cust_shader ) { shader = RS.cust_shader; - } - else if ( RS.skin ) + } + else if ( RS.skin ) { int j; - + // match the surface name to something in the skin file shader = R_GetShaderByHandle(surfInfo->shaderIndex); for ( j = 0 ; j < RS.skin->numSurfaces ; j++ ) { // the names have both been lowercased - if ( !strcmp( RS.skin->surfaces[j]->name, surfInfo->name ) ) + if ( !strcmp( RS.skin->surfaces[j]->name, surfInfo->name ) ) { shader = (shader_t*)RS.skin->surfaces[j]->shader; break; } } - } - else + } + else { shader = R_GetShaderByHandle( surfInfo->shaderIndex ); } @@ -2443,7 +2443,7 @@ void RenderSurfaces( CRenderSurface &RS, const trRefEntity_t *ent, int entityNum int cubemapIndex = R_CubemapForPoint(ent->e.origin); // don't add third_person objects if not viewing through a portal - if ( !RS.personalModel ) + if ( !RS.personalModel ) { // set the surface info to point at the where the transformed bone // list is going to be for when the surface gets rendered out @@ -2575,7 +2575,7 @@ void RenderSurfaces( CRenderSurface &RS, const trRefEntity_t *ent, int entityNum R_AddDrawSurf((surfaceType_t *)newSurf, entityNum, tr.projectionShadowShader, 0, qfalse, qfalse, 0); } } - + // if we are turning off all descendants, then stop this recursion now if (offFlags & G2SURFACEFLAG_NODESCENDANTS) { @@ -2642,7 +2642,7 @@ void ProcessModelBoltSurfaces( G2_ProcessSurfaceBolt(bonePtr, surface, boltNum, boltList, surfOverride, currentModel); } } - + // if we are turning off all descendants, then stop this recursion now if (offFlags & G2SURFACEFLAG_NODESCENDANTS) { @@ -2722,14 +2722,14 @@ void G2_ConstructUsedBoneList(CConstructBoneList &CBL) } // now we need to ensure that the parents of this bone are actually active... - // + // int iParentBone = skel->parent; while (iParentBone != -1) - { + { if (CBL.boneUsedList[iParentBone]) // no need to go higher break; CBL.boneUsedList[iParentBone] = 1; - skel = (mdxaSkel_t *)((byte *)mdxa + sizeof(mdxaHeader_t) + offsets->offsets[iParentBone]); + skel = (mdxaSkel_t *)((byte *)mdxa + sizeof(mdxaHeader_t) + offsets->offsets[iParentBone]); iParentBone = skel->parent; } } @@ -2897,13 +2897,13 @@ void G2_ProcessSurfaceBolt2( const mdxmTriangle_t *originalTriangleIndexes = (mdxmTriangle_t *)((byte*)originalSurf + originalSurf->ofsTriangles); - // get the original polys indexes + // get the original polys indexes const int index0 = originalTriangleIndexes[polyNumber].indexes[0]; const int index1 = originalTriangleIndexes[polyNumber].indexes[1]; const int index2 = originalTriangleIndexes[polyNumber].indexes[2]; // decide where the original verts are - const mdxmVertex_t *surfVerts = + const mdxmVertex_t *surfVerts = (mdxmVertex_t *)((byte *)originalSurf + originalSurf->ofsVerts); const mdxmVertex_t *verts[3] = { surfVerts + index0, @@ -2924,7 +2924,7 @@ void G2_ProcessSurfaceBolt2( // was hit originally const int iNumWeights = G2_GetVertWeights(verts[i]); float fTotalWeight = 0.0f; - for ( int k = 0 ; k < iNumWeights ; k++ ) + for ( int k = 0 ; k < iNumWeights ; k++ ) { const int iBoneIndex = G2_GetVertBoneIndex(verts[i], k); const float fBoneWeight = G2_GetVertBoneWeight( @@ -2999,13 +2999,13 @@ void G2_ProcessSurfaceBolt2( (const mdxmVertex_t *)((byte *)surface + surface->ofsVerts); const int *piBoneReferences = (const int*)((byte *)surface + surface->ofsBoneReferences); - for ( int j = 0; j < 3; j++ ) + for ( int j = 0; j < 3; j++ ) { VectorClear(pTri[j]); const int iNumWeights = G2_GetVertWeights( v ); float fTotalWeight = 0.0f; - for ( int k = 0 ; k < iNumWeights ; k++) + for ( int k = 0 ; k < iNumWeights ; k++) { const int iBoneIndex = G2_GetVertBoneIndex(v, k); const float fBoneWeight = @@ -3019,7 +3019,7 @@ void G2_ProcessSurfaceBolt2( pTri[j][2] += fBoneWeight * (DotProduct(bone.matrix[2], v->vertCoords) + bone.matrix[2][3]); } - + v++; } @@ -3168,7 +3168,7 @@ static void RootMatrix( mdxaBone_t bolt; mdxaBone_t tempMatrix; - G2_ConstructGhoulSkeleton(ghoul2, time, false, scale); + G2_ConstructGhoulSkeleton(ghoul2, time, false, scale); G2_GetBoltMatrixLow(ghoul2[i], ghoul2[i].mNewOrigin, scale, bolt); tempMatrix.matrix[0][0] = 1.0f; @@ -3230,7 +3230,7 @@ void R_AddGhoulSurfaces( trRefEntity_t *ent, int entityNum ) // cull the entire model if merged bounding box of both frames is outside // the view frustum. int cull = R_GCullModel(ent); - if ( cull == CULL_OUT ) + if ( cull == CULL_OUT ) { return; } @@ -3271,7 +3271,7 @@ void R_AddGhoulSurfaces( trRefEntity_t *ent, int entityNum ) { continue; } - + if ( (g2Info.mFlags & (GHOUL2_NOMODEL | GHOUL2_NORENDER)) != 0 ) { continue; @@ -3296,17 +3296,14 @@ void R_AddGhoulSurfaces( trRefEntity_t *ent, int entityNum ) } else #endif - if (ent->e.customSkin) - { - skin = R_GetSkinByHandle(ent->e.customSkin); - } - else if (g2Info.mSkin > 0 && g2Info.mSkin < tr.numSkins) - { - skin = R_GetSkinByHandle(g2Info.mSkin); - } - } - - int whichLod = G2_ComputeLOD( ent, g2Info.currentModel, g2Info.mLodBias ); + if (ent->e.customSkin) { + skin = R_GetSkinByHandle(ent->e.customSkin); + } else if (g2Info.mSkin > 0 && g2Info.mSkin < tr.numSkins) { + skin = R_GetSkinByHandle(g2Info.mSkin); + } + } + + int whichLod = G2_ComputeLOD( ent, g2Info.currentModel, g2Info.mLodBias ); G2_FindOverrideSurface(-1, g2Info.mSlist); //reset the quick surface override lookup; #ifdef _G2_GORE @@ -3462,7 +3459,7 @@ void G2_ConstructGhoulSkeleton( #ifdef G2_PERFORMANCE_ANALYSIS G2Time_G2_ConstructGhoulSkeleton += G2PerformanceTimer_G2_ConstructGhoulSkeleton.End(); #endif -} +} static inline float G2_GetVertBoneWeightNotSlow( const mdxmVertex_t *pVert, const int iWeightNum) { @@ -3601,7 +3598,7 @@ void RB_FillBoneBlock(CRenderableSurface *surf, mat3x4_t *outMatrices) sizeof(surf->boneCache->boneMatrices)); } -void RB_SurfaceGhoul( CRenderableSurface *surf ) +void RB_SurfaceGhoul( CRenderableSurface *surf ) { mdxmVBOMesh_t *surface = surf->vboMesh; @@ -3656,8 +3653,8 @@ void RB_SurfaceGhoul( CRenderableSurface *surf ) lFade = Q_ftol(254.4f*(surf->fade - 2.0f)); if (lFade < tess.svars.colors[tess.firstIndex][0]) { //don't set it unless the fade is less than the current r value (to avoid brightening suddenly before we start fading) - tess.svars.colors[tess.firstIndex][0] = - tess.svars.colors[tess.firstIndex][1] = + tess.svars.colors[tess.firstIndex][0] = + tess.svars.colors[tess.firstIndex][1] = tess.svars.colors[tess.firstIndex][2] = lFade; } tess.svars.colors[tess.firstIndex][3] = lFade; @@ -3762,7 +3759,7 @@ void RB_SurfaceGhoul( CRenderableSurface *surf ) glState.skeletalAnimation = qtrue; } - + /* ================= R_LoadMDXM - load a Ghoul 2 Mesh file @@ -4133,11 +4130,11 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & int version; int size; mdxmSurfHierarchy_t *surfInfo; - + pinmodel= (mdxmHeader_t *)buffer; // // read some fields from the binary, but only LittleLong() them when we know this wasn't an already-cached model... - // + // version = (pinmodel->version); size = (pinmodel->ofsEnd); @@ -4154,8 +4151,8 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & } mod->type = MOD_MDXM; - mod->dataSize += size; - + mod->dataSize += size; + qboolean bAlreadyFound = qfalse; mdxm = (mdxmHeader_t*)CModelCache->Allocate(size, buffer, mod_name, &bAlreadyFound, TAG_MODEL_GLM); mod->data.glm = (mdxmData_t *)Hunk_Alloc(sizeof (mdxmData_t), h_low); @@ -4185,7 +4182,7 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & LL(mdxm->ofsSurfHierarchy); LL(mdxm->ofsEnd); } - + // first up, go load in the animation file we need that has the skeletal // animation info for this model mdxm->animIndex = RE_RegisterModel(va("%s.gla", mdxm->animName)); @@ -4217,7 +4214,7 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & #endif - if (!mdxm->animIndex) + if (!mdxm->animIndex) { Com_Printf (S_COLOR_YELLOW "R_LoadMDXM: missing animation file %s for mesh %s\n", mdxm->animName, mdxm->name); return qfalse; @@ -4233,7 +4230,7 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & } #endif surfInfo = (mdxmSurfHierarchy_t *)( (byte *)mdxm + mdxm->ofsSurfHierarchy); - for ( i = 0 ; i < mdxm->numSurfaces ; i++) + for ( i = 0 ; i < mdxm->numSurfaces ; i++) { LL(surfInfo->numChildren); LL(surfInfo->parentIndex); @@ -4260,7 +4257,7 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & // get the shader name sh = R_FindShader( surfInfo->shader, lightmapsNone, stylesDefault, qtrue ); // insert it in the surface list - if ( sh->defaultShader ) + if ( sh->defaultShader ) { surfInfo->shaderIndex = 0; } @@ -4269,12 +4266,12 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & surfInfo->shaderIndex = sh->index; } - CModelCache->StoreShaderRequest(mod_name, &surfInfo->shader[0], &surfInfo->shaderIndex); + CModelCache->StoreShaderRequest(mod_name, &surfInfo->shader[0], &surfInfo->shaderIndex); // find the next surface surfInfo = (mdxmSurfHierarchy_t *)((byte *)surfInfo + offsetof(mdxmSurfHierarchy_t, childIndexes) + sizeof(int) * surfInfo->numChildren); } - + // swap all the LOD's (we need to do the middle part of this even for intel, because of shader reg and err-check) lod = (mdxmLOD_t *) ( (byte *)mdxm + mdxm->ofsLODs ); for ( l = 0 ; l < mdxm->numLODs ; l++) @@ -4284,7 +4281,7 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & LL(lod->ofsEnd); // swap all the surfaces surf = (mdxmSurface_t *) ( (byte *)lod + sizeof (mdxmLOD_t) + (mdxm->numSurfaces * sizeof(mdxmLODSurfOffset_t)) ); - for ( i = 0 ; i < mdxm->numSurfaces ; i++) + for ( i = 0 ; i < mdxm->numSurfaces ; i++) { LL(surf->numTriangles); LL(surf->ofsTriangles); @@ -4314,7 +4311,7 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & SHADER_MAX_INDEXES / 3, surf->numTriangles); } - + // change to surface identifier surf->ident = SF_MDX; // register the shaders @@ -4322,7 +4319,7 @@ qboolean R_LoadMDXM(model_t *mod, void *buffer, const char *mod_name, qboolean & if (isAnOldModelFile) { int *boneRef = (int *) ( (byte *)surf + surf->ofsBoneReferences ); - for ( j = 0 ; j < surf->numBoneReferences ; j++ ) + for ( j = 0 ; j < surf->numBoneReferences ; j++ ) { if (boneRef[j] >= 0 && boneRef[j] < 72) { @@ -4871,7 +4868,7 @@ qboolean R_LoadMDXA(model_t *mod, void *buffer, const char *mod_name, qboolean & int childNumber = (NUM_ROOTPARENTS + NUM_OTHERPARENTS); // Allocate us some extra space so we can shift memory down. - size += (childNumber * (CHILD_PADDING * 8)); + size += (childNumber * (CHILD_PADDING * 8)); #endif // CREATE_LIMB_HIERARCHY mdxa = (mdxaHeader_t *)CModelCache->Allocate( @@ -4879,7 +4876,7 @@ qboolean R_LoadMDXA(model_t *mod, void *buffer, const char *mod_name, qboolean & mod->data.gla = mdxa; // I should probably eliminate 'bAlreadyFound', but wtf? - assert(bAlreadyCached == bAlreadyFound); + assert(bAlreadyCached == bAlreadyFound); if (!bAlreadyFound) { @@ -4951,7 +4948,7 @@ qboolean R_LoadMDXA(model_t *mod, void *buffer, const char *mod_name, qboolean & ShiftMemoryDown(offsets, mdxa, i, &sizeMarker); boneInfo = (mdxaSkel_t *) - ((byte *)mdxa + sizeof(mdxaHeader_t) + offsets->offsets[i]); + ((byte *)mdxa + sizeof(mdxaHeader_t) + offsets->offsets[i]); int newChild = BoneParentChildIndex(mdxa, offsets, boneInfo, qtrue); if (newChild != -1) diff --git a/shared/rd-rend2/tr_glsl.cpp b/shared/rd-rend2/tr_glsl.cpp index a22ded1e12..8dc21f498e 100644 --- a/shared/rd-rend2/tr_glsl.cpp +++ b/shared/rd-rend2/tr_glsl.cpp @@ -339,7 +339,7 @@ static size_t GLSL_GetShaderHeader( Q_strcat(dest, size, va("#define ALPHA_TEST_GT0 %d\n" - "#define ALPHA_TEST_LT128 %d\n" + "#define ALPHA_TEST_LT128 %d\n" "#define ALPHA_TEST_GE128 %d\n" "#define ALPHA_TEST_GE192 %d\n", ALPHA_TEST_GT0, @@ -506,7 +506,7 @@ static size_t GLSL_LoadGPUShaderSource( { ri.FS_FreeFile(buffer); } - + return result; } @@ -728,7 +728,7 @@ bool ShaderProgramBuilder::AddShader( const GPUShaderDesc& shaderDesc, const cha { shaderSource.resize(shaderSource.size() * 2); } - + ++attempts; } @@ -828,7 +828,7 @@ void GLSL_InitUniforms(shaderProgram_t *program) uniforms[i] = qglGetUniformLocation(program->program, uniformsInfo[i].name); if (uniforms[i] == -1) continue; - + program->uniformBufferOffsets[i] = size; switch(uniformsInfo[i].type) { @@ -1097,7 +1097,7 @@ void GLSL_SetUniformFloat(shaderProgram_t *program, int uniformNum, GLfloat valu } *compare = value; - + qglUniform1f(uniforms[uniformNum], value); } @@ -1405,7 +1405,7 @@ static const GPUProgramDesc *LoadProgramSource( const char *programName, Allocator& allocator, const GPUProgramDesc& fallback ) { const GPUProgramDesc *result = &fallback; - + if ( r_externalGLSL->integer ) { char *buffer; @@ -1555,7 +1555,7 @@ static int GLSL_LoadGPUProgramFogPass( qglUseProgram(0); GLSL_FinishGPUShader(&tr.fogShader[i]); - + ++numPrograms; } @@ -1795,7 +1795,7 @@ static int GLSL_LoadGPUProgramLightAll( qglUseProgram(0); GLSL_FinishGPUShader(&tr.lightallShader[i]); - + ++numPrograms; } @@ -1895,7 +1895,7 @@ static int GLSL_LoadGPUProgramPShadow( qglUseProgram(0); GLSL_FinishGPUShader(&tr.pshadowShader); - + return 1; } @@ -1943,7 +1943,7 @@ static int GLSL_LoadGPUProgramDownscale4x( qglUseProgram(0); GLSL_FinishGPUShader(&tr.down4xShader); - + return 1; } @@ -1965,7 +1965,7 @@ static int GLSL_LoadGPUProgramBokeh( qglUseProgram(0); GLSL_FinishGPUShader(&tr.bokehShader); - + return 1; } @@ -2036,7 +2036,7 @@ static int GLSL_LoadGPUProgramCalcLuminanceLevel( qglUseProgram(0); GLSL_FinishGPUShader(&tr.calclevels4xShader[i]); - + ++numPrograms; } @@ -2243,7 +2243,7 @@ static int GLSL_LoadGPUProgramSurfaceSprites( if (i & SSDEF_ADDITIVE) Q_strcat(extradefines, sizeof(extradefines), "#define ADDITIVE_BLEND\n"); - + shaderProgram_t *program = tr.spriteShader + i; if (!GLSL_LoadGPUShader(builder, program, "surface_sprites", attribs, NO_XFB_VARS, extradefines, *programDesc)) @@ -2355,7 +2355,7 @@ void GLSL_LoadGPUShaders() Allocator allocator(512 * 1024); ShaderProgramBuilder builder; - + int numGenShaders = 0; int numLightShaders = 0; int numEtcShaders = 0; @@ -2380,8 +2380,8 @@ void GLSL_LoadGPUShaders() numEtcShaders += GLSL_LoadGPUProgramSurfaceSprites(builder, allocator); numEtcShaders += GLSL_LoadGPUProgramWeather(builder, allocator); - ri.Printf(PRINT_ALL, "loaded %i GLSL shaders (%i gen %i light %i etc) in %5.2f seconds\n", - numGenShaders + numLightShaders + numEtcShaders, numGenShaders, numLightShaders, + ri.Printf(PRINT_ALL, "loaded %i GLSL shaders (%i gen %i light %i etc) in %5.2f seconds\n", + numGenShaders + numLightShaders + numEtcShaders, numGenShaders, numLightShaders, numEtcShaders, (ri.Milliseconds() - startTime) / 1000.0); } @@ -2610,7 +2610,7 @@ shaderProgram_t *GLSL_GetGenericShaderProgram(int stage) break; } - if (tess.fogNum && + if (tess.fogNum && pStage->adjustColorsForFog != ACFF_NONE && r_drawfog->integer) shaderAttribs |= GENERICDEF_USE_FOG; diff --git a/shared/rd-rend2/tr_image.cpp b/shared/rd-rend2/tr_image.cpp index 5b7d59be54..cc706be7c6 100644 --- a/shared/rd-rend2/tr_image.cpp +++ b/shared/rd-rend2/tr_image.cpp @@ -132,7 +132,7 @@ void GL_TextureMode( const char *string ) { gl_filter_min = modes[i].minimize; gl_filter_max = modes[i].maximize; - + if ( r_ext_texture_filter_anisotropic->value > glConfig.maxTextureFilterAnisotropy ) { ri.Cvar_SetValue ("r_ext_texture_filter_anisotropic", glConfig.maxTextureFilterAnisotropy); @@ -145,7 +145,7 @@ void GL_TextureMode( const char *string ) { GL_Bind (glt); qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); - + if ( r_ext_texture_filter_anisotropic->value > 0.0f ) { if ( glConfig.maxTextureFilterAnisotropy > 1.0f ) @@ -299,7 +299,7 @@ void R_ImageList_f( void ) { if (image->flags & IMGFLAG_MIPMAP) estSize += estSize / 2; - float printSize = GetReadableSize(estSize, &sizeSuffix); + float printSize = GetReadableSize(estSize, &sizeSuffix); ri.Printf(PRINT_ALL, "%4i: %4ix%4i %s %7.2f%s %s\n", i, image->uploadWidth, image->uploadHeight, format, printSize, sizeSuffix, image->imgName); estTotalSize += estSize; @@ -323,11 +323,11 @@ Used to resample images in a more general than quartering fashion. This will only be filtered properly if the resampled size is greater than half the original size. -If a larger shrinking is needed, use the mipmap function +If a larger shrinking is needed, use the mipmap function before or after. ================ */ -static void ResampleTexture( byte *in, int inwidth, int inheight, byte *out, +static void ResampleTexture( byte *in, int inwidth, int inheight, byte *out, int outwidth, int outheight ) { int i, j; byte *inrow, *inrow2; @@ -337,7 +337,7 @@ static void ResampleTexture( byte *in, int inwidth, int inheight, byte *out, if (outwidth>2048) ri.Error(ERR_DROP, "ResampleTexture: max width"); - + fracstep = inwidth*0x10000/outwidth; frac = fracstep>>2; @@ -557,7 +557,7 @@ static void DoFCBI(byte *in, byte *out, int width, int height, int component) inbyte += 8; } } - + for (y = 3; y < height - 3; y += 2) { // diagonals @@ -707,7 +707,7 @@ static void DoFCBI(byte *in, byte *out, int width, int height, int component) inbyte += 8; } } - + for (y = 2; y < height - 3; y++) { // horizontal & vertical @@ -747,7 +747,7 @@ static void DoFCBI(byte *in, byte *out, int width, int height, int component) //x = (y + 1) % 2; x = (y + 1) % 2 + 2; - + // optimization one // SAMPLE2(sa, x-1, y-2); //SAMPLE2(sc, x-2, y-1); SAMPLE2(sd, x, y-1); @@ -804,7 +804,7 @@ static void DoFCBI(byte *in, byte *out, int width, int height, int component) sj = *line4; line4 += 8; sl = *line5; line5 += 8; - hp = sf + sg; + hp = sf + sg; vp = sd + si; hd = abs(sf - sg); vd = abs(sd - si); @@ -828,7 +828,7 @@ static void DoFCBI(byte *in, byte *out, int width, int height, int component) if (hdd > vdd) *outbyte = hp >> 1; - else + else *outbyte = vp >> 1; } @@ -920,7 +920,7 @@ static void DoFCBIQuick(byte *in, byte *out, int width, int height, int componen inbyte += 8; } } - + for (y = 2; y < height - 3; y++) { byte sd, sf, sg, si; @@ -943,8 +943,8 @@ static void DoFCBIQuick(byte *in, byte *out, int width, int height, int componen sd = *line2; line2 += 8; sg = *line3; line3 += 8; si = *line4; line4 += 8; - - hp = sf + sg; + + hp = sf + sg; vp = sd + si; hd = abs(sf - sg); vd = abs(sd - si); @@ -1005,7 +1005,7 @@ static void DoLinear(byte *in, byte *out, int width, int height) COPYSAMPLE(si, line3); line3 += 8; for (i = 0; i < 4; i++) - { + { *outbyte++ = (sd[i] + si[i] + se[i] + sh[i]) >> 2; } @@ -1031,7 +1031,7 @@ static void DoLinear(byte *in, byte *out, int width, int height) inbyte += 8; } } - + for (y = 1; y < height - 1; y++) { byte sd[4], sf[4], sg[4], si[4]; @@ -1169,7 +1169,7 @@ static void FCBIByBlock(byte *data, int width, int height, qboolean clampToEdge, } outbyte = workdata + y2 * fullworkwidth * 4; - inbyte = data + srcy * width * 4; + inbyte = data + srcy * width * 4; for (x2 = 0; x2 < fullworkwidth; x2 += 2) { @@ -1328,7 +1328,7 @@ static void R_MipMap2( byte *in, int inWidth, int inHeight ) { for ( j = 0 ; j < outWidth ; j++ ) { outpix = (byte *) ( temp + i * outWidth + j ); for ( k = 0 ; k < 4 ; k++ ) { - total = + total = 1 * (&in[ 4*(((i*2-1)&inHeightMask)*inWidth + ((j*2-1)&inWidthMask)) ])[k] + 2 * (&in[ 4*(((i*2-1)&inHeightMask)*inWidth + ((j*2 )&inWidthMask)) ])[k] + 2 * (&in[ 4*(((i*2-1)&inHeightMask)*inWidth + ((j*2+1)&inWidthMask)) ])[k] + @@ -1435,8 +1435,8 @@ static void R_MipMapLuminanceAlpha (const byte *in, byte *out, int width, int he if ( width == 0 || height == 0 ) { width += height; // get largest for (i=0 ; i> 1; out[3] = (in[3] + in[7]) >> 1; } @@ -1445,8 +1445,8 @@ static void R_MipMapLuminanceAlpha (const byte *in, byte *out, int width, int he for (i=0 ; i> 2; out[3] = (in[3] + in[7] + in[row+3] + in[row+7]) >> 2; } @@ -1472,7 +1472,7 @@ static void R_MipMapNormalHeight (const byte *in, byte *out, int width, int heig row = width * 4; width >>= 1; height >>= 1; - + for (i=0 ; iinteger && scaled_height > height ) scaled_height >>= 1; - if ( picmip && data && resampledBuffer && r_imageUpsample->integer && + if ( picmip && data && resampledBuffer && r_imageUpsample->integer && scaled_width < r_imageUpsampleMaxSize->integer && scaled_height < r_imageUpsampleMaxSize->integer) { int finalwidth, finalheight; @@ -1730,7 +1730,7 @@ static qboolean RawImage_HasAlpha(const byte *scan, int numPixels) for ( i = 0; i < numPixels; i++ ) { - if ( scan[i*4 + 3] != 255 ) + if ( scan[i*4 + 3] != 255 ) { return qtrue; } @@ -2017,7 +2017,7 @@ static void RawImage_UploadTexture( byte *data, int x, int y, int width, int hei // the data is NULL. All levels have already been allocated by glTexStorage2D. int miplevel = 0; - + while (width > 1 || height > 1) { if (data) @@ -2042,7 +2042,7 @@ static void RawImage_UploadTexture( byte *data, int x, int y, int width, int hei R_MipMap( data, width, height ); } } - + width >>= 1; height >>= 1; if (width < 1) @@ -2110,7 +2110,7 @@ static void Upload32( byte *data, int width, int height, imgType_t type, int fla // c = width*height; scan = data; - + if( r_greyscale->integer ) { for ( i = 0; i < c; i++ ) @@ -2152,7 +2152,7 @@ static void Upload32( byte *data, int width, int height, imgType_t type, int fla } // copy or resample data as appropriate for first MIP level - if ( ( scaled_width == width ) && + if ( ( scaled_width == width ) && ( scaled_height == height ) ) { if (!(flags & IMGFLAG_MIPMAP)) { @@ -2492,7 +2492,7 @@ R_Create2DImageArray This is the only way any 2d array sampler image_t are created ================ */ -image_t *R_Create2DImageArray(const char *name, byte *pic, int width, int height, int layers, imgType_t type, int flags, int internalFormat) +image_t *R_Create2DImageArray(const char *name, byte *pic, int width, int height, int layers, imgType_t type, int flags, int internalFormat) { image_t *image; long hash; @@ -2547,7 +2547,7 @@ image_t *R_Create2DImageArray(const char *name, byte *pic, int width, int height case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - + qglTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); qglTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); if (flags & IMGLFAG_SHADOWCOMP) @@ -2613,10 +2613,10 @@ void R_UpdateSubImage( image_t *image, byte *pic, int x, int y, int width, int h scaledBuffer = (byte *)Hunk_AllocateTempMemory( sizeof( unsigned ) * scaled_width * scaled_height ); GL_SelectTexture( image->TMU ); - GL_Bind(image); + GL_Bind(image); // copy or resample data as appropriate for first MIP level - if ( ( scaled_width == width ) && + if ( ( scaled_width == width ) && ( scaled_height == height ) ) { if (!(image->flags & IMGFLAG_MIPMAP)) { @@ -2670,7 +2670,7 @@ void R_UpdateSubImage( image_t *image, byte *pic, int x, int y, int width, int h RawImage_UploadTexture( (byte *)data, scaled_x, scaled_y, scaled_width, scaled_height, image->internalFormat, image->type, image->flags, qtrue ); done: - + GL_SelectTexture( 0 ); GL_CheckErrors(); @@ -2733,7 +2733,7 @@ void R_LoadPackedMaterialImage(shaderStage_t *stage, const char *packedImageName image = R_GetLoadedImage(packedName, flags); if (image != NULL) { - // Don't scale occlusion, roughness and metalness + // Don't scale occlusion, roughness and metalness stage->specularScale[0] = stage->specularScale[2] = stage->specularScale[3] = 1.0f; @@ -2748,12 +2748,12 @@ void R_LoadPackedMaterialImage(shaderStage_t *stage, const char *packedImageName return; } - // Don't scale occlusion, roughness and metalness + // Don't scale occlusion, roughness and metalness stage->specularScale[0] = stage->specularScale[2] = stage->specularScale[3] = 1.0f; stage->specularScale[1] = baseSpecularScale; - + GLint swizzle[4] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA }; switch (stage->specularType) @@ -2826,7 +2826,7 @@ image_t *R_BuildSDRSpecGlossImage(shaderStage_t *stage, const char *specImageNam currentColor[1] = ByteToFloat(specPic[i + 1]); currentColor[2] = ByteToFloat(specPic[i + 2]); - float ratio = + float ratio = (sRGBtoRGB(currentColor[0]) + sRGBtoRGB(currentColor[1]) + sRGBtoRGB(currentColor[1])) / (currentColor[0] + currentColor[1] + currentColor[2]); @@ -2846,26 +2846,26 @@ static void R_CreateNormalMap ( const char *name, byte *pic, int width, int heig image_t *normalImage; int normalWidth, normalHeight; int normalFlags; - + normalFlags = (flags & ~(IMGFLAG_GENNORMALMAP | IMGFLAG_SRGB)) | IMGFLAG_NOLIGHTSCALE; - + COM_StripExtension(name, normalName, sizeof(normalName)); Q_strcat(normalName, sizeof(normalName), "_n"); - + // find normalmap in case it's there normalImage = R_FindImageFile(normalName, IMGTYPE_NORMAL, normalFlags); - + // if not, generate it if (normalImage == NULL) { byte *normalPic; int x, y; - + normalWidth = width; normalHeight = height; normalPic = (byte *)R_Malloc(width * height * 4, TAG_GENERAL); RGBAtoNormal(pic, normalPic, width, height, (qboolean)(flags & IMGFLAG_CLAMPTOEDGE)); - + #if 1 // Brighten up the original image to work with the normal map RGBAtoYCoCgA(pic, pic, width, height); @@ -2886,44 +2886,44 @@ static void R_CreateNormalMap ( const char *name, byte *pic, int width, int heig // Blur original image's luma to work with the normal map { byte *blurPic; - + RGBAtoYCoCgA(pic, pic, width, height); blurPic = ri.Malloc(width * height); - + for (y = 1; y < height - 1; y++) { byte *picbyte = pic + y * width * 4; byte *blurbyte = blurPic + y * width; - + picbyte += 4; blurbyte += 1; - + for (x = 1; x < width - 1; x++) { int result; - + result = *(picbyte - (width + 1) * 4) + *(picbyte - width * 4) + *(picbyte - (width - 1) * 4) + *(picbyte - 1 * 4) + *(picbyte ) + *(picbyte + 1 * 4) + *(picbyte + (width - 1) * 4) + *(picbyte + width * 4) + *(picbyte + (width + 1) * 4); - + result /= 9; - + *blurbyte = result; picbyte += 4; blurbyte += 1; } } - + // FIXME: do borders - + for (y = 1; y < height - 1; y++) { byte *picbyte = pic + y * width * 4; byte *blurbyte = blurPic + y * width; - + picbyte += 4; blurbyte += 1; - + for (x = 1; x < width - 1; x++) { picbyte[0] = *blurbyte; @@ -2931,13 +2931,13 @@ static void R_CreateNormalMap ( const char *name, byte *pic, int width, int heig blurbyte += 1; } } - + ri.Free(blurPic); - + YCoCgAtoRGBA(pic, pic, width, height); } #endif - + R_CreateImage( normalName, normalPic, normalWidth, normalHeight, IMGTYPE_NORMAL, normalFlags, 0 ); Z_Free( normalPic ); } @@ -2979,7 +2979,7 @@ image_t *R_FindImageFile( const char *name, imgType_t type, int flags ) { R_LoadImage(name, &pic, &width, &height); } - else + else { for (int i = 0; i < width*height; i++) { @@ -3030,7 +3030,7 @@ image_t *R_FindImageFile( const char *name, imgType_t type, int flags ) image = R_CreateImage( name, pic, width, height, type, loadFlags, internalFormat); Z_Free( pic ); - + return image; } @@ -3070,10 +3070,10 @@ static void R_CreateDlightImage( void ) { } else if ( b < 75 ) { b = 0; } - data[y][x][0] = - data[y][x][1] = + data[y][x][0] = + data[y][x][1] = data[y][x][2] = b; - data[y][x][3] = 255; + data[y][x][3] = 255; } } tr.dlightImage = R_CreateImage("*dlight", (byte *)data, DLIGHT_SIZE, DLIGHT_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, 0 ); @@ -3090,7 +3090,7 @@ void R_InitFogTable( void ) { int i; float d; float exp; - + exp = 0.5; for ( i = 0 ; i < FOG_TABLE_SIZE ; i++ ) { @@ -3155,8 +3155,8 @@ static void R_CreateFogImage( void ) { for (y=0 ; yinteger == 4) { tr.pshadowArrayImage = R_Create2DImageArray( - va("*pshadowmapArray"), - NULL, + va("*pshadowmapArray"), + NULL, PSHADOW_MAP_SIZE, - PSHADOW_MAP_SIZE, - MAX_DRAWN_PSHADOWS, + PSHADOW_MAP_SIZE, + MAX_DRAWN_PSHADOWS, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE | IMGLFAG_SHADOWCOMP | IMGFLAG_MUTABLE, GL_DEPTH_COMPONENT16); @@ -3525,10 +3525,10 @@ void R_CreateBuiltinImages( void ) { hdrFormat); tr.renderCubeDepthImage = R_CreateImage( - "*renderdepth", NULL, CUBE_MAP_SIZE, CUBE_MAP_SIZE, + "*renderdepth", NULL, CUBE_MAP_SIZE, CUBE_MAP_SIZE, IMGTYPE_COLORALPHA, - IMGFLAG_NO_COMPRESSION | - IMGFLAG_CLAMPTOEDGE, + IMGFLAG_NO_COMPRESSION | + IMGFLAG_CLAMPTOEDGE, GL_DEPTH24_STENCIL8); } diff --git a/shared/rd-rend2/tr_light.cpp b/shared/rd-rend2/tr_light.cpp index 6064f8798f..239a020a44 100644 --- a/shared/rd-rend2/tr_light.cpp +++ b/shared/rd-rend2/tr_light.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define DLIGHT_AT_RADIUS 16 // at the edge of a dlight's influence, this amount of light will be added -#define DLIGHT_MINIMUM_RADIUS 16 +#define DLIGHT_MINIMUM_RADIUS 16 // never calculate a range less than this to prevent huge light numbers @@ -212,7 +212,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent, world_t *world ) { } data = world->lightGridData + *(world->lightGridArray+gridPos); - if ( data->styles[0] == LS_LSNONE ) + if ( data->styles[0] == LS_LSNONE ) { continue; // ignore samples in walls } @@ -336,7 +336,7 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) { vec3_t lightDir; vec3_t lightOrigin; - // lighting calculations + // lighting calculations if ( ent->lightingCalculated ) { return; } @@ -355,13 +355,13 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) { } // if NOWORLDMODEL, only use dynamic lights (menu system, etc) - if ( !(refdef->rdflags & RDF_NOWORLDMODEL ) + if ( !(refdef->rdflags & RDF_NOWORLDMODEL ) && tr.world->lightGridData ) { R_SetupEntityLightingGrid( ent, tr.world ); } else { - ent->ambientLight[0] = ent->ambientLight[1] = + ent->ambientLight[0] = ent->ambientLight[1] = ent->ambientLight[2] = tr.identityLight * 150; - ent->directedLight[0] = ent->directedLight[1] = + ent->directedLight[0] = ent->directedLight[1] = ent->directedLight[2] = tr.identityLight * 150; VectorCopy( tr.sunDirection, ent->lightDir ); } @@ -422,7 +422,7 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) { ((byte *)&ent->ambientLightInt)[1] = Q_ftol(ent->ambientLight[1]); ((byte *)&ent->ambientLightInt)[2] = Q_ftol(ent->ambientLight[2]); ((byte *)&ent->ambientLightInt)[3] = 0xff; - + // transform the direction to local space VectorNormalize( lightDir ); VectorCopy(lightDir, ent->lightDir); @@ -440,7 +440,7 @@ R_LightForPoint int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir ) { trRefEntity_t ent; - + if ( tr.world->lightGridData == NULL ) return qfalse; @@ -458,7 +458,7 @@ int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, ve int R_LightDirForPoint( vec3_t point, vec3_t lightDir, vec3_t normal, world_t *world ) { trRefEntity_t ent; - + if ( world->lightGridData == NULL ) { VectorCopy(normal, lightDir); @@ -487,7 +487,7 @@ int R_DLightsForPoint(const vec3_t point, const float radius) for (int i = 0; i < tr.refdef.num_dlights; i++) { currentDlight = tr.refdef.dlights[i]; - + VectorSubtract(point, currentDlight.origin, delta); distance = VectorLength(delta); radiusSum = radius + currentDlight.radius; diff --git a/shared/rd-rend2/tr_main.cpp b/shared/rd-rend2/tr_main.cpp index 057edde321..0420e551b2 100644 --- a/shared/rd-rend2/tr_main.cpp +++ b/shared/rd-rend2/tr_main.cpp @@ -559,7 +559,7 @@ int R_CullPointAndRadiusEx( const vec3_t pt, float radius, const cplane_t* frust } // check against frustum planes - for (i = 0 ; i < numPlanes ; i++) + for (i = 0 ; i < numPlanes ; i++) { frust = &frustum[i]; @@ -568,7 +568,7 @@ int R_CullPointAndRadiusEx( const vec3_t pt, float radius, const cplane_t* frust { return CULL_OUT; } - else if ( dist <= radius ) + else if ( dist <= radius ) { mightBeClipped = qtrue; } @@ -637,7 +637,7 @@ void R_TransformModelToClip( const vec3_t src, const float *modelViewMatrix, con int i; for ( i = 0 ; i < 4 ; i++ ) { - eye[i] = + eye[i] = src[0] * modelViewMatrix[ i + 0 * 4 ] + src[1] * modelViewMatrix[ i + 1 * 4 ] + src[2] * modelViewMatrix[ i + 2 * 4 ] + @@ -645,7 +645,7 @@ void R_TransformModelToClip( const vec3_t src, const float *modelViewMatrix, con } for ( i = 0 ; i < 4 ; i++ ) { - dst[i] = + dst[i] = eye[0] * projectionMatrix[ i + 0 * 4 ] + eye[1] * projectionMatrix[ i + 1 * 4 ] + eye[2] * projectionMatrix[ i + 2 * 4 ] + @@ -703,7 +703,7 @@ Called by both the front end and the back end ================= */ void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms, - orientationr_t *ori ) + orientationr_t *ori ) { vec3_t delta; float axisLength; @@ -767,7 +767,7 @@ R_RotateForViewer Sets up the modelview matrix for a given viewParm ================= */ -static void R_RotateForViewer(orientationr_t *ori, viewParms_t *viewParms) +static void R_RotateForViewer(orientationr_t *ori, viewParms_t *viewParms) { float viewerMatrix[16]; vec3_t origin; @@ -830,7 +830,7 @@ static void R_SetFarClip( viewParms_t *viewParms, const trRefdef_t *refdef ) return; } } - + // // set far clipping planes dynamically // @@ -893,7 +893,7 @@ void R_SetupFrustum (viewParms_t *dest, float xmin, float xmax, float ymax, floa vec3_t ofsorigin; float oppleg, adjleg, length; int i; - + if(stereoSep == 0 && xmin == -xmax) { // symmetric case can be simplified @@ -914,7 +914,7 @@ void R_SetupFrustum (viewParms_t *dest, float xmin, float xmax, float ymax, floa // In stereo rendering, due to the modification of the projection matrix, dest->ori.origin is not the // actual origin that we're rendering so offset the tip of the view pyramid. VectorMA(dest->ori.origin, stereoSep, dest->ori.axis[1], ofsorigin); - + oppleg = xmax + stereoSep; length = sqrt(oppleg * oppleg + zProj * zProj); VectorScale(dest->ori.axis[0], oppleg / length, dest->frustum[0].normal); @@ -935,7 +935,7 @@ void R_SetupFrustum (viewParms_t *dest, float xmin, float xmax, float ymax, floa VectorScale(dest->ori.axis[0], oppleg, dest->frustum[3].normal); VectorMA(dest->frustum[3].normal, -adjleg, dest->ori.axis[2], dest->frustum[3].normal); - + for (i=0 ; i<4 ; i++) { dest->frustum[i].type = PLANE_NON_AXIAL; dest->frustum[i].dist = DotProduct (ofsorigin, dest->frustum[i].normal); @@ -967,7 +967,7 @@ void R_SetupProjection(viewParms_t *dest, float zProj, float zFar, qboolean comp float width, height, stereoSep = r_stereoSeparation->value; /* - * offset the view origin of the viewer for stereo rendering + * offset the view origin of the viewer for stereo rendering * by setting the projection matrix appropriately. */ @@ -989,7 +989,7 @@ void R_SetupProjection(viewParms_t *dest, float zProj, float zFar, qboolean comp width = xmax - xmin; height = ymax - ymin; - + dest->projectionMatrix[0] = 2 * zProj / width; dest->projectionMatrix[4] = 0; dest->projectionMatrix[8] = (xmax + xmin + 2 * stereoSep) / width; @@ -1004,7 +1004,7 @@ void R_SetupProjection(viewParms_t *dest, float zProj, float zFar, qboolean comp dest->projectionMatrix[7] = 0; dest->projectionMatrix[11] = -1; dest->projectionMatrix[15] = 0; - + // Now that we have all the data for the projection matrix we can also setup the view frustum. if(computeFrustum) R_SetupFrustum(dest, xmin, xmax, ymax, zProj, zFar, stereoSep); @@ -1129,7 +1129,7 @@ void R_SetupProjectionOrtho(viewParms_t *dest, const vec3_t viewBounds[2]) VectorScale(dest->ori.axis[0], -1.0f, dest->frustum[4].normal); VectorMA(dest->ori.origin, -viewBounds[1][0], dest->frustum[4].normal, pop); dest->frustum[4].dist = DotProduct(pop, dest->frustum[4].normal); - + for (i = 0; i < 5; i++) { dest->frustum[i].type = PLANE_NON_AXIAL; @@ -1199,13 +1199,13 @@ void R_PlaneForSurface (surfaceType_t *surfType, cplane_t *plane) { v2 = tri->verts + tri->indexes[1]; v3 = tri->verts + tri->indexes[2]; PlaneFromPoints( plane4, v1->xyz, v2->xyz, v3->xyz ); - VectorCopy( plane4, plane->normal ); + VectorCopy( plane4, plane->normal ); plane->dist = plane4[3]; return; case SF_POLY: poly = (srfPoly_t *)surfType; PlaneFromPoints( plane4, poly->verts[0].xyz, poly->verts[1].xyz, poly->verts[2].xyz ); - VectorCopy( plane4, plane->normal ); + VectorCopy( plane4, plane->normal ); plane->dist = plane4[3]; return; default: @@ -1277,8 +1277,8 @@ qboolean R_GetPortalOrientations(const msurface_t *surf, int entityNum, VectorCopy( e->e.oldorigin, pvsOrigin ); // if the entity is just a mirror, don't use as a camera point - if ( e->e.oldorigin[0] == e->e.origin[0] && - e->e.oldorigin[1] == e->e.origin[1] && + if ( e->e.oldorigin[0] == e->e.origin[0] && + e->e.oldorigin[1] == e->e.origin[1] && e->e.oldorigin[2] == e->e.origin[2] ) { VectorScale( plane.normal, plane.dist, surface->origin ); VectorCopy( surface->origin, camera->origin ); @@ -1294,7 +1294,7 @@ qboolean R_GetPortalOrientations(const msurface_t *surf, int entityNum, // an origin point we can rotate around d = DotProduct( e->e.origin, plane.normal ) - plane.dist; VectorMA( e->e.origin, -d, surface->axis[0], surface->origin ); - + // now get the camera origin and orientation VectorCopy( e->e.oldorigin, camera->origin ); AxisCopy( e->e.axis, camera->axis ); @@ -1354,7 +1354,7 @@ static qboolean IsMirror( const msurface_t *surface, int entityNum ) R_PlaneForSurface( surface->data, &originalPlane ); // rotate the plane if necessary - if ( entityNum != REFENTITYNUM_WORLD ) + if ( entityNum != REFENTITYNUM_WORLD ) { const trRefEntity_t *currentEntity = &tr.refdef.entities[entityNum]; @@ -1368,12 +1368,12 @@ static qboolean IsMirror( const msurface_t *surface, int entityNum ) // translate the original plane originalPlane.dist = originalPlane.dist + DotProduct( originalPlane.normal, tr.ori.origin ); - } + } // locate the portal entity closest to this plane. // origin will be the origin of the portal, origin2 will be // the origin of the camera - for ( i = 0 ; i < tr.refdef.num_entities ; i++ ) + for ( i = 0 ; i < tr.refdef.num_entities ; i++ ) { e = &tr.refdef.entities[i]; if ( e->e.reType != RT_PORTALSURFACE ) { @@ -1386,9 +1386,9 @@ static qboolean IsMirror( const msurface_t *surface, int entityNum ) } // if the entity is just a mirror, don't use as a camera point - if ( e->e.oldorigin[0] == e->e.origin[0] && - e->e.oldorigin[1] == e->e.origin[1] && - e->e.oldorigin[2] == e->e.origin[2] ) + if ( e->e.oldorigin[0] == e->e.origin[0] && + e->e.oldorigin[1] == e->e.origin[1] && + e->e.oldorigin[2] == e->e.origin[2] ) { return qtrue; } @@ -1613,7 +1613,7 @@ qboolean R_MirrorViewBySurface (msurface_t *surface, int entityNum) { VectorSubtract( vec3_origin, camera.axis[0], newParms.portalPlane.normal ); newParms.portalPlane.dist = DotProduct( camera.origin, newParms.portalPlane.normal ); - + R_MirrorVector (oldParms.ori.axis[0], &surfaceOri, &camera, newParms.ori.axis[0]); R_MirrorVector (oldParms.ori.axis[1], &surfaceOri, &camera, newParms.ori.axis[1]); R_MirrorVector (oldParms.ori.axis[2], &surfaceOri, &camera, newParms.ori.axis[2]); @@ -1705,7 +1705,7 @@ int R_SpriteFogNum( trRefEntity_t *ent ) { // return i; // break; //} - //else + //else if (!partialFog) {//first partialFog partialFog = i; @@ -1868,7 +1868,7 @@ void R_AddDrawSurf( surf->dlightBits = dlightMap; surf->fogIndex = fogIndex; } - + tr.refdef.numDrawSurfs++; } @@ -1901,7 +1901,7 @@ static void R_AddEntitySurface(const trRefdef_t *refdef, trRefEntity_t *ent, int // // the weapon model must be handled special -- - // we don't want the hacked weapon position showing in + // we don't want the hacked weapon position showing in // mirrors, because the true body position will already be drawn // if ( (ent->e.renderfx & RF_FIRST_PERSON) && (tr.viewParms.flags & VPF_NOVIEWMODEL)) { @@ -1986,7 +1986,7 @@ static void R_AddEntitySurface(const trRefdef_t *refdef, trRefEntity_t *ent, int break; } - // FIX ME: always draw null axis model instead of rejecting the drawcall + // FIX ME: always draw null axis model instead of rejecting the drawcall if (tr.currentModel->dataSize > 0) R_AddDrawSurf( &entitySurface, @@ -2205,19 +2205,19 @@ void R_RenderDlightCubemaps(const refdef_t *fd) VectorSet( shadowParms.ori.axis[1], 0, 0, -1); VectorSet( shadowParms.ori.axis[2], 0, 1, 0); break; - case 1: + case 1: // +X VectorSet( shadowParms.ori.axis[0], 1, 0, 0); VectorSet( shadowParms.ori.axis[1], 0, 0, 1); VectorSet( shadowParms.ori.axis[2], 0, 1, 0); break; - case 2: + case 2: // -Y VectorSet( shadowParms.ori.axis[0], 0, -1, 0); VectorSet( shadowParms.ori.axis[1], 1, 0, 0); VectorSet( shadowParms.ori.axis[2], 0, 0, -1); break; - case 3: + case 3: // +Y VectorSet( shadowParms.ori.axis[0], 0, 1, 0); VectorSet( shadowParms.ori.axis[1], 1, 0, 0); @@ -2914,7 +2914,7 @@ void R_GatherFrameViews(trRefdef_t *refdef) tr.numCachedViewParms++; } } - + } // sun shadowmaps @@ -2986,7 +2986,7 @@ void R_GatherFrameViews(trRefdef_t *refdef) VectorMA(point, ly, refdef->viewaxis[2], point); VectorCopy(point, frustrumPoint0); VectorAdd(point, splitCenter, splitCenter); - + VectorMA(base, -lx, refdef->viewaxis[1], point); VectorMA(point, ly, refdef->viewaxis[2], point); VectorAdd(point, splitCenter, splitCenter); @@ -3043,7 +3043,7 @@ void R_GatherFrameViews(trRefdef_t *refdef) VPF_DEPTHSHADOW | VPF_DEPTHCLAMP | VPF_ORTHOGRAPHIC | VPF_NOVIEWMODEL | VPF_SHADOWCASCADES, orientation, lightviewBounds); - + // Moving the Light in Texel-Sized Increments // from http://msdn.microsoft.com/en-us/library/windows/desktop/ee416324%28v=vs.85%29.aspx static float worldUnitsPerTexel = 2.0f * lightviewBounds[1][0] / (float)tr.sunShadowFbo[level]->width; diff --git a/shared/rd-rend2/tr_marks.cpp b/shared/rd-rend2/tr_marks.cpp index 6e12616d13..aa2e761a1b 100644 --- a/shared/rd-rend2/tr_marks.cpp +++ b/shared/rd-rend2/tr_marks.cpp @@ -39,7 +39,7 @@ Out must have space for two more vertexes than in #define SIDE_BACK 1 #define SIDE_ON 2 static void R_ChopPolyBehindPlane( int numInPoints, vec3_t inPoints[MAX_VERTS_ON_POLY], - int *numOutPoints, vec3_t outPoints[MAX_VERTS_ON_POLY], + int *numOutPoints, vec3_t outPoints[MAX_VERTS_ON_POLY], vec3_t normal, float dist, float epsilon) { float dists[MAX_VERTS_ON_POLY+4] = { 0 }; int sides[MAX_VERTS_ON_POLY+4] = { 0 }; @@ -88,13 +88,13 @@ static void R_ChopPolyBehindPlane( int numInPoints, vec3_t inPoints[MAX_VERTS_ON for ( i = 0 ; i < numInPoints ; i++ ) { p1 = inPoints[i]; clip = outPoints[ *numOutPoints ]; - + if ( sides[i] == SIDE_ON ) { VectorCopy( p1, clip ); (*numOutPoints)++; continue; } - + if ( sides[i] == SIDE_FRONT ) { VectorCopy( p1, clip ); (*numOutPoints)++; @@ -104,7 +104,7 @@ static void R_ChopPolyBehindPlane( int numInPoints, vec3_t inPoints[MAX_VERTS_ON if ( sides[i+1] == SIDE_ON || sides[i+1] == sides[i] ) { continue; } - + // generate a split point p2 = inPoints[ (i+1) % numInPoints ]; diff --git a/shared/rd-rend2/tr_mesh.cpp b/shared/rd-rend2/tr_mesh.cpp index f8a84dd5fa..9c1cdcd06c 100644 --- a/shared/rd-rend2/tr_mesh.cpp +++ b/shared/rd-rend2/tr_mesh.cpp @@ -41,22 +41,22 @@ float ProjectRadius( float r, vec3_t location ) p[1] = fabs( r ); p[2] = -dist; - projected[0] = p[0] * tr.viewParms.projectionMatrix[0] + + projected[0] = p[0] * tr.viewParms.projectionMatrix[0] + p[1] * tr.viewParms.projectionMatrix[4] + p[2] * tr.viewParms.projectionMatrix[8] + tr.viewParms.projectionMatrix[12]; - projected[1] = p[0] * tr.viewParms.projectionMatrix[1] + + projected[1] = p[0] * tr.viewParms.projectionMatrix[1] + p[1] * tr.viewParms.projectionMatrix[5] + p[2] * tr.viewParms.projectionMatrix[9] + tr.viewParms.projectionMatrix[13]; - projected[2] = p[0] * tr.viewParms.projectionMatrix[2] + + projected[2] = p[0] * tr.viewParms.projectionMatrix[2] + p[1] * tr.viewParms.projectionMatrix[6] + p[2] * tr.viewParms.projectionMatrix[10] + tr.viewParms.projectionMatrix[14]; - projected[3] = p[0] * tr.viewParms.projectionMatrix[3] + + projected[3] = p[0] * tr.viewParms.projectionMatrix[3] + p[1] * tr.viewParms.projectionMatrix[7] + p[2] * tr.viewParms.projectionMatrix[11] + tr.viewParms.projectionMatrix[15]; @@ -134,7 +134,7 @@ static int R_CullModel( mdvModel_t *model, trRefEntity_t *ent ) { } } } - + // calculate a bounding box in the current coordinate system for (i = 0 ; i < 3 ; i++) { bounds[0][i] = oldFrame->bounds[0][i] < newFrame->bounds[0][i] ? oldFrame->bounds[0][i] : newFrame->bounds[0][i]; @@ -212,9 +212,9 @@ int R_ComputeLOD( trRefEntity_t *ent ) { int frameSize; mdr = tr.currentModel->data.mdr; frameSize = (size_t) (&((mdrFrame_t *)0)->bones[mdr->numBones]); - + mdrframe = (mdrFrame_t *) ((byte *) mdr + mdr->ofsFrames + frameSize * ent->e.frame); - + radius = RadiusFromBounds(mdrframe->bounds[0], mdrframe->bounds[1]); } else @@ -251,7 +251,7 @@ int R_ComputeLOD( trRefEntity_t *ent ) { lod = tr.currentModel->numLods - 1; } } - if (!(ent->e.renderfx & RF_NOLOD)) + if ( !( ent->e.renderfx & RF_NOLOD ) ) lod += r_lodbias->integer; if ( lod >= tr.currentModel->numLods ) @@ -323,7 +323,7 @@ int R_ComputeFogNum( mdvModel_t *model, trRefEntity_t *ent ) { // return i; // break; //} - //else + //else if (!partialFog) {//first partialFog partialFog = i; @@ -352,7 +352,7 @@ void R_AddMD3Surfaces( trRefEntity_t *ent, int entityNum ) { qboolean personalModel; // don't add third_person objects if not in a portal - personalModel = (qboolean)((ent->e.renderfx & RF_THIRD_PERSON) && !(tr.viewParms.isPortal + personalModel = (qboolean)((ent->e.renderfx & RF_THIRD_PERSON) && !(tr.viewParms.isPortal || (tr.viewParms.flags & VPF_DEPTHSHADOW))); if ( ent->e.renderfx & RF_WRAP_FRAMES ) { @@ -366,7 +366,7 @@ void R_AddMD3Surfaces( trRefEntity_t *ent, int entityNum ) { // when the surfaces are rendered, they don't need to be // range checked again. // - if ( (ent->e.frame >= tr.currentModel->data.mdv[0]->numFrames) + if ( (ent->e.frame >= tr.currentModel->data.mdv[0]->numFrames) || (ent->e.frame < 0) || (ent->e.oldframe >= tr.currentModel->data.mdv[0]->numFrames) || (ent->e.oldframe < 0) ) { diff --git a/shared/rd-rend2/tr_model.cpp b/shared/rd-rend2/tr_model.cpp index 81d22a51a7..c11ff2fbee 100644 --- a/shared/rd-rend2/tr_model.cpp +++ b/shared/rd-rend2/tr_model.cpp @@ -74,7 +74,7 @@ qhandle_t R_RegisterMD3(const char *name, model_t *mod) ident = *(unsigned *)buf; if( !bAlreadyCached ) LL(ident); - + switch(ident) { case MD3_IDENT: @@ -142,20 +142,20 @@ qhandle_t R_RegisterMDR(const char *name, model_t *mod) mod->type = MOD_BAD; return 0; } - + ident = LittleLong(*(unsigned *)buf.u); if(ident == MDR_IDENT) loaded = R_LoadMDR(mod, buf.u, filesize, name); ri.FS_FreeFile (buf.v); - + if(!loaded) { ri.Printf(PRINT_WARNING,"R_RegisterMDR: couldn't load mdr file %s\n", name); mod->type = MOD_BAD; return 0; } - + return mod->index; } @@ -179,18 +179,18 @@ qhandle_t R_RegisterIQM(const char *name, model_t *mod) mod->type = MOD_BAD; return 0; } - + loaded = R_LoadIQM(mod, buf.u, filesize, name); ri.FS_FreeFile (buf.v); - + if(!loaded) { ri.Printf(PRINT_WARNING,"R_RegisterIQM: couldn't load iqm file %s\n", name); mod->type = MOD_BAD; return 0; } - + return mod->index; } @@ -208,7 +208,7 @@ static modelExtToLoaderMap_t modelLoaders[ ] = { "iqm", R_RegisterIQM }, { "mdr", R_RegisterMDR }, { "md3", R_RegisterMD3 }, - /* + /* Ghoul 2 Insert Start */ { "glm", R_RegisterMD3 }, @@ -433,7 +433,7 @@ qboolean R_LoadMDXA_Server( model_t *mod, void *buffer, const char *mod_name, qb pinmodel = (mdxaHeader_t *)buffer; // // read some fields from the binary, but only LittleLong() them when we know this wasn't an already-cached model... - // + // version = (pinmodel->version); size = (pinmodel->ofsEnd); @@ -442,7 +442,7 @@ qboolean R_LoadMDXA_Server( model_t *mod, void *buffer, const char *mod_name, qb LL(version); LL(size); } - + if (version != MDXA_VERSION) { return qfalse; } @@ -458,7 +458,7 @@ qboolean R_LoadMDXA_Server( model_t *mod, void *buffer, const char *mod_name, qb if (!bAlreadyFound) { - // horrible new hackery, if !bAlreadyFound then we've just done a tag-morph, so we need to set the + // horrible new hackery, if !bAlreadyFound then we've just done a tag-morph, so we need to set the // bool reference passed into this function to true, to tell the caller NOT to do an ri.FS_Freefile since // we've hijacked that memory block... // @@ -502,11 +502,11 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb int size; //shader_t *sh; mdxmSurfHierarchy_t *surfInfo; - + pinmodel= (mdxmHeader_t *)buffer; // // read some fields from the binary, but only LittleLong() them when we know this wasn't an already-cached model... - // + // version = (pinmodel->version); size = (pinmodel->ofsEnd); @@ -521,8 +521,8 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb } mod->type = MOD_MDXM; - mod->dataSize += size; - + mod->dataSize += size; + qboolean bAlreadyFound = qfalse; mdxm = (mdxmHeader_t*)CModelCache->Allocate( size, buffer, mod_name, &bAlreadyFound, TAG_MODEL_GLM ); mod->data.glm = (mdxmData_t *)Hunk_Alloc (sizeof (mdxmData_t), h_low); @@ -532,7 +532,7 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb if (!bAlreadyFound) { - // horrible new hackery, if !bAlreadyFound then we've just done a tag-morph, so we need to set the + // horrible new hackery, if !bAlreadyFound then we've just done a tag-morph, so we need to set the // bool reference passed into this function to true, to tell the caller NOT to do an ri.FS_Freefile since // we've hijacked that memory block... // @@ -550,10 +550,10 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb LL(mdxm->ofsSurfHierarchy); LL(mdxm->ofsEnd); } - + // first up, go load in the animation file we need that has the skeletal animation info for this model mdxm->animIndex = RE_RegisterServerModel(va ("%s.gla",mdxm->animName)); - if (!mdxm->animIndex) + if (!mdxm->animIndex) { return qfalse; } @@ -566,7 +566,7 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb } surfInfo = (mdxmSurfHierarchy_t *)( (byte *)mdxm + mdxm->ofsSurfHierarchy); - for ( i = 0 ; i < mdxm->numSurfaces ; i++) + for ( i = 0 ; i < mdxm->numSurfaces ; i++) { LL(surfInfo->numChildren); LL(surfInfo->parentIndex); @@ -580,7 +580,7 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb // We will not be using shaders on the server. //sh = 0; // insert it in the surface list - + surfInfo->shaderIndex = 0; CModelCache->StoreShaderRequest(mod_name, &surfInfo->shader[0], &surfInfo->shaderIndex); @@ -588,7 +588,7 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb // find the next surface surfInfo = (mdxmSurfHierarchy_t *)( (byte *)surfInfo + (intptr_t)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surfInfo->numChildren ] )); } - + // swap all the LOD's (we need to do the middle part of this even for intel, because of shader reg and err-check) lod = (mdxmLOD_t *) ( (byte *)mdxm + mdxm->ofsLODs ); for ( l = 0 ; l < mdxm->numLODs ; l++) @@ -598,7 +598,7 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb LL(lod->ofsEnd); // swap all the surfaces surf = (mdxmSurface_t *) ( (byte *)lod + sizeof (mdxmLOD_t) + (mdxm->numSurfaces * sizeof(mdxmLODSurfOffset_t)) ); - for ( i = 0 ; i < mdxm->numSurfaces ; i++) + for ( i = 0 ; i < mdxm->numSurfaces ; i++) { LL(surf->numTriangles); LL(surf->ofsTriangles); @@ -611,14 +611,14 @@ qboolean R_LoadMDXM_Server( model_t *mod, void *buffer, const char *mod_name, qb // LL(surf->maxVertBoneWeights); //triCount += surf->numTriangles; - + if ( surf->numVerts > SHADER_MAX_VERTEXES ) { return qfalse; } if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) { return qfalse; } - + // change to surface identifier surf->ident = SF_MDX; @@ -677,7 +677,7 @@ qhandle_t R_RegisterMDX_Server(const char *name, model_t *mod) ident = *(unsigned *)buf; if( !bAlreadyCached ) LL(ident); - + switch(ident) { case MDXA_IDENT: @@ -725,7 +725,7 @@ qhandle_t R_RegisterMDX_Server(const char *name, model_t *mod) // when there are multiple models of different formats available static modelExtToLoaderMap_t serverModelLoaders[ ] = { - /* + /* Ghoul 2 Insert Start */ { "glm", R_RegisterMDX_Server }, @@ -1224,7 +1224,7 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, const char *modN R_LoadMDR ================= */ -static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char *mod_name ) +static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char *mod_name ) { int i, j, k, l; mdrHeader_t *pinmodel, *mdr; @@ -1241,20 +1241,20 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char pinmodel = (mdrHeader_t *)buffer; pinmodel->version = LittleLong(pinmodel->version); - if (pinmodel->version != MDR_VERSION) + if (pinmodel->version != MDR_VERSION) { ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has wrong version (%i should be %i)\n", mod_name, pinmodel->version, MDR_VERSION); return qfalse; } size = LittleLong(pinmodel->ofsEnd); - + if(size > filesize) { ri.Printf(PRINT_WARNING, "R_LoadMDR: Header of %s is broken. Wrong filesize declared!\n", mod_name); return qfalse; } - + mod->type = MOD_MDR; LL(pinmodel->numFrames); @@ -1270,7 +1270,7 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char // now add enough space for the uncompressed bones. size += pinmodel->numFrames * pinmodel->numBones * ((sizeof(mdrBone_t) - sizeof(mdrCompBone_t))); } - + // simple bounds check if(pinmodel->numBones < 0 || sizeof(*mdr) + pinmodel->numFrames * (sizeof(*frame) + (pinmodel->numBones - 1) * sizeof(*frame->bones)) > size) @@ -1283,7 +1283,7 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char mod->data.mdr = mdr = (mdrHeader_t*)Hunk_Alloc( size, h_low ); // Copy all the values over from the file and fix endian issues in the process, if necessary. - + mdr->ident = LittleLong(pinmodel->ident); mdr->version = pinmodel->version; // Don't need to swap byte order on this one, we already did above. Q_strncpyz(mdr->name, pinmodel->name, sizeof(mdr->name)); @@ -1295,7 +1295,7 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char mod->numLods = mdr->numLODs; - if ( mdr->numFrames < 1 ) + if ( mdr->numFrames < 1 ) { ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has no frames\n", mod_name); return qfalse; @@ -1304,14 +1304,14 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char /* The first frame will be put into the first free space after the header */ frame = (mdrFrame_t *)(mdr + 1); mdr->ofsFrames = (int)((byte *) frame - (byte *) mdr); - + if (pinmodel->ofsFrames < 0) { mdrCompFrame_t *cframe; - - // compressed model... + + // compressed model... cframe = (mdrCompFrame_t *)((byte *) pinmodel - pinmodel->ofsFrames); - + for(i = 0; i < mdr->numFrames; i++) { for(j = 0; j < 3; j++) @@ -1323,7 +1323,7 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char frame->radius = LittleFloat(cframe->radius); frame->name[0] = '\0'; // No name supplied in the compressed version. - + for(j = 0; j < mdr->numBones; j++) { for(k = 0; k < (sizeof(cframe->bones[j].Comp) / 2); k++) @@ -1331,15 +1331,15 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char // Do swapping for the uncompressing functions. They seem to use shorts // values only, so I assume this will work. Never tested it on other // platforms, though. - + ((unsigned short *)(cframe->bones[j].Comp))[k] = LittleShort( ((unsigned short *)(cframe->bones[j].Comp))[k] ); } - + /* Now do the actual uncompressing */ MC_UnCompress(frame->bones[j].matrix, cframe->bones[j].Comp); } - + // Next Frame... cframe = (mdrCompFrame_t *) &cframe->bones[j]; frame = (mdrFrame_t *) &frame->bones[j]; @@ -1348,14 +1348,14 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char else { mdrFrame_t *curframe; - + // uncompressed model... // - + curframe = (mdrFrame_t *)((byte *) pinmodel + pinmodel->ofsFrames); - + // swap all the frames - for ( i = 0 ; i < mdr->numFrames ; i++) + for ( i = 0 ; i < mdr->numFrames ; i++) { for(j = 0; j < 3; j++) { @@ -1363,26 +1363,26 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char frame->bounds[1][j] = LittleFloat(curframe->bounds[1][j]); frame->localOrigin[j] = LittleFloat(curframe->localOrigin[j]); } - + frame->radius = LittleFloat(curframe->radius); Q_strncpyz(frame->name, curframe->name, sizeof(frame->name)); - - for (j = 0; j < (int) (mdr->numBones * sizeof(mdrBone_t) / 4); j++) + + for (j = 0; j < (int) (mdr->numBones * sizeof(mdrBone_t) / 4); j++) { ((float *)frame->bones)[j] = LittleFloat( ((float *)curframe->bones)[j] ); } - + curframe = (mdrFrame_t *) &curframe->bones[mdr->numBones]; frame = (mdrFrame_t *) &frame->bones[mdr->numBones]; } } - + // frame should now point to the first free address after all frames. lod = (mdrLOD_t *) frame; mdr->ofsLODs = (int) ((byte *) lod - (byte *)mdr); - + curlod = (mdrLOD_t *)((byte *) pinmodel + LittleLong(pinmodel->ofsLODs)); - + // swap all the LOD's for ( l = 0 ; l < mdr->numLODs ; l++) { @@ -1394,12 +1394,12 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char } lod->numSurfaces = LittleLong(curlod->numSurfaces); - + // swap all the surfaces surf = (mdrSurface_t *) (lod + 1); lod->ofsSurfaces = (int)((byte *) surf - (byte *) lod); cursurf = (mdrSurface_t *) ((byte *)curlod + LittleLong(curlod->ofsSurfaces)); - + for ( i = 0 ; i < lod->numSurfaces ; i++) { // simple bounds check @@ -1410,26 +1410,26 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char } // first do some copying stuff - + surf->ident = SF_MDR; Q_strncpyz(surf->name, cursurf->name, sizeof(surf->name)); Q_strncpyz(surf->shader, cursurf->shader, sizeof(surf->shader)); - + surf->ofsHeader = (byte *) mdr - (byte *) surf; - + surf->numVerts = LittleLong(cursurf->numVerts); surf->numTriangles = LittleLong(cursurf->numTriangles); // numBoneReferences and BoneReferences generally seem to be unused - + // now do the checks that may fail. - if ( surf->numVerts >= SHADER_MAX_VERTEXES ) + if ( surf->numVerts >= SHADER_MAX_VERTEXES ) { ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i verts on %s (%i).\n", mod_name, SHADER_MAX_VERTEXES-1, surf->name[0] ? surf->name : "a surface", surf->numVerts ); return qfalse; } - if ( surf->numTriangles*3 >= SHADER_MAX_INDEXES ) + if ( surf->numTriangles*3 >= SHADER_MAX_INDEXES ) { ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has more than %i triangles on %s (%i).\n", mod_name, ( SHADER_MAX_INDEXES / 3 ) - 1, surf->name[0] ? surf->name : "a surface", @@ -1446,16 +1446,16 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char } else { surf->shaderIndex = sh->index; } - + // now copy the vertexes. v = (mdrVertex_t *) (surf + 1); surf->ofsVerts = (int)((byte *) v - (byte *) surf); curv = (mdrVertex_t *) ((byte *)cursurf + LittleLong(cursurf->ofsVerts)); - + for(j = 0; j < surf->numVerts; j++) { LL(curv->numWeights); - + // simple bounds check if(curv->numWeights < 0 || (byte *) (v + 1) + (curv->numWeights - 1) * sizeof(*weight) > (byte *) mdr + size) { @@ -1466,37 +1466,37 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char v->normal[0] = LittleFloat(curv->normal[0]); v->normal[1] = LittleFloat(curv->normal[1]); v->normal[2] = LittleFloat(curv->normal[2]); - + v->texCoords[0] = LittleFloat(curv->texCoords[0]); v->texCoords[1] = LittleFloat(curv->texCoords[1]); - + v->numWeights = curv->numWeights; weight = &v->weights[0]; curweight = &curv->weights[0]; - + // Now copy all the weights for(k = 0; k < v->numWeights; k++) { weight->boneIndex = LittleLong(curweight->boneIndex); weight->boneWeight = LittleFloat(curweight->boneWeight); - + weight->offset[0] = LittleFloat(curweight->offset[0]); weight->offset[1] = LittleFloat(curweight->offset[1]); weight->offset[2] = LittleFloat(curweight->offset[2]); - + weight++; curweight++; } - + v = (mdrVertex_t *) weight; curv = (mdrVertex_t *) curweight; } - + // we know the offset to the triangles now: tri = (mdrTriangle_t *) v; surf->ofsTriangles = (int)((byte *) tri - (byte *) surf); curtri = (mdrTriangle_t *)((byte *) cursurf + LittleLong(cursurf->ofsTriangles)); - + // simple bounds check if(surf->numTriangles < 0 || (byte *) (tri + surf->numTriangles) > (byte *) mdr + size) { @@ -1509,11 +1509,11 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char tri->indexes[0] = LittleLong(curtri->indexes[0]); tri->indexes[1] = LittleLong(curtri->indexes[1]); tri->indexes[2] = LittleLong(curtri->indexes[2]); - + tri++; curtri++; } - + // tri now points to the end of the surface. surf->ofsEnd = (byte *) tri - (byte *) surf; surf = (mdrSurface_t *) tri; @@ -1529,7 +1529,7 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char // find the next LOD. curlod = (mdrLOD_t *)((byte *) curlod + LittleLong(curlod->ofsEnd)); } - + // lod points to the first tag now, so update the offset too. tag = (mdrTag_t *) lod; mdr->ofsTags = (int)((byte *) tag - (byte *) mdr); @@ -1541,21 +1541,21 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char ri.Printf(PRINT_WARNING, "R_LoadMDR: %s has broken structure.\n", mod_name); return qfalse; } - + for (i = 0 ; i < mdr->numTags ; i++) { tag->boneIndex = LittleLong(curtag->boneIndex); Q_strncpyz(tag->name, curtag->name, sizeof(tag->name)); - + tag++; curtag++; } - + // And finally we know the real offset to the end. mdr->ofsEnd = (int)((byte *) tag - (byte *) mdr); // phew! we're done. - + return qtrue; } @@ -1706,7 +1706,7 @@ void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, mdvTag_t mdrFrame_t *frame; mdrTag_t *tag; - if ( framenum >= mod->numFrames ) + if ( framenum >= mod->numFrames ) { // it is possible to have a bad frame while changing models, so don't error framenum = mod->numFrames - 1; @@ -1730,7 +1730,7 @@ void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, mdvTag_t dest->origin[0]=frame->bones[tag->boneIndex].matrix[0][3]; dest->origin[1]=frame->bones[tag->boneIndex].matrix[1][3]; - dest->origin[2]=frame->bones[tag->boneIndex].matrix[2][3]; + dest->origin[2]=frame->bones[tag->boneIndex].matrix[2][3]; return; } @@ -1745,7 +1745,7 @@ void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, mdvTag_t R_LerpTag ================ */ -int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame, +int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame, float frac, const char *tagName ) { mdvTag_t *start, *end; mdvTag_t start_space, end_space; @@ -1785,7 +1785,7 @@ int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFram return qfalse; } } - + frontLerp = frac; backLerp = 1.0f - frac; @@ -1815,7 +1815,7 @@ void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs ) { if(model->type == MOD_BRUSH) { VectorCopy( model->data.bmodel->bounds[0], mins ); VectorCopy( model->data.bmodel->bounds[1], maxs ); - + return; } else if (model->type == MOD_MESH) { mdvModel_t *header; @@ -1826,7 +1826,7 @@ void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs ) { VectorCopy( frame->bounds[0], mins ); VectorCopy( frame->bounds[1], maxs ); - + return; } else if (model->type == MOD_MDR) { mdrHeader_t *header; @@ -1837,11 +1837,11 @@ void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs ) { VectorCopy( frame->bounds[0], mins ); VectorCopy( frame->bounds[1], maxs ); - + return; } else if(model->type == MOD_IQM) { iqmData_t *iqmData; - + iqmData = model->data.iqm; if(iqmData->bounds) diff --git a/shared/rd-rend2/tr_model_iqm.cpp b/shared/rd-rend2/tr_model_iqm.cpp index eff2e47e35..6af9a6a562 100644 --- a/shared/rd-rend2/tr_model_iqm.cpp +++ b/shared/rd-rend2/tr_model_iqm.cpp @@ -108,7 +108,7 @@ static void Matrix34Invert( float *inMat, float *outMat ) { vec3_t trans; float invSqrLen, *v; - + outMat[ 0] = inMat[ 0]; outMat[ 1] = inMat[ 4]; outMat[ 2] = inMat[ 8]; outMat[ 4] = inMat[ 1]; outMat[ 5] = inMat[ 5]; outMat[ 6] = inMat[ 9]; outMat[ 8] = inMat[ 2]; outMat[ 9] = inMat[ 6]; outMat[10] = inMat[10]; @@ -308,7 +308,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na LL( triangle->vertex[0] ); LL( triangle->vertex[1] ); LL( triangle->vertex[2] ); - + if( triangle->vertex[0] > header->num_vertexes || triangle->vertex[1] > header->num_vertexes || triangle->vertex[2] > header->num_vertexes ) { @@ -337,14 +337,14 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na } // check ioq3 limits - if ( mesh->num_vertexes >= SHADER_MAX_VERTEXES ) + if ( mesh->num_vertexes >= SHADER_MAX_VERTEXES ) { ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i verts on %s (%i).\n", mod_name, SHADER_MAX_VERTEXES-1, meshName[0] ? meshName : "a surface", mesh->num_vertexes ); return qfalse; } - if ( mesh->num_triangles*3 >= SHADER_MAX_INDEXES ) + if ( mesh->num_triangles*3 >= SHADER_MAX_INDEXES ) { ri.Printf(PRINT_WARNING, "R_LoadIQM: %s has more than %i triangles on %s (%i).\n", mod_name, ( SHADER_MAX_INDEXES / 3 ) - 1, meshName[0] ? meshName : "a surface", @@ -534,10 +534,10 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na joint = (iqmJoint_t *)((byte *)header + header->ofs_joints); for( i = 0; i < header->num_joints; i++, joint++ ) { float baseFrame[12], invBaseFrame[12]; - + JointToMatrix( joint->rotate, joint->scale, joint->translate, baseFrame ); Matrix34Invert( baseFrame, invBaseFrame ); - + if ( joint->parent >= 0 ) { Matrix34Multiply( iqmData->jointMats + 12 * joint->parent, baseFrame, mat ); @@ -600,14 +600,14 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na // construct transformation matrix JointToMatrix( rotate, scale, translate, mat1 ); - + if( pose->parent >= 0 ) { Matrix34Multiply( iqmData->jointMats + 12 * pose->parent, mat1, mat2 ); } else { Com_Memcpy( mat2, mat1, sizeof(mat1) ); } - + Matrix34Multiply( mat2, jointInvMats + 12 * j, mat ); mat += 12; } @@ -862,7 +862,7 @@ void R_AddIQMSurfaces( trRefEntity_t *ent, int entityNum ) { // when the surfaces are rendered, they don't need to be // range checked again. // - if ( (ent->e.frame >= data->num_frames) + if ( (ent->e.frame >= data->num_frames) || (ent->e.frame < 0) || (ent->e.oldframe >= data->num_frames) || (ent->e.oldframe < 0) ) { @@ -913,9 +913,9 @@ void R_AddIQMSurfaces( trRefEntity_t *ent, int entityNum ) { // stencil shadows can't do personal models unless I polyhedron clip if ( !personalModel - && r_shadows->integer == 2 + && r_shadows->integer == 2 && fogNum == 0 - && !(ent->e.renderfx & ( RF_NOSHADOW | RF_DEPTHHACK ) ) + && !(ent->e.renderfx & ( RF_NOSHADOW | RF_DEPTHHACK ) ) && shader->sort == SS_OPAQUE ) { R_AddDrawSurf( (surfaceType_t *)surface, entityNum, tr.shadowShader, 0, 0, R_IsPostRenderEntity(ent), 0 ); } @@ -968,7 +968,7 @@ static void ComputePoseMats( iqmData_t *data, int frame, int oldframe, } else { mat1 = data->poseMats + 12 * data->num_poses * frame; mat2 = data->poseMats + 12 * data->num_poses * oldframe; - + for( i = 0; i < data->num_poses; i++, joint++ ) { if( *joint >= 0 ) { float tmpMat[12]; @@ -976,7 +976,7 @@ static void ComputePoseMats( iqmData_t *data, int frame, int oldframe, backlerp, tmpMat ); Matrix34Multiply( mat + 12 * *joint, tmpMat, mat + 12*i ); - + } else { InterpolateMatrix( mat1 + 12*i, mat2 + 12*i, backlerp, mat ); @@ -1150,7 +1150,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) { } int R_IQMLerpTag( orientation_t *tag, iqmData_t *data, - int startFrame, int endFrame, + int startFrame, int endFrame, float frac, const char *tagName ) { float jointMats[IQM_MAX_JOINTS * 12]; int joint; diff --git a/shared/rd-rend2/tr_postprocess.cpp b/shared/rd-rend2/tr_postprocess.cpp index 9502cb50e7..35a8ba29d8 100644 --- a/shared/rd-rend2/tr_postprocess.cpp +++ b/shared/rd-rend2/tr_postprocess.cpp @@ -66,7 +66,7 @@ void RB_ToneMap(FBO_t *hdrFbo, vec4i_t hdrBox, FBO_t *ldrFbo, vec4i_t ldrBox, in // blend with old log luminance for gradual change VectorSet4(srcBox, 0, 0, 0, 0); - color[0] = + color[0] = color[1] = color[2] = 1.0f; @@ -97,14 +97,14 @@ RB_BokehBlur Blurs a part of one framebuffer to another. -Framebuffers can be identical. +Framebuffers can be identical. ============= */ void RB_BokehBlur(FBO_t *src, vec4i_t srcBox, FBO_t *dst, vec4i_t dstBox, float blur) { // vec4i_t srcBox, dstBox; vec4_t color; - + blur *= 10.0f; if (blur < 0.004f) @@ -229,7 +229,7 @@ static void RB_RadialBlur(FBO_t *srcFbo, FBO_t *dstFbo, int passes, float stretc { vec2_t texScale; - texScale[0] = + texScale[0] = texScale[1] = 1.0f; alpha *= inc; @@ -263,7 +263,7 @@ static void RB_RadialBlur(FBO_t *srcFbo, FBO_t *dstFbo, int passes, float stretc srcBox[2] = (s1 - s0) * glConfig.vidWidth; srcBox[3] = (t1 - t0) * glConfig.vidHeight; } - + FBO_Blit(srcFbo, srcBox, texScale, dstFbo, dstBox, &tr.textureColorShader, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ); scale *= mul; @@ -295,7 +295,7 @@ static qboolean RB_UpdateSunFlareVis(void) ri.Printf(PRINT_DEVELOPER, "Waited %d iterations\n", iter); } - + qglGetQueryObjectuiv(tr.sunFlareQuery[tr.sunFlareQueryIndex], GL_QUERY_RESULT, &sampleCount); return (qboolean)(sampleCount > 0); } @@ -348,7 +348,7 @@ void RB_SunRays(FBO_t *srcFbo, vec4i_t srcBox, FBO_t *dstFbo, vec4i_t dstBox) vec2_t texScale; vec4i_t rayBox, quarterBox; - texScale[0] = + texScale[0] = texScale[1] = 1.0f; VectorSet4(color, mul, mul, mul, 1); @@ -396,13 +396,13 @@ void RB_SunRays(FBO_t *srcFbo, vec4i_t srcBox, FBO_t *dstFbo, vec4i_t dstBox) stretch += stretch_add; } } - + // add result back on top of the main buffer { float mul = 1.f; vec2_t texScale; - texScale[0] = + texScale[0] = texScale[1] = 1.0f; VectorSet4(color, mul, mul, mul, 1); @@ -437,7 +437,7 @@ static void RB_BlurAxis(FBO_t *srcFbo, FBO_t *dstFbo, float strength, qboolean h vec4_t color; vec2_t texScale; - texScale[0] = + texScale[0] = texScale[1] = 1.0f; VectorSet4(color, weights[0], weights[0], weights[0], 1.0f); diff --git a/shared/rd-rend2/tr_scene.cpp b/shared/rd-rend2/tr_scene.cpp index 672505aac7..6bc6f51b83 100644 --- a/shared/rd-rend2/tr_scene.cpp +++ b/shared/rd-rend2/tr_scene.cpp @@ -143,7 +143,7 @@ void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts poly->hShader = hShader; poly->numVerts = numVerts; poly->verts = &backEndData->polyVerts[r_numpolyverts]; - + Com_Memcpy( poly->verts, &verts[numVerts*j], numVerts * sizeof( *verts ) ); // done. @@ -165,7 +165,7 @@ void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts AddPointToBounds( poly->verts[i].xyz, bounds[0], bounds[1] ); } for ( fogIndex = 1 ; fogIndex < tr.world->numfogs ; fogIndex++ ) { - fog = &tr.world->fogs[fogIndex]; + fog = &tr.world->fogs[fogIndex]; if ( bounds[1][0] >= fog->bounds[0][0] && bounds[1][1] >= fog->bounds[0][1] && bounds[1][2] >= fog->bounds[0][2] @@ -275,7 +275,7 @@ void RE_AddDynamicLightToScene( const vec3_t org, float intensity, float r, floa dl->color[1] = g; dl->color[2] = b; - if (r_hdr->integer) + if (r_hdr->integer) { float maxValue = MAX(r, MAX(g, b)); if (maxValue > 1.0f) @@ -285,7 +285,7 @@ void RE_AddDynamicLightToScene( const vec3_t org, float intensity, float r, floa } dl->radius = MIN(dl->radius, 65535.0f); } - + dl->additive = additive; } @@ -443,7 +443,7 @@ void RE_BeginScene(const refdef_t *fd) VectorCopy(extra->sunCol, tr.refdef.sunCol); VectorCopy(extra->sunAmbCol, tr.refdef.sunAmbCol); } - } + } else { tr.refdef.blurFactor = 0.0f; @@ -533,7 +533,7 @@ Rendering a scene may require multiple views to be rendered to handle mirrors, @@@@@@@@@@@@@@@@@@@@@ */ -void RE_RenderScene( const refdef_t *fd ) +void RE_RenderScene( const refdef_t *fd ) { int startTime; diff --git a/shared/rd-rend2/tr_shade.cpp b/shared/rd-rend2/tr_shade.cpp index 4dbb19e8ad..573ff6ee5e 100644 --- a/shared/rd-rend2/tr_shade.cpp +++ b/shared/rd-rend2/tr_shade.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // tr_shade.c -#include "tr_local.h" +#include "tr_local.h" #include "tr_allocator.h" /* @@ -195,7 +195,7 @@ static void ComputeTexMods( shaderStage_t *pStage, int bundleNum, float *outMatr for ( tm = 0; tm < bundle->numTexMods ; tm++ ) { switch ( bundle->texMods[tm].type ) { - + case TMOD_NONE: tm = TR_MAX_TEXMODS; // break out of for loop break; @@ -217,9 +217,9 @@ static void ComputeTexMods( shaderStage_t *pStage, int bundleNum, float *outMatr RB_CalcScaleTexMatrix( bundle->texMods[tm].scale, matrix ); break; - + case TMOD_STRETCH: - RB_CalcStretchTexMatrix( &bundle->texMods[tm].wave, + RB_CalcStretchTexMatrix( &bundle->texMods[tm].wave, matrix ); break; @@ -239,7 +239,7 @@ static void ComputeTexMods( shaderStage_t *pStage, int bundleNum, float *outMatr } switch ( bundle->texMods[tm].type ) - { + { case TMOD_NONE: case TMOD_TURBULENT: default: @@ -276,14 +276,14 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t colorGen_t rgbGen = pStage->rgbGen; alphaGen_t alphaGen = pStage->alphaGen; - baseColor[0] = - baseColor[1] = - baseColor[2] = - baseColor[3] = 1.0f; - - vertColor[0] = - vertColor[1] = - vertColor[2] = + baseColor[0] = + baseColor[1] = + baseColor[2] = + baseColor[3] = 1.0f; + + vertColor[0] = + vertColor[1] = + vertColor[2] = vertColor[3] = 0.0f; if ( forceRGBGen != NULL && *forceRGBGen != CGEN_BAD ) @@ -299,20 +299,20 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t switch ( rgbGen ) { case CGEN_IDENTITY_LIGHTING: - baseColor[0] = + baseColor[0] = baseColor[1] = baseColor[2] = tr.identityLight; break; case CGEN_EXACT_VERTEX: case CGEN_EXACT_VERTEX_LIT: - baseColor[0] = + baseColor[0] = baseColor[1] = - baseColor[2] = + baseColor[2] = baseColor[3] = 0.0f; vertColor[0] = vertColor[1] = - vertColor[2] = + vertColor[2] = vertColor[3] = 1.0f; break; case CGEN_CONST: @@ -322,7 +322,7 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t baseColor[3] = pStage->constantColor[3]; break; case CGEN_VERTEX: - baseColor[0] = + baseColor[0] = baseColor[1] = baseColor[2] = baseColor[3] = 0.0f; @@ -333,18 +333,18 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t vertColor[3] = 1.0f; break; case CGEN_VERTEX_LIT: - baseColor[0] = + baseColor[0] = baseColor[1] = - baseColor[2] = + baseColor[2] = baseColor[3] = 0.0f; vertColor[0] = vertColor[1] = - vertColor[2] = + vertColor[2] = vertColor[3] = tr.identityLight; break; case CGEN_ONE_MINUS_VERTEX: - baseColor[0] = + baseColor[0] = baseColor[1] = baseColor[2] = tr.identityLight; @@ -359,8 +359,8 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t } break; case CGEN_WAVEFORM: - baseColor[0] = - baseColor[1] = + baseColor[0] = + baseColor[1] = baseColor[2] = RB_CalcWaveColorSingle( &pStage->rgbWave ); break; case CGEN_ENTITY: @@ -460,9 +460,9 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t { *forceRGBGen = rgbGen; } - + // multiply color by overbrightbits if this isn't a blend - if (tr.overbrightBits + if (tr.overbrightBits && !((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_DST_COLOR) && !((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_ONE_MINUS_DST_COLOR) && !((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_SRC_COLOR) @@ -484,7 +484,7 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t if(r_greyscale->integer) { int scale; - + for(i = 0; i < tess.numVertexes; i++) { scale = (tess.svars.colors[i][0] + tess.svars.colors[i][1] + tess.svars.colors[i][2]) / 3; @@ -1045,7 +1045,7 @@ static void RB_FogPass( shaderCommands_t *input, const VertexArraysProperties *v if (glState.skeletalAnimation) shaderBits |= FOGDEF_USE_SKELETAL_ANIMATION; - if (tr.world && tr.world->globalFog && + if (tr.world && tr.world->globalFog && input->fogNum != tr.world->globalFogIndex && input->shader->sort != SS_FOG) shaderBits |= FOGDEF_USE_FALLBACK_GLOBAL_FOG; @@ -1053,7 +1053,7 @@ static void RB_FogPass( shaderCommands_t *input, const VertexArraysProperties *v if (input->numPasses > 0) if (input->xstages[0]->alphaTestType != ALPHA_TEST_NONE) shaderBits |= FOGDEF_USE_ALPHA_TEST; - + shaderProgram_t *sp = tr.fogShader + shaderBits; backEnd.pc.c_fogDraws++; @@ -1063,7 +1063,7 @@ static void RB_FogPass( shaderCommands_t *input, const VertexArraysProperties *v uniformDataWriter.SetUniformInt(UNIFORM_FOGINDEX, input->fogNum - 1); if (input->numPasses > 0) uniformDataWriter.SetUniformInt(UNIFORM_ALPHA_TEST_TYPE, input->xstages[0]->alphaTestType); - + uint32_t stateBits = GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA; if ( tess.shader->fogPass == FP_EQUAL ) stateBits |= GLS_DEPTHFUNC_EQUAL; @@ -1313,7 +1313,7 @@ static shaderProgram_t *SelectShaderProgram( int stageIndex, shaderStage_t *stag if (glState.skeletalAnimation) { index |= LIGHTDEF_USE_SKELETAL_ANIMATION; - } + } } if ( !useAlphaTestGE192 ) @@ -1497,7 +1497,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input, const VertexArrays assert(sp); uniformDataWriter.Start(sp); - + if ( input->fogNum ) { vec4_t fogColorMask; ComputeFogColorMask(pStage, fogColorMask); @@ -1536,7 +1536,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input, const VertexArrays if (backEnd.currentEntity->e.renderfx & RF_FORCE_ENT_ALPHA) { - baseColor[3] = backEnd.currentEntity->e.shaderRGBA[3] / 255.0f; + baseColor[3] = backEnd.currentEntity->e.shaderRGBA[3] / 255.0f; vertColor[3] = 0.0f; } @@ -1601,7 +1601,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input, const VertexArrays texMatrix[0] = texMatrix[3] = input->texCoords[input->firstIndex][0][0]; else #endif - ComputeTexMods(pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb); + ComputeTexMods(pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb); uniformDataWriter.SetUniformVec4(UNIFORM_DIFFUSETEXMATRIX, texMatrix); uniformDataWriter.SetUniformVec4(UNIFORM_DIFFUSETEXOFFTURB, texOffTurb); @@ -1785,7 +1785,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input, const VertexArrays samplerBindingsWriter.AddAnimatedImage(&pStage->bundle[0], 0); samplerBindingsWriter.AddAnimatedImage(&pStage->bundle[1], 1); } - else + else { // // set state @@ -1811,7 +1811,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input, const VertexArrays uniformDataWriter.SetUniformVec4(UNIFORM_CUBEMAPINFO, vec); } - + if (enableDLights) { uniformDataWriter.SetUniformInt(UNIFORM_LIGHTMASK, tess.dlightBits); @@ -1880,7 +1880,7 @@ void RB_StageIteratorGeneric( void ) // // log this call // - if ( r_logFile->integer ) + if ( r_logFile->integer ) { // don't just call LogComment, or we will get // a call to va() every frame! @@ -1889,7 +1889,7 @@ void RB_StageIteratorGeneric( void ) // // update vertex buffer data - // + // uint32_t vertexAttribs = RB_CalcShaderVertexAttribs( input->shader ); if (tess.useInternalVBO) { @@ -2008,7 +2008,7 @@ void RB_EndSurface( void ) { if (input->indexes[SHADER_MAX_INDEXES-1] != 0) { ri.Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_INDEXES hit"); - } + } if (input->xyz[SHADER_MAX_VERTEXES-1][0] != 0) { ri.Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_VERTEXES hit"); } diff --git a/shared/rd-rend2/tr_shade_calc.cpp b/shared/rd-rend2/tr_shade_calc.cpp index 3eb4208eb5..e827f128ce 100644 --- a/shared/rd-rend2/tr_shade_calc.cpp +++ b/shared/rd-rend2/tr_shade_calc.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define WAVEVALUE( table, base, amplitude, phase, freq ) ((base) + table[ Q_ftol( ( ( (phase) + tess.shaderTime * (freq) ) * FUNCTABLE_SIZE ) ) & FUNCTABLE_MASK ] * (amplitude)) -static float *TableForFunc( genFunc_t func ) +static float *TableForFunc( genFunc_t func ) { switch ( func ) { @@ -54,7 +54,7 @@ static float *TableForFunc( genFunc_t func ) ** ** Evaluates a given waveForm_t, referencing backEnd.refdef.time directly */ -static float EvalWaveForm( const waveForm_t *wf ) +static float EvalWaveForm( const waveForm_t *wf ) { float *table; @@ -133,7 +133,7 @@ void RB_CalcDeformVertexes( deformStage_t *ds ) for ( i = 0; i < tess.numVertexes; i++, xyz += 4, normal++ ) { R_VboUnpackNormal(offset, *normal); - + xyz[0] += offset[0] * scale; xyz[1] += offset[1] * scale; xyz[2] += offset[2] * scale; @@ -147,7 +147,7 @@ void RB_CalcDeformVertexes( deformStage_t *ds ) { float off = ( xyz[0] + xyz[1] + xyz[2] ) * ds->deformationSpread; - scale = WAVEVALUE( table, ds->deformationWave.base, + scale = WAVEVALUE( table, ds->deformationWave.base, ds->deformationWave.amplitude, ds->deformationWave.phase + off, ds->deformationWave.frequency ); @@ -225,7 +225,7 @@ void RB_CalcBulgeVertexes( deformStage_t *ds ) { off = (float)( FUNCTABLE_SIZE / (M_PI*2) ) * ( st[0] * ds->bulgeWidth + now ); scale = tr.sinTable[ off & FUNCTABLE_MASK ] * ds->bulgeHeight; - + xyz[0] += fNormal[0] * scale; xyz[1] += fNormal[1] * scale; xyz[2] += fNormal[2] * scale; @@ -249,7 +249,7 @@ void RB_CalcMoveVertexes( deformStage_t *ds ) { table = TableForFunc( ds->deformationWave.func ); - scale = WAVEVALUE( table, ds->deformationWave.base, + scale = WAVEVALUE( table, ds->deformationWave.base, ds->deformationWave.amplitude, ds->deformationWave.phase, ds->deformationWave.frequency ); @@ -486,7 +486,7 @@ static void Autosprite2Deform( void ) { v2 = xyz + 4 * edgeVerts[j][1]; VectorSubtract( v1, v2, temp ); - + l = DotProduct( temp, temp ); if ( l < lengths[0] ) { nums[1] = nums[0]; @@ -514,7 +514,7 @@ static void Autosprite2Deform( void ) { // cross this with the view direction to get minor axis CrossProduct( major, forward, minor ); VectorNormalize( minor ); - + // re-project the points for ( j = 0 ; j < 2 ; j++ ) { float l; @@ -523,7 +523,7 @@ static void Autosprite2Deform( void ) { v2 = xyz + 4 * edgeVerts[nums[j]][1]; l = 0.5 * sqrt( lengths[j] ); - + // we need to see which direction this edge // is used to determine direction of projection for ( k = 0 ; k < 5 ; k++ ) { @@ -625,7 +625,7 @@ float RB_CalcWaveColorSingle( const waveForm_t *wf ) } else { glow = EvalWaveForm( wf ) * tr.identityLight; } - + if ( glow < 0 ) { glow = 0; } @@ -708,11 +708,11 @@ void RB_CalcFogTexCoords( float *st ) { // rotate the gradient vector for this orientation if ( fog->hasSurface ) { - fogDepthVector[0] = fog->surface[0] * backEnd.ori.axis[0][0] + + fogDepthVector[0] = fog->surface[0] * backEnd.ori.axis[0][0] + fog->surface[1] * backEnd.ori.axis[0][1] + fog->surface[2] * backEnd.ori.axis[0][2]; - fogDepthVector[1] = fog->surface[0] * backEnd.ori.axis[1][0] + + fogDepthVector[1] = fog->surface[0] * backEnd.ori.axis[1][0] + fog->surface[1] * backEnd.ori.axis[1][1] + fog->surface[2] * backEnd.ori.axis[1][2]; - fogDepthVector[2] = fog->surface[0] * backEnd.ori.axis[2][0] + + fogDepthVector[2] = fog->surface[0] * backEnd.ori.axis[2][0] + fog->surface[1] * backEnd.ori.axis[2][1] + fog->surface[2] * backEnd.ori.axis[2][2]; fogDepthVector[3] = -fog->surface[3] + DotProduct( backEnd.ori.origin, fog->surface ); @@ -738,7 +738,7 @@ void RB_CalcFogTexCoords( float *st ) { s = DotProduct( v, fogDistanceVector ) + fogDistanceVector[3]; t = DotProduct( v, fogDepthVector ) + fogDepthVector[3]; - // partially clipped fogs use the T axis + // partially clipped fogs use the T axis if ( eyeOutside ) { if ( t < 1.0 ) { t = 1.0/32; // point is outside, so no fogging diff --git a/shared/rd-rend2/tr_shader.cpp b/shared/rd-rend2/tr_shader.cpp index 90718be7c2..30383052e4 100644 --- a/shared/rd-rend2/tr_shader.cpp +++ b/shared/rd-rend2/tr_shader.cpp @@ -27,7 +27,7 @@ static char *s_shaderText; // the shader is parsed into these global variables, then copied into // dynamically allocated memory if it is valid. -static shaderStage_t stages[MAX_SHADER_STAGES]; +static shaderStage_t stages[MAX_SHADER_STAGES]; static shader_t shader; static texModInfo_t texMods[MAX_SHADER_STAGES][TR_MAX_TEXMODS]; @@ -51,31 +51,31 @@ static shader_t* hashTable[FILE_HASH_SIZE]; #define MAX_SHADERTEXT_HASH 2048 static char **shaderTextHashTable[MAX_SHADERTEXT_HASH] = { 0 }; -const int lightmapsNone[MAXLIGHTMAPS] = -{ +const int lightmapsNone[MAXLIGHTMAPS] = +{ LIGHTMAP_NONE, LIGHTMAP_NONE, LIGHTMAP_NONE, - LIGHTMAP_NONE + LIGHTMAP_NONE }; -const int lightmaps2d[MAXLIGHTMAPS] = -{ +const int lightmaps2d[MAXLIGHTMAPS] = +{ LIGHTMAP_2D, LIGHTMAP_2D, LIGHTMAP_2D, - LIGHTMAP_2D + LIGHTMAP_2D }; -const int lightmapsVertex[MAXLIGHTMAPS] = -{ +const int lightmapsVertex[MAXLIGHTMAPS] = +{ LIGHTMAP_BY_VERTEX, LIGHTMAP_BY_VERTEX, LIGHTMAP_BY_VERTEX, - LIGHTMAP_BY_VERTEX + LIGHTMAP_BY_VERTEX }; -const int lightmapsFullBright[MAXLIGHTMAPS] = +const int lightmapsFullBright[MAXLIGHTMAPS] = { LIGHTMAP_WHITEIMAGE, LIGHTMAP_WHITEIMAGE, @@ -83,7 +83,7 @@ const int lightmapsFullBright[MAXLIGHTMAPS] = LIGHTMAP_WHITEIMAGE }; -const byte stylesDefault[MAXLIGHTMAPS] = +const byte stylesDefault[MAXLIGHTMAPS] = { LS_NORMAL, LS_LSNONE, @@ -253,7 +253,7 @@ ParseAlphaTestFunc =============== */ static void ParseAlphaTestFunc( shaderStage_t *stage, const char *funcname ) -{ +{ stage->alphaTestType = ALPHA_TEST_NONE; if ( !Q_stricmp( funcname, "GT0" ) ) @@ -620,7 +620,7 @@ static void ParseTexMod( const char *_text, shaderStage_t *stage ) return; } tmi->wave.frequency = atof( token ); - + tmi->type = TMOD_STRETCH; } // @@ -1232,7 +1232,7 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text ) else if ( !Q_stricmp( token, "map" ) || (!Q_stricmp(token, "clampmap"))) { int flags = !Q_stricmp(token, "clampmap") ? IMGFLAG_CLAMPTOEDGE : IMGFLAG_NONE; - + token = COM_ParseExt( text, qfalse ); if ( !token[0] ) { @@ -1385,7 +1385,7 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text ) ri.Printf(PRINT_WARNING, "WARNING: R_FindImageFile could not find specMap '%s' in shader '%s'\n", token, shader.name); return qfalse; } - + } // // rmoMap || rmosMap @@ -1619,8 +1619,8 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text ) ri.Printf( PRINT_WARNING, "WARNING: missing parameter for specular reflectance in shader '%s'\n", shader.name ); continue; } - stage->specularScale[0] = - stage->specularScale[1] = + stage->specularScale[0] = + stage->specularScale[1] = stage->specularScale[2] = Com_Clamp( 0.0f, 1.0f, atof( token ) ); } // @@ -1638,13 +1638,13 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text ) } exponent = atof( token ); - // Change shininess to gloss - // FIXME: assumes max exponent of 8192 and min of 1, must change here if altered in lightall_fp.glsl - exponent = CLAMP(exponent, 1.0, 8192.0); + // Change shininess to gloss + // FIXME: assumes max exponent of 8192 and min of 1, must change here if altered in lightall_fp.glsl + exponent = CLAMP(exponent, 1.0, 8192.0); stage->specularScale[3] = 1.0f - (log(exponent) / log(8192.0)); } // - // gloss + // gloss // else if ( !Q_stricmp( token, "gloss" ) ) { @@ -1876,7 +1876,7 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text ) } } // - // alphaGen + // alphaGen // else if ( !Q_stricmp( token, "alphaGen" ) ) { @@ -1953,7 +1953,7 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text ) // // tcGen // - else if ( !Q_stricmp(token, "texgen") || !Q_stricmp( token, "tcGen" ) ) + else if ( !Q_stricmp(token, "texgen") || !Q_stricmp( token, "tcGen" ) ) { token = COM_ParseExt( text, qfalse ); if ( token[0] == 0 ) @@ -1985,7 +1985,7 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text ) stage->bundle[0].tcGen = TCGEN_VECTOR; } - else + else { ri.Printf( PRINT_WARNING, "WARNING: unknown texgen parm in shader '%s'\n", shader.name ); } @@ -2154,7 +2154,7 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text ) // if ( stage->rgbGen == CGEN_BAD ) { if ( blendSrcBits == 0 || - blendSrcBits == GLS_SRCBLEND_ONE || + blendSrcBits == GLS_SRCBLEND_ONE || blendSrcBits == GLS_SRCBLEND_SRC_ALPHA ) { stage->rgbGen = CGEN_IDENTITY_LIGHTING; } else { @@ -2166,7 +2166,7 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text ) // // implicitly assume that a GL_ONE GL_ZERO blend mask disables blending // - if ( ( blendSrcBits == GLS_SRCBLEND_ONE ) && + if ( ( blendSrcBits == GLS_SRCBLEND_ONE ) && ( blendDstBits == GLS_DSTBLEND_ZERO ) ) { blendDstBits = blendSrcBits = 0; @@ -2184,8 +2184,8 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text ) // // compute state bits // - stage->stateBits = depthMaskBits | - blendSrcBits | blendDstBits | + stage->stateBits = depthMaskBits | + blendSrcBits | blendDstBits | depthFuncBits; return qtrue; @@ -2241,7 +2241,7 @@ static void ParseDeform( const char **text ) { if ( !Q_stricmpn( token, "text", 4 ) ) { int n; - + n = token[4] - '0'; if ( n < 0 || n > 7 ) { n = 0; @@ -2450,7 +2450,7 @@ void ParseSort( const char **text ) { shader.sort = SS_MID_OUTSIDE; } else if ( !Q_stricmp( token, "outside" ) ) { shader.sort = SS_OUTSIDE; - } + } else { shader.sort = atof( token ); } @@ -2466,20 +2466,20 @@ const char *materialNames[MATERIAL_LAST] = MATERIALS }; -void ParseMaterial( const char **text ) +void ParseMaterial( const char **text ) { char *token; int i; token = COM_ParseExt( text, qfalse ); - if ( token[0] == 0 ) + if ( token[0] == 0 ) { Com_Printf (S_COLOR_YELLOW "WARNING: missing material in shader '%s'\n", shader.name ); return; } for(i = 0; i < MATERIAL_LAST; i++) { - if ( !Q_stricmp( token, materialNames[i] ) ) + if ( !Q_stricmp( token, materialNames[i] ) ) { shader.surfaceFlags |= i; break; @@ -2501,13 +2501,13 @@ infoParm_t infoParms[] = { { "nonopaque", ~CONTENTS_OPAQUE, SURF_NONE, CONTENTS_NONE }, // special hack to clear opaque flag { "lava", ~CONTENTS_SOLID, SURF_NONE, CONTENTS_LAVA }, // very damaging { "slime", ~CONTENTS_SOLID, SURF_NONE, CONTENTS_SLIME }, // mildly damaging - { "water", ~CONTENTS_SOLID, SURF_NONE, CONTENTS_WATER }, // + { "water", ~CONTENTS_SOLID, SURF_NONE, CONTENTS_WATER }, // { "fog", ~CONTENTS_SOLID, SURF_NONE, CONTENTS_FOG}, // carves surfaces entering { "shotclip", ~CONTENTS_SOLID, SURF_NONE, CONTENTS_SHOTCLIP }, // block shots, but not people { "playerclip", ~(CONTENTS_SOLID|CONTENTS_OPAQUE), SURF_NONE, CONTENTS_PLAYERCLIP }, // block only the player - { "monsterclip", ~(CONTENTS_SOLID|CONTENTS_OPAQUE), SURF_NONE, CONTENTS_MONSTERCLIP }, // + { "monsterclip", ~(CONTENTS_SOLID|CONTENTS_OPAQUE), SURF_NONE, CONTENTS_MONSTERCLIP }, // { "botclip", ~(CONTENTS_SOLID|CONTENTS_OPAQUE), SURF_NONE, CONTENTS_BOTCLIP }, // for bots - { "trigger", ~(CONTENTS_SOLID|CONTENTS_OPAQUE), SURF_NONE, CONTENTS_TRIGGER }, // + { "trigger", ~(CONTENTS_SOLID|CONTENTS_OPAQUE), SURF_NONE, CONTENTS_TRIGGER }, // { "nodrop", ~(CONTENTS_SOLID|CONTENTS_OPAQUE), SURF_NONE, CONTENTS_NODROP }, // don't drop items or leave bodies (death fog, lava, etc) { "terrain", ~(CONTENTS_SOLID|CONTENTS_OPAQUE), SURF_NONE, CONTENTS_TERRAIN }, // use special terrain collsion { "ladder", ~(CONTENTS_SOLID|CONTENTS_OPAQUE), SURF_NONE, CONTENTS_LADDER }, // climb up in it like water @@ -2520,17 +2520,17 @@ infoParm_t infoParms[] = { /* Game surface flags */ { "sky", CONTENTS_ALL, SURF_SKY, CONTENTS_NONE }, // emit light from an environment map - { "slick", CONTENTS_ALL, SURF_SLICK, CONTENTS_NONE }, // + { "slick", CONTENTS_ALL, SURF_SLICK, CONTENTS_NONE }, // - { "nodamage", CONTENTS_ALL, SURF_NODAMAGE, CONTENTS_NONE }, // + { "nodamage", CONTENTS_ALL, SURF_NODAMAGE, CONTENTS_NONE }, // { "noimpact", CONTENTS_ALL, SURF_NOIMPACT, CONTENTS_NONE }, // don't make impact explosions or marks { "nomarks", CONTENTS_ALL, SURF_NOMARKS, CONTENTS_NONE }, // don't make impact marks, but still explode { "nodraw", CONTENTS_ALL, SURF_NODRAW, CONTENTS_NONE }, // don't generate a drawsurface (or a lightmap) - { "nosteps", CONTENTS_ALL, SURF_NOSTEPS, CONTENTS_NONE }, // + { "nosteps", CONTENTS_ALL, SURF_NOSTEPS, CONTENTS_NONE }, // { "nodlight", CONTENTS_ALL, SURF_NODLIGHT, CONTENTS_NONE }, // don't ever add dynamic lights - { "metalsteps", CONTENTS_ALL, SURF_METALSTEPS, CONTENTS_NONE }, // + { "metalsteps", CONTENTS_ALL, SURF_METALSTEPS, CONTENTS_NONE }, // { "nomiscents", CONTENTS_ALL, SURF_NOMISCENTS, CONTENTS_NONE }, // No misc ents on this surface - { "forcefield", CONTENTS_ALL, SURF_FORCEFIELD, CONTENTS_NONE }, // + { "forcefield", CONTENTS_ALL, SURF_FORCEFIELD, CONTENTS_NONE }, // { "forcesight", CONTENTS_ALL, SURF_FORCESIGHT, CONTENTS_NONE }, // only visible with force sight }; @@ -2623,7 +2623,7 @@ static qboolean ParseShader( const char **text ) else if ( !Q_stricmp( token, "material" ) || !Q_stricmp( token, "q3map_material" ) ) { ParseMaterial( text ); - } + } // sun parms else if ( !Q_stricmp( token, "sun" ) || !Q_stricmp( token, "q3map_sun" ) || !Q_stricmp( token, "q3map_sunExt" ) || !Q_stricmp( token, "q3gl2_sun" ) ) { float a, b; @@ -2641,7 +2641,7 @@ static qboolean ParseShader( const char **text ) tr.sunLight[1] = atof( token ); token = COM_ParseExt( text, qfalse ); tr.sunLight[2] = atof( token ); - + VectorNormalize( tr.sunLight ); token = COM_ParseExt( text, qfalse ); @@ -2782,7 +2782,7 @@ static qboolean ParseShader( const char **text ) continue; } // fogParms - else if ( !Q_stricmp( token, "fogParms" ) ) + else if ( !Q_stricmp( token, "fogParms" ) ) { if ( !ParseVector( text, 3, shader.fogParms.color ) ) { return qfalse; @@ -2796,7 +2796,7 @@ static qboolean ParseShader( const char **text ) } token = COM_ParseExt( text, qfalse ); - if ( !token[0] ) + if ( !token[0] ) { ri.Printf( PRINT_WARNING, "WARNING: missing parm for 'fogParms' keyword in shader '%s'\n", shader.name ); continue; @@ -2821,13 +2821,13 @@ static qboolean ParseShader( const char **text ) continue; } // light determines flaring in q3map, not needed here - else if ( !Q_stricmp(token, "light") ) + else if ( !Q_stricmp(token, "light") ) { COM_ParseExt( text, qfalse ); continue; } // cull - else if ( !Q_stricmp( token, "cull") ) + else if ( !Q_stricmp( token, "cull") ) { token = COM_ParseExt( text, qfalse ); if ( token[0] == 0 ) @@ -3002,7 +3002,7 @@ static void ComputeVertexAttribs(void) { shaderStage_t *pStage = &stages[stage]; - if ( !pStage->active ) + if ( !pStage->active ) { break; } @@ -3131,8 +3131,8 @@ static void CollapseStagesToLightall(shaderStage_t *stage, shaderStage_t *lightm image_t *diffuseImg; if (stage->bundle[TB_NORMALMAP].image[0]) { - if (stage->bundle[TB_NORMALMAP].image[0]->type == IMGTYPE_NORMALHEIGHT && - r_parallaxMapping->integer && + if (stage->bundle[TB_NORMALMAP].image[0]->type == IMGTYPE_NORMALHEIGHT && + r_parallaxMapping->integer && defs & LIGHTDEF_LIGHTTYPE_MASK) defs |= LIGHTDEF_USE_PARALLAXMAP; //ri.Printf(PRINT_ALL, ", normalmap %s", stage->bundle[TB_NORMALMAP].image[0]->imgName); @@ -3213,7 +3213,7 @@ static void CollapseStagesToLightall(shaderStage_t *stage, shaderStage_t *lightm Q_strcat(imageName, MAX_QPATH, "_rmo"); stage->specularType = SPEC_RMO; R_LoadPackedMaterialImage(stage, imageName, specularFlags); - + if (!stage->bundle[TB_ORMSMAP].image[0]) { COM_StripExtension(diffuseImg->imgName, imageName, MAX_QPATH); @@ -3301,7 +3301,7 @@ static qboolean CollapseStagesToGLSL(void) pStage->bundle[0].tcGen <= TCGEN_LIGHTMAP3) { int blendBits = pStage->stateBits & ( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS ); - + if (blendBits != (GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO) && blendBits != (GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR) && blendBits != (GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE)) //lightstyle lightmap stages @@ -3522,7 +3522,7 @@ static qboolean CollapseStagesToGLSL(void) if (pStage->adjustColorsForFog) continue; - if (pStage->bundle[TB_DIFFUSEMAP].tcGen >= TCGEN_LIGHTMAP + if (pStage->bundle[TB_DIFFUSEMAP].tcGen >= TCGEN_LIGHTMAP && pStage->bundle[TB_DIFFUSEMAP].tcGen <= TCGEN_LIGHTMAP3 && pStage->rgbGen != CGEN_LIGHTMAPSTYLE) //don't convert lightstyled lightmap stages { @@ -3708,7 +3708,7 @@ static void SortNewShader( void ) { { break; } - + tr.sortedShaders[i+1] = shader; tr.sortedShaders[i+1]->sortedIndex++; } @@ -3781,7 +3781,7 @@ static shader_t *GeneratePermanentShader( void ) { tr.shaders[ tr.numShaders ] = newShader; newShader->index = tr.numShaders; - + tr.sortedShaders[ tr.numShaders ] = newShader; newShader->sortedIndex = tr.numShaders; @@ -3869,7 +3869,7 @@ static void VertexLightingCollapse( void ) { } else { stages[0].rgbGen = CGEN_EXACT_VERTEX; } - stages[0].alphaGen = AGEN_SKIP; + stages[0].alphaGen = AGEN_SKIP; } else { // don't use a lightmap (tesla coils) if ( stages[0].bundle[0].isLightmap ) { @@ -4090,23 +4090,23 @@ static shader_t *FinishShader( void ) { if ( pStage->isDetail && !r_detailTextures->integer ) { int index; - + for(index = stage + 1; index < MAX_SHADER_STAGES; index++) { if(!stages[index].active) break; } - + if(index < MAX_SHADER_STAGES) memmove(pStage, pStage + 1, sizeof(*pStage) * (index - stage)); else { if(stage + 1 < MAX_SHADER_STAGES) memmove(pStage, pStage + 1, sizeof(*pStage) * (index - stage - 1)); - + Com_Memset(&stages[index - 1], 0, sizeof(*stages)); } - + continue; } @@ -4181,7 +4181,7 @@ static shader_t *FinishShader( void ) { } } } - + stage++; } @@ -4276,7 +4276,7 @@ static const char *FindShaderInShaderText( const char *shadername ) { { p = shaderTextHashTable[hash][i]; token = COM_ParseExt(&p, qtrue); - + if(!Q_stricmp(token, shadername)) return p; } @@ -4596,7 +4596,7 @@ shader_t *R_FindShader( const char *name, const int *lightmapIndexes, const byte return FinishShader(); } -shader_t *R_FindServerShader( const char *name, const int *lightmapIndexes, const byte *styles, qboolean mipRawImage ) +shader_t *R_FindServerShader( const char *name, const int *lightmapIndexes, const byte *styles, qboolean mipRawImage ) { char strippedName[MAX_QPATH]; int hash; @@ -4628,7 +4628,7 @@ shader_t *R_FindServerShader( const char *name, const int *lightmapIndexes, cons ClearGlobalShader(); Q_strncpyz(shader.name, strippedName, sizeof(shader.name)); Com_Memcpy (shader.lightmapIndex, lightmapIndexes, sizeof (shader.lightmapIndex)); - + shader.defaultShader = qtrue; return FinishShader(); } @@ -4722,11 +4722,11 @@ qhandle_t RE_RegisterShaderFromImage(const char *name, const int *lightmapIndexe } sh = FinishShader(); - return sh->index; + return sh->index; } -/* +/* ==================== RE_RegisterShader @@ -4760,7 +4760,7 @@ qhandle_t RE_RegisterShaderLightMap( const char *name, const int *lightmapIndexe } -/* +/* ==================== RE_RegisterShader diff --git a/shared/rd-rend2/tr_skin.cpp b/shared/rd-rend2/tr_skin.cpp index 6924083004..b5ba142159 100644 --- a/shared/rd-rend2/tr_skin.cpp +++ b/shared/rd-rend2/tr_skin.cpp @@ -49,9 +49,9 @@ bool RE_SplitSkins(const char *INname, char *skinhead, char *skintorso, char *sk strcpy (skinlower, name); //now get the the individual files - + //advance to second - char *p2 = strchr(p, '|'); + char *p2 = strchr(p, '|'); assert(p2); if (!p2) { @@ -77,14 +77,14 @@ bool RE_SplitSkins(const char *INname, char *skinhead, char *skintorso, char *sk strcat (skinlower,p); strcat (skinlower, ".skin"); - + return true; } return false; } // given a name, go get the skin we want and return -qhandle_t RE_RegisterIndividualSkin( const char *name , qhandle_t hSkin) +qhandle_t RE_RegisterIndividualSkin( const char *name , qhandle_t hSkin) { skin_t *skin; skinSurface_t *surf; @@ -124,7 +124,7 @@ qhandle_t RE_RegisterIndividualSkin( const char *name , qhandle_t hSkin) if ( !strncmp( token, "tag_", 4 ) ) { //these aren't in there, but just in case you load an id style one... continue; } - + // parse the shader name token = CommaParse( &text_p ); @@ -279,13 +279,13 @@ static char *CommaParse( char **data_p ) { data++; } // skip /* */ comments - else if ( c=='/' && data[1] == '*' ) + else if ( c=='/' && data[1] == '*' ) { - while ( *data && ( *data != '*' || data[1] != '/' ) ) + while ( *data && ( *data != '*' || data[1] != '/' ) ) { data++; } - if ( *data ) + if ( *data ) { data += 2; } @@ -475,7 +475,7 @@ void R_SkinList_f( void ) { Com_Printf ("%3i:%s\n", i, skin->name ); for ( j = 0 ; j < skin->numSurfaces ; j++ ) { - Com_Printf (" %s = %s\n", + Com_Printf (" %s = %s\n", skin->surfaces[j]->name, ((shader_t* )skin->surfaces[j]->shader)->name ); } } diff --git a/shared/rd-rend2/tr_sky.cpp b/shared/rd-rend2/tr_sky.cpp index 98a60c6058..9f9d8eb148 100644 --- a/shared/rd-rend2/tr_sky.cpp +++ b/shared/rd-rend2/tr_sky.cpp @@ -36,14 +36,14 @@ POLYGON TO BOX SIDE PROJECTION =================================================================================== */ -static vec3_t sky_clip[6] = +static vec3_t sky_clip[6] = { {1,1,0}, {1,-1,0}, {0,-1,1}, {0,1,1}, {1,0,1}, - {-1,0,1} + {-1,0,1} }; static float sky_mins[2][6], sky_maxs[2][6]; @@ -54,7 +54,7 @@ static float sky_min, sky_max; AddSkyPolygon ================ */ -static void AddSkyPolygon (int nump, vec3_t vecs) +static void AddSkyPolygon (int nump, vec3_t vecs) { int i,j; vec3_t v, av; @@ -147,7 +147,7 @@ static void AddSkyPolygon (int nump, vec3_t vecs) ClipSkyPolygon ================ */ -static void ClipSkyPolygon (int nump, vec3_t vecs, int stage) +static void ClipSkyPolygon (int nump, vec3_t vecs, int stage) { float *norm; float *v; @@ -266,10 +266,10 @@ void RB_ClipSkyPolygons( shaderCommands_t *input ) for ( i = 0; i < input->numIndexes; i += 3 ) { - for (j = 0 ; j < 3 ; j++) + for (j = 0 ; j < 3 ; j++) { VectorSubtract( input->xyz[input->indexes[i+j]], - backEnd.viewParms.ori.origin, + backEnd.viewParms.ori.origin, p[j] ); } ClipSkyPolygon( 3, p[0], 0 ); @@ -369,7 +369,7 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max int maxIndex = tess.maxIndex; tess.firstIndex = tess.numIndexes; - + for ( t = mins[1]+HALF_SKY_SUBDIVISIONS; t <= maxs[1]+HALF_SKY_SUBDIVISIONS; t++ ) { @@ -482,7 +482,7 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max RB_AddDrawItem(backEndData->currentPass, key, item); RB_CommitInternalBufferData(); - + tess.useInternalVBO = qfalse; tess.numIndexes = tess.firstIndex; tess.numVertexes = firstVertex; @@ -521,22 +521,22 @@ static void DrawSkyBox( shader_t *shader ) sky_maxs_subd[0] = sky_maxs[0][i] * HALF_SKY_SUBDIVISIONS; sky_maxs_subd[1] = sky_maxs[1][i] * HALF_SKY_SUBDIVISIONS; - if ( sky_mins_subd[0] < -HALF_SKY_SUBDIVISIONS ) + if ( sky_mins_subd[0] < -HALF_SKY_SUBDIVISIONS ) sky_mins_subd[0] = -HALF_SKY_SUBDIVISIONS; - else if ( sky_mins_subd[0] > HALF_SKY_SUBDIVISIONS ) + else if ( sky_mins_subd[0] > HALF_SKY_SUBDIVISIONS ) sky_mins_subd[0] = HALF_SKY_SUBDIVISIONS; if ( sky_mins_subd[1] < -HALF_SKY_SUBDIVISIONS ) sky_mins_subd[1] = -HALF_SKY_SUBDIVISIONS; - else if ( sky_mins_subd[1] > HALF_SKY_SUBDIVISIONS ) + else if ( sky_mins_subd[1] > HALF_SKY_SUBDIVISIONS ) sky_mins_subd[1] = HALF_SKY_SUBDIVISIONS; - if ( sky_maxs_subd[0] < -HALF_SKY_SUBDIVISIONS ) + if ( sky_maxs_subd[0] < -HALF_SKY_SUBDIVISIONS ) sky_maxs_subd[0] = -HALF_SKY_SUBDIVISIONS; - else if ( sky_maxs_subd[0] > HALF_SKY_SUBDIVISIONS ) + else if ( sky_maxs_subd[0] > HALF_SKY_SUBDIVISIONS ) sky_maxs_subd[0] = HALF_SKY_SUBDIVISIONS; - if ( sky_maxs_subd[1] < -HALF_SKY_SUBDIVISIONS ) + if ( sky_maxs_subd[1] < -HALF_SKY_SUBDIVISIONS ) sky_maxs_subd[1] = -HALF_SKY_SUBDIVISIONS; - else if ( sky_maxs_subd[1] > HALF_SKY_SUBDIVISIONS ) + else if ( sky_maxs_subd[1] > HALF_SKY_SUBDIVISIONS ) sky_maxs_subd[1] = HALF_SKY_SUBDIVISIONS; // @@ -548,10 +548,10 @@ static void DrawSkyBox( shader_t *shader ) for ( s = sky_mins_subd[0]+HALF_SKY_SUBDIVISIONS; s <= sky_maxs_subd[0]+HALF_SKY_SUBDIVISIONS; s++ ) { - MakeSkyVec( ( s - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, - ( t - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, - i, - s_skyTexCoords[t][s], + MakeSkyVec( ( s - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, + ( t - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, + i, + s_skyTexCoords[t][s], s_skyPoints[t][s] ); } } @@ -593,7 +593,7 @@ static void FillCloudySkySide( const int mins[2], const int maxs[2], qboolean ad // only add indexes for one pass, otherwise it would draw multiple times for each pass if ( addIndexes ) { for ( t = 0; t < tHeight-1; t++ ) - { + { for ( s = 0; s < sWidth-1; s++ ) { tess.indexes[tess.numIndexes] = vertexStart + s + t * ( sWidth ); @@ -641,22 +641,22 @@ static void FillCloudBox( const shader_t *shader, int stage ) sky_maxs_subd[0] = Q_ftol(sky_maxs[0][i] * HALF_SKY_SUBDIVISIONS); sky_maxs_subd[1] = Q_ftol(sky_maxs[1][i] * HALF_SKY_SUBDIVISIONS); - if ( sky_mins_subd[0] < -HALF_SKY_SUBDIVISIONS ) + if ( sky_mins_subd[0] < -HALF_SKY_SUBDIVISIONS ) sky_mins_subd[0] = -HALF_SKY_SUBDIVISIONS; - else if ( sky_mins_subd[0] > HALF_SKY_SUBDIVISIONS ) + else if ( sky_mins_subd[0] > HALF_SKY_SUBDIVISIONS ) sky_mins_subd[0] = HALF_SKY_SUBDIVISIONS; if ( sky_mins_subd[1] < MIN_T ) sky_mins_subd[1] = MIN_T; - else if ( sky_mins_subd[1] > HALF_SKY_SUBDIVISIONS ) + else if ( sky_mins_subd[1] > HALF_SKY_SUBDIVISIONS ) sky_mins_subd[1] = HALF_SKY_SUBDIVISIONS; - if ( sky_maxs_subd[0] < -HALF_SKY_SUBDIVISIONS ) + if ( sky_maxs_subd[0] < -HALF_SKY_SUBDIVISIONS ) sky_maxs_subd[0] = -HALF_SKY_SUBDIVISIONS; - else if ( sky_maxs_subd[0] > HALF_SKY_SUBDIVISIONS ) + else if ( sky_maxs_subd[0] > HALF_SKY_SUBDIVISIONS ) sky_maxs_subd[0] = HALF_SKY_SUBDIVISIONS; if ( sky_maxs_subd[1] < MIN_T ) sky_maxs_subd[1] = MIN_T; - else if ( sky_maxs_subd[1] > HALF_SKY_SUBDIVISIONS ) + else if ( sky_maxs_subd[1] > HALF_SKY_SUBDIVISIONS ) sky_maxs_subd[1] = HALF_SKY_SUBDIVISIONS; // @@ -668,9 +668,9 @@ static void FillCloudBox( const shader_t *shader, int stage ) for ( s = sky_mins_subd[0]+HALF_SKY_SUBDIVISIONS; s <= sky_maxs_subd[0]+HALF_SKY_SUBDIVISIONS; s++ ) { - MakeSkyVec( ( s - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, - ( t - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, - i, + MakeSkyVec( ( s - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, + ( t - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, + i, NULL, s_skyPoints[t][s] ); @@ -743,20 +743,20 @@ void R_InitSkyTexCoords( float heightCloud ) for ( s = 0; s <= SKY_SUBDIVISIONS; s++ ) { // compute vector from view origin to sky side integral point - MakeSkyVec( ( s - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, - ( t - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, - i, + MakeSkyVec( ( s - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, + ( t - HALF_SKY_SUBDIVISIONS ) / ( float ) HALF_SKY_SUBDIVISIONS, + i, NULL, skyVec ); // compute parametric value 'p' that intersects with cloud layer p = ( 1.0f / ( 2 * DotProduct( skyVec, skyVec ) ) ) * - ( -2 * skyVec[2] * radiusWorld + - 2 * sqrt( SQR( skyVec[2] ) * SQR( radiusWorld ) + + ( -2 * skyVec[2] * radiusWorld + + 2 * sqrt( SQR( skyVec[2] ) * SQR( radiusWorld ) + 2 * SQR( skyVec[0] ) * radiusWorld * heightCloud + - SQR( skyVec[0] ) * SQR( heightCloud ) + + SQR( skyVec[0] ) * SQR( heightCloud ) + 2 * SQR( skyVec[1] ) * radiusWorld * heightCloud + - SQR( skyVec[1] ) * SQR( heightCloud ) + + SQR( skyVec[1] ) * SQR( heightCloud ) + 2 * SQR( skyVec[2] ) * radiusWorld * heightCloud + SQR( skyVec[2] ) * SQR( heightCloud ) ) ); diff --git a/shared/rd-rend2/tr_surface.cpp b/shared/rd-rend2/tr_surface.cpp index 5ca4ae638e..32b77989b3 100644 --- a/shared/rd-rend2/tr_surface.cpp +++ b/shared/rd-rend2/tr_surface.cpp @@ -240,14 +240,14 @@ void RB_InstantQuad(vec4_t quadVerts[4]) VectorSet2(texCoords[3], 0.0f, 1.0f); GLSL_BindProgram(&tr.textureColorShader); - + GLSL_SetUniformMatrix4x4(&tr.textureColorShader, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformVec4(&tr.textureColorShader, UNIFORM_COLOR, colorWhite); RB_InstantQuad2(quadVerts, texCoords); } -void RB_InstantTriangle() +void RB_InstantTriangle() { qglDrawArrays(GL_TRIANGLES, 0, 3); } @@ -273,7 +273,7 @@ static void RB_SurfaceSprite( void ) { } else { float s, c; float ang; - + ang = M_PI * ent->e.rotation / 180; s = sin( ang ); c = cos( ang ); @@ -310,17 +310,17 @@ static void RB_SurfaceOrientedQuad( void ) VectorCopy( backEnd.currentEntity->e.axis[1], left ); VectorCopy( backEnd.currentEntity->e.axis[2], up ); - if ( backEnd.currentEntity->e.rotation == 0 ) + if ( backEnd.currentEntity->e.rotation == 0 ) { VectorScale( left, radius, left ); VectorScale( up, radius, up ); - } - else + } + else { vec3_t tempLeft, tempUp; float s, c; float ang; - + ang = M_PI * backEnd.currentEntity->e.rotation / 180; s = sin( ang ); c = cos( ang ); @@ -336,7 +336,7 @@ static void RB_SurfaceOrientedQuad( void ) VectorCopy( tempLeft, left ); } - if ( backEnd.viewParms.isMirror ) + if ( backEnd.viewParms.isMirror ) { VectorSubtract( vec3_origin, left, left ); } @@ -679,12 +679,12 @@ static void RB_SurfaceBeam( void ) // FIXME: A lot of this can probably be removed for speed, and refactored into a more convenient function RB_UpdateVBOs(ATTR_POSITION); - + GLSL_VertexAttribsState(ATTR_POSITION, NULL); GLSL_BindProgram(sp); - + GLSL_SetUniformMatrix4x4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); - + GLSL_SetUniformVec4(sp, UNIFORM_COLOR, colorRed); R_DrawElementsVBO(tess.numIndexes, tess.firstIndex, tess.minIndex, tess.maxIndex); @@ -702,13 +702,13 @@ static void RB_SurfaceBeam( void ) //------------------ // DoSprite //------------------ -static void DoSprite( vec3_t origin, float radius, float rotation ) +static void DoSprite( vec3_t origin, float radius, float rotation ) { float s, c; float ang; vec3_t left, up; float color[4]; - + ang = M_PI * rotation / 180.0f; s = sin( ang ); c = cos( ang ); @@ -719,7 +719,7 @@ static void DoSprite( vec3_t origin, float radius, float rotation ) VectorScale( backEnd.viewParms.ori.axis[2], c * radius, up ); VectorMA( up, s * radius, backEnd.viewParms.ori.axis[1], up ); - if ( backEnd.viewParms.isMirror ) + if ( backEnd.viewParms.isMirror ) { VectorSubtract( vec3_origin, left, left ); } @@ -733,7 +733,7 @@ static void DoSprite( vec3_t origin, float radius, float rotation ) // RB_SurfaceSaber //------------------ static void RB_SurfaceSaberGlow() -{ +{ vec3_t end; refEntity_t *e; @@ -765,13 +765,13 @@ RB_SurfaceLine // STScale (how many times to loop a texture) // alpha // RGB -// +// // Values for proper line object... // lifetime // dscale // startalpha, endalpha // startRGB, endRGB -// +// static void DoLine( const vec3_t start, const vec3_t end, const vec3_t up, float spanWidth ) { @@ -924,7 +924,7 @@ static void RB_SurfaceOrientedLine(void) //----------------- // RB_SurfaceLine //----------------- -static void RB_SurfaceLine( void ) +static void RB_SurfaceLine( void ) { refEntity_t *e; vec3_t right; @@ -971,7 +971,7 @@ static void DoCylinderPart(polyVert_t *verts) VectorScale4 (verts->modulate, 1.0f / 255.0f, tess.vertexColors[tess.numVertexes]); tess.numVertexes++; verts++; - } + } tess.indexes[tess.numIndexes++] = vbase; tess.indexes[tess.numIndexes++] = vbase + 1; @@ -1036,12 +1036,12 @@ static void RB_SurfaceCylinder( void ) //Upper ring RotatePointAroundVector( upper_points[i].xyz, e->axis[0], vu, detail * i ); VectorAdd( upper_points[i].xyz, e->origin, upper_points[i].xyz ); - + //Lower ring RotatePointAroundVector( lower_points[i].xyz, e->axis[0], v1, detail * i ); VectorAdd( lower_points[i].xyz, e->oldorigin, lower_points[i].xyz ); } - + // Calculate the texture coords so the texture can wrap around the whole cylinder detail = 1.0f / (float)segments; @@ -1147,7 +1147,7 @@ static void ApplyShape( vec3_t start, vec3_t end, vec3_t right, float sradius, f DoLine2( start, end, right, sradius, eradius, startPerc, endPerc); return; } - + CreateShape(); VectorSubtract( end, start, fwd ); @@ -1180,7 +1180,7 @@ static void ApplyShape( vec3_t start, vec3_t end, vec3_t right, float sradius, f VectorMA( point2, 1.0f - perc, end, point2 ); VectorMA( point2, dis * sh2[1], rt, point2 ); VectorMA( point2, dis * sh2[2], up, point2 ); - + // recursion #ifndef REND2_SP ApplyShape( point2, point1, right, rads1, rads2, count - 1 ); @@ -1219,7 +1219,7 @@ static void DoBoltSeg( vec3_t start, vec3_t end, vec3_t right, float radius ) MakeNormalVectors( fwd, rt, up ); VectorCopy( start, old ); - + #ifndef REND2_SP oldRadius = newRadius = radius; for (i = 20; i <= dis; i += 20) @@ -1275,7 +1275,7 @@ static void DoBoltSeg( vec3_t start, vec3_t end, vec3_t right, float radius ) #else ApplyShape(cur, old, right, newRadius, oldRadius, 2 - r_lodbias->integer, 0, 1); #endif - + // randomly split off to create little tendrils, but don't do it too close to the end and especially if we are not even of the forked variety if ( ( e->renderfx & RF_FORKED ) && f_count > 0 && Q_random(&e->frame) > 0.94f && radius * (1.0f - perc) > 0.2f ) { @@ -1365,13 +1365,13 @@ static void RB_SurfaceElectricity() static void VectorArrayNormalize(vec4_t *normals, unsigned int count) { // assert(count); - + #if idppc { register float half = 0.5; register float one = 1.0; float *components = (float *)normals; - + // Vanilla PPC code, but since PPC has a reciprocal square root estimate instruction, // runs *much* faster than calling sqrt(). We'll use a single Newton-Raphson // refinement step to get a little more precision. This seems to yeild results @@ -1380,14 +1380,14 @@ static void VectorArrayNormalize(vec4_t *normals, unsigned int count) do { float x, y, z; float B, y0, y1; - + x = components[0]; y = components[1]; z = components[2]; components += 4; B = x*x + y*y + z*z; -#ifdef __GNUC__ +#ifdef __GNUC__ asm("frsqrte %0,%1" : "=f" (y0) : "f" (B)); #else y0 = __frsqrte(B); @@ -1453,11 +1453,11 @@ static void LerpMeshVertexes_altivec(md3Surface_t *surf, float backlerp) vector unsigned char newNormalsLoadPermute; vector unsigned char newNormalsStorePermute; vector float zero; - + newNormalsStorePermute = vec_lvsl(0,(float *)&newXyzScaleVec); newXyzScaleVec = *(vector float *)&newXyzScale; newXyzScaleVec = vec_perm(newXyzScaleVec,newXyzScaleVec,newNormalsStorePermute); - newXyzScaleVec = vec_splat(newXyzScaleVec,0); + newXyzScaleVec = vec_splat(newXyzScaleVec,0); newNormalsLoadPermute = vec_lvsl(0,newXyz); newNormalsStorePermute = vec_lvsr(0,outXyz); zero = (vector float)vec_splat_s8(0); @@ -1466,7 +1466,7 @@ static void LerpMeshVertexes_altivec(md3Surface_t *surf, float backlerp) // for (vertNum=0 ; vertNum < numVerts ; vertNum++, newXyz += 4, newNormals += 4, - outXyz += 4, outNormal += 4) + outXyz += 4, outNormal += 4) { newNormalsLoadPermute = vec_lvsl(0,newXyz); newNormalsStorePermute = vec_lvsr(0,outXyz); @@ -1511,7 +1511,7 @@ static void LerpMeshVertexes_altivec(md3Surface_t *surf, float backlerp) for (vertNum=0 ; vertNum < numVerts ; vertNum++, oldXyz += 4, newXyz += 4, oldNormals += 4, newNormals += 4, - outXyz += 4, outNormal += 4) + outXyz += 4, outNormal += 4) { vec3_t uncompressedOldNormal, uncompressedNewNormal; @@ -1579,7 +1579,7 @@ static void LerpMeshVertexes_scalar(mdvSurface_t *surf, float backlerp) // for (vertNum=0 ; vertNum < numVerts ; vertNum++, newXyz += 4, newNormals += 4, - outXyz += 4, outNormal += 4) + outXyz += 4, outNormal += 4) { outXyz[0] = newXyz[0] * newXyzScale; @@ -1612,7 +1612,7 @@ static void LerpMeshVertexes_scalar(mdvSurface_t *surf, float backlerp) for (vertNum=0 ; vertNum < numVerts ; vertNum++, oldXyz += 4, newXyz += 4, oldNormals += 4, newNormals += 4, - outXyz += 4, outNormal += 4) + outXyz += 4, outNormal += 4) { vec3_t uncompressedOldNormal, uncompressedNewNormal; @@ -1791,11 +1791,11 @@ static float LodErrorForVolume( vec3_t local, float radius ) { return 0; } - world[0] = local[0] * backEnd.ori.axis[0][0] + local[1] * backEnd.ori.axis[1][0] + + world[0] = local[0] * backEnd.ori.axis[0][0] + local[1] * backEnd.ori.axis[1][0] + local[2] * backEnd.ori.axis[2][0] + backEnd.ori.origin[0]; - world[1] = local[0] * backEnd.ori.axis[0][1] + local[1] * backEnd.ori.axis[1][1] + + world[1] = local[0] * backEnd.ori.axis[0][1] + local[1] * backEnd.ori.axis[1][1] + local[2] * backEnd.ori.axis[2][1] + backEnd.ori.origin[1]; - world[2] = local[0] * backEnd.ori.axis[0][2] + local[1] * backEnd.ori.axis[1][2] + + world[2] = local[0] * backEnd.ori.axis[0][2] + local[1] * backEnd.ori.axis[1][2] + local[2] * backEnd.ori.axis[2][2] + backEnd.ori.origin[2]; VectorSubtract( world, backEnd.viewParms.ori.origin, world ); @@ -1897,7 +1897,7 @@ static void RB_SurfaceBSPGrid( srfBspSurface_t *srf ) { break; } } while ( 1 ); - + rows = irows; if ( vrows < irows + 1 ) { rows = vrows - 1; @@ -1981,7 +1981,7 @@ static void RB_SurfaceBSPGrid( srfBspSurface_t *srf ) { for (i = 0 ; i < h ; i++) { for (j = 0 ; j < w ; j++) { int v1, v2, v3, v4; - + // vertex order to be reckognized as tristrips v1 = numVertexes + i*lodWidth + j + 1; v2 = v1 - 1; @@ -1991,7 +1991,7 @@ static void RB_SurfaceBSPGrid( srfBspSurface_t *srf ) { tess.indexes[numIndexes] = v2; tess.indexes[numIndexes+1] = v3; tess.indexes[numIndexes+2] = v1; - + tess.indexes[numIndexes+3] = v1; tess.indexes[numIndexes+4] = v3; tess.indexes[numIndexes+5] = v4; @@ -2417,7 +2417,7 @@ static void RB_SurfaceEntity( surfaceType_t *surfType ) { const int count = backEnd.currentEntity->e.uRefEnt.uMini.miniCount; assert(count > 0); backEnd.currentEntity = &tempEnt; - + assert(backEnd.currentEntity->e.renderfx >= 0); for (int i = 0, j = start; i < count; i++, j++) @@ -2582,7 +2582,7 @@ static void RB_SurfaceSprites( srfSprites_t *surf ) // TODO: Do we want a 2-level lod system where far away sprites are // just flat surfaces? - + // TODO: Check which pass (z-prepass/shadow/forward) we're rendering for? shader_t *shader = surf->shader; shaderStage_t *firstStage = shader->stages[0]; @@ -2616,7 +2616,7 @@ static void RB_SurfaceSprites( srfSprites_t *surf ) UniformDataWriter uniformDataWriter; uniformDataWriter.Start(program); - + // FIXME: Use entity block for this uniformDataWriter.SetUniformMatrix4x4( UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); @@ -2689,8 +2689,8 @@ static void RB_SurfaceSprites( srfSprites_t *surf ) } void (*rb_surfaceTable[SF_NUM_SURFACE_TYPES])( void *) = { - (void(*)(void*))RB_SurfaceBad, // SF_BAD, - (void(*)(void*))RB_SurfaceSkip, // SF_SKIP, + (void(*)(void*))RB_SurfaceBad, // SF_BAD, + (void(*)(void*))RB_SurfaceSkip, // SF_SKIP, (void(*)(void*))RB_SurfaceBSPFace, // SF_FACE, (void(*)(void*))RB_SurfaceBSPGrid, // SF_GRID, (void(*)(void*))RB_SurfaceBSPTriangles, // SF_TRIANGLES, diff --git a/shared/rd-rend2/tr_weather.cpp b/shared/rd-rend2/tr_weather.cpp index 84eef16077..0a5f441d30 100644 --- a/shared/rd-rend2/tr_weather.cpp +++ b/shared/rd-rend2/tr_weather.cpp @@ -58,7 +58,7 @@ namespace } return; } - + wo->targetVelocityTimeRemaining--; vec3_t deltaVelocity; VectorSubtract(wo->targetVelocity, wo->currentVelocity, deltaVelocity); @@ -134,7 +134,7 @@ namespace vec3_t mapSize; vec3_t halfMapSize; VectorSubtract( - tr.world->bmodels[0].bounds[0], + tr.world->bmodels[0].bounds[0], tr.world->bmodels[0].bounds[1], mapSize); VectorScale(mapSize, -0.5f, halfMapSize); @@ -150,7 +150,7 @@ namespace orientationr_t orientation; R_SetOrientationOriginAndAxis(orientation, viewOrigin, forward, left, up); - + const vec3_t viewBounds[2] = { { 0.0f, -halfMapSize[1], -halfMapSize[0] }, { halfMapSize[2] * 2.0f, halfMapSize[1], halfMapSize[0] } @@ -174,7 +174,7 @@ namespace qglViewport(0, 0, tr.weatherDepthFbo->width, tr.weatherDepthFbo->height); qglScissor(0, 0, tr.weatherDepthFbo->width, tr.weatherDepthFbo->height); - + if (tr.weatherSystem->weatherBrushType == WEATHER_BRUSHES_OUTSIDE) // used outside brushes { qglClearDepth(0.0f); @@ -299,8 +299,8 @@ namespace continue; // Just draw it when batch is full - if (tess.numVertexes + 4 >= SHADER_MAX_VERTEXES || tess.numIndexes + 6 >= SHADER_MAX_INDEXES) - { + if (tess.numVertexes + 4 >= SHADER_MAX_VERTEXES || tess.numIndexes + 6 >= SHADER_MAX_INDEXES) + { RB_UpdateVBOs(ATTR_POSITION); GLSL_VertexAttribsState(ATTR_POSITION, NULL); GLSL_BindProgram(&tr.textureColorShader); @@ -318,7 +318,7 @@ namespace tess.multiDrawPrimitives = 0; tess.externalIBO = nullptr; } - + RB_AddQuadStamp(rayPos, left, up, color); } } @@ -385,7 +385,7 @@ namespace void RB_SimulateWeather(weatherObject_t *ws, vec2_t *zoneOffsets, int zoneIndex) { - if (ws->vboLastUpdateFrame == backEndData->realFrameNumber || + if (ws->vboLastUpdateFrame == backEndData->realFrameNumber || tr.weatherSystem->frozen) { // Already simulated for this frame @@ -663,8 +663,8 @@ void RE_WorldEffectCommand(const char *command) else VectorMA( tr.weatherSystem->constWindDirection, - 0.001f, - parsedWind, + 0.001f, + parsedWind, tr.weatherSystem->constWindDirection); } @@ -901,8 +901,8 @@ void RE_WorldEffectCommand(const char *command) VectorSet4(tr.weatherSystem->weatherSlots[WEATHER_SPACEDUST].color, 0.75f, 0.75f, 0.75f, 0.75f); VectorScale( - tr.weatherSystem->weatherSlots[WEATHER_SPACEDUST].color, - 0.75f, + tr.weatherSystem->weatherSlots[WEATHER_SPACEDUST].color, + 0.75f, tr.weatherSystem->weatherSlots[WEATHER_SPACEDUST].color); } @@ -1001,7 +1001,7 @@ void RE_WorldEffectCommand(const char *command) tr.weatherSystem->weatherSlots[WEATHER_FOG].particleCount = 70; tr.weatherSystem->weatherSlots[WEATHER_FOG].active = true; - tr.weatherSystem->weatherSlots[WEATHER_FOG].gravity = 0.0f; + tr.weatherSystem->weatherSlots[WEATHER_FOG].gravity = 0.0f; tr.weatherSystem->weatherSlots[WEATHER_FOG].fadeDistance = 2400.f; tr.weatherSystem->weatherSlots[WEATHER_FOG].size[0] = 300.f; diff --git a/shared/rd-rend2/tr_world.cpp b/shared/rd-rend2/tr_world.cpp index e08527efb4..f07a0e6ddd 100644 --- a/shared/rd-rend2/tr_world.cpp +++ b/shared/rd-rend2/tr_world.cpp @@ -97,7 +97,7 @@ static qboolean R_CullSurface( msurface_t *surf, int entityNum ) { // don't cull exactly on the plane, because there are levels of rounding // through the BSP, ICD, and hardware that may cause pixel gaps if an - // epsilon isn't allowed here + // epsilon isn't allowed here if ( ct == CT_FRONT_SIDED ) { if ( d < surf->cullinfo.plane.dist - 8 ) { return qtrue; @@ -160,7 +160,7 @@ static int R_DlightSurface( msurface_t *surf, int dlightBits ) { float d; int i; dlight_t *dl; - + if ( surf->cullinfo.type & CULLINFO_PLANE ) { for ( i = 0 ; i < tr.refdef.num_dlights ; i++ ) { @@ -175,7 +175,7 @@ static int R_DlightSurface( msurface_t *surf, int dlightBits ) { } } } - + if ( surf->cullinfo.type & CULLINFO_BOX ) { for ( i = 0 ; i < tr.refdef.num_dlights ; i++ ) { @@ -244,7 +244,7 @@ static int R_PshadowSurface( msurface_t *surf, int pshadowBits ) { float d; int i; pshadow_t *ps; - + if ( surf->cullinfo.type & CULLINFO_PLANE ) { for ( i = 0 ; i < tr.refdef.num_pshadows ; i++ ) { @@ -259,7 +259,7 @@ static int R_PshadowSurface( msurface_t *surf, int pshadowBits ) { } } } - + if ( surf->cullinfo.type & CULLINFO_BOX ) { for ( i = 0 ; i < tr.refdef.num_pshadows ; i++ ) { @@ -272,7 +272,7 @@ static int R_PshadowSurface( msurface_t *surf, int pshadowBits ) { || ps->lightOrigin[1] - ps->lightRadius > surf->cullinfo.bounds[1][1] || ps->lightOrigin[1] + ps->lightRadius < surf->cullinfo.bounds[0][1] || ps->lightOrigin[2] - ps->lightRadius > surf->cullinfo.bounds[1][2] - || ps->lightOrigin[2] + ps->lightRadius < surf->cullinfo.bounds[0][2] + || ps->lightOrigin[2] + ps->lightRadius < surf->cullinfo.bounds[0][2] || BoxOnPlaneSide(surf->cullinfo.bounds[0], surf->cullinfo.bounds[1], &ps->cullPlane) == 2 ) { // pshadow doesn't reach the bounds pshadowBits &= ~( 1 << i ); @@ -361,7 +361,7 @@ static void R_AddWorldSurface( R_AddDrawSurf( surf->data, entityNum, surf->shader, surf->fogIndex, dlightBits, isPostRenderEntity, surf->cubemapIndex ); - for ( int i = 0, numSprites = surf->numSurfaceSprites; + for ( int i = 0, numSprites = surf->numSurfaceSprites; i < numSprites; ++i ) { srfSprites_t *sprites = surf->surfaceSprites + i; @@ -390,14 +390,14 @@ void R_AddBrushModelSurfaces ( trRefEntity_t *ent, int entityNum ) { if ( clip == CULL_OUT ) { return; } - + if (!(tr.viewParms.flags & VPF_DEPTHSHADOW)) R_DlightBmodel( bmodel, ent ); world_t *world = R_GetWorld(bmodel->worldIndex); for ( int i = 0 ; i < bmodel->numSurfaces ; i++ ) { int surf = bmodel->firstSurface + i; - + if (world->surfacesViewCount[surf] != tr.viewCount) { world->surfacesViewCount[surf] = tr.viewCount; @@ -608,7 +608,7 @@ void R_RecursiveWorldNode( mnode_t *node, int planeBits, int dlightBits, int psh dlight_t *dl = &tr.refdef.dlights[i]; float dist = DotProduct(dl->origin, node->plane->normal) - node->plane->dist; - + if ( dist > -dl->radius ) { newDlights[0] |= ( 1 << i ); } @@ -628,7 +628,7 @@ void R_RecursiveWorldNode( mnode_t *node, int planeBits, int dlightBits, int psh pshadow_t *shadow = &tr.refdef.pshadows[i]; float dist = DotProduct(shadow->lightOrigin, node->plane->normal) - node->plane->dist; - + if ( dist > -shadow->lightRadius ) { newPShadows[0] |= ( 1 << i ); } @@ -717,7 +717,7 @@ static mnode_t *R_PointInLeaf( const vec3_t p ) { mnode_t *node; float d; cplane_t *plane; - + if ( !tr.world ) { ri.Error (ERR_DROP, "R_PointInLeaf: bad model"); } @@ -735,7 +735,7 @@ static mnode_t *R_PointInLeaf( const vec3_t p ) { node = node->children[1]; } } - + return node; } @@ -831,7 +831,7 @@ void R_MarkLeaves( void ) } const byte *vis = R_ClusterPVS(tr.visClusters[tr.visIndex]); - + int i; for (i = 0, leaf = tr.world->nodes; i < tr.world->numnodes; i++, leaf++) { cluster = leaf->cluster; diff --git a/ui/menudef.h b/ui/menudef.h index 44f266ac31..2e03a9c298 100644 --- a/ui/menudef.h +++ b/ui/menudef.h @@ -7,12 +7,12 @@ #define CT_DKCYAN 0 0.25 0.25 #define ITEM_TYPE_TEXT 0 // simple text -#define ITEM_TYPE_BUTTON 1 // button, basically text with a border -#define ITEM_TYPE_RADIOBUTTON 2 // toggle button, may be grouped +#define ITEM_TYPE_BUTTON 1 // button, basically text with a border +#define ITEM_TYPE_RADIOBUTTON 2 // toggle button, may be grouped #define ITEM_TYPE_CHECKBOX 3 // check box #define ITEM_TYPE_EDITFIELD 4 // editable text, associated with a cvar #define ITEM_TYPE_COMBO 5 // drop down list -#define ITEM_TYPE_LISTBOX 6 // scrollable list +#define ITEM_TYPE_LISTBOX 6 // scrollable list #define ITEM_TYPE_MODEL 7 // model #define ITEM_TYPE_OWNERDRAW 8 // owner draw, name specs what it is #define ITEM_TYPE_NUMERICFIELD 9 // editable text, associated with a cvar @@ -21,7 +21,7 @@ #define ITEM_TYPE_MULTI 12 // multiple list setting, enumerated #define ITEM_TYPE_BIND 13 // multiple list setting, enumerated #define ITEM_TYPE_TEXTSCROLL 14 // scrolls text - + #define ITEM_ALIGN_LEFT 0 // left alignment #define ITEM_ALIGN_CENTER 1 // center alignment #define ITEM_ALIGN_RIGHT 2 // right alignment @@ -33,17 +33,17 @@ #define ITEM_TEXTSTYLE_OUTLINED 4 // drop shadow ( need a color for this ) #define ITEM_TEXTSTYLE_OUTLINESHADOWED 5 // drop shadow ( need a color for this ) #define ITEM_TEXTSTYLE_SHADOWEDMORE 6 // drop shadow ( need a color for this ) - + #define WINDOW_BORDER_NONE 0 // no border #define WINDOW_BORDER_FULL 1 // full border based on border color ( single pixel ) #define WINDOW_BORDER_HORZ 2 // horizontal borders only -#define WINDOW_BORDER_VERT 3 // vertical borders only +#define WINDOW_BORDER_VERT 3 // vertical borders only #define WINDOW_BORDER_KCGRADIENT 4 // horizontal border using the gradient bars - + #define WINDOW_STYLE_EMPTY 0 // no background #define WINDOW_STYLE_FILLED 1 // filled with background color -#define WINDOW_STYLE_GRADIENT 2 // gradient bar based on background color -#define WINDOW_STYLE_SHADER 3 // gradient bar based on background color +#define WINDOW_STYLE_GRADIENT 2 // gradient bar based on background color +#define WINDOW_STYLE_SHADER 3 // gradient bar based on background color #define WINDOW_STYLE_TEAMCOLOR 4 // team color #define WINDOW_STYLE_CINEMATIC 5 // cinematic @@ -166,10 +166,10 @@ // owner draw types // ideally these should be done outside of this file but -// this makes it much easier for the macro expansion to +// this makes it much easier for the macro expansion to // convert them for the designers ( from the .menu files ) #define CG_OWNERDRAW_BASE 1 -#define CG_PLAYER_ARMOR_ICON 1 +#define CG_PLAYER_ARMOR_ICON 1 #define CG_PLAYER_ARMOR_VALUE 2 #define CG_PLAYER_HEAD 3 #define CG_PLAYER_HEALTH 4 @@ -208,13 +208,13 @@ #define CG_PLAYER_LOCATION 33 #define CG_TEAM_COLOR 34 #define CG_CTF_POWERUP 35 - + #define CG_AREA_POWERUP 36 #define CG_AREA_LAGOMETER 37 // painted with old system -#define CG_PLAYER_HASFLAG 38 +#define CG_PLAYER_HASFLAG 38 #define CG_GAME_TYPE 39 // not done -#define CG_SELECTEDPLAYER_ARMOR 40 +#define CG_SELECTEDPLAYER_ARMOR 40 #define CG_SELECTEDPLAYER_HEALTH 41 #define CG_PLAYER_STATUS 42 #define CG_FRAGGED_MSG 43 // painted with old system @@ -225,7 +225,7 @@ #define CG_AREA_CHAT 48 // painted with old system #define CG_GAME_STATUS 49 #define CG_KILLER 50 -#define CG_PLAYER_ARMOR_ICON2D 51 +#define CG_PLAYER_ARMOR_ICON2D 51 #define CG_PLAYER_AMMO_ICON2D 52 #define CG_ACCURACY 53 #define CG_ASSISTS 54 @@ -238,9 +238,9 @@ #define CG_TEAMINFO 61 #define CG_VOICE_HEAD 62 #define CG_VOICE_NAME 63 -#define CG_PLAYER_HASFLAG2D 64 +#define CG_PLAYER_HASFLAG2D 64 #define CG_HARVESTER_SKULLS2D 65 // only shows in harvester -#define CG_CAPFRAGLIMIT 66 +#define CG_CAPFRAGLIMIT 66 #define CG_1STPLACE 67 #define CG_2NDPLACE 68 #define CG_CAPTURES 69 @@ -393,7 +393,7 @@ #define UI_PLAYERKICK_DESC 194 #define UI_VOTE_LISTENER 195 #define UI_VOTE_DESC 196 -#define UI_SOFT_KEYBOARD_ACCEPT 197 -#define UI_SOFT_KEYBOARD_DELETE 198 -#define UI_SOFT_KEYBOARD 199 +#define UI_SOFT_KEYBOARD_ACCEPT 197 +#define UI_SOFT_KEYBOARD_DELETE 198 +#define UI_SOFT_KEYBOARD 199