Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rend2 #1151

Merged
merged 831 commits into from
Oct 3, 2023
Merged

Rend2 #1151

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
831 commits
Select commit Hold shift + click to select a range
40a0859
Merge branch 'rend2' into rend2-update
SomaZ May 24, 2018
943d3e2
review changes
SomaZ May 24, 2018
7ef25d8
review changes part 2
SomaZ May 25, 2018
d88e56f
review changes part 3
SomaZ May 27, 2018
4cc373a
fixing R_GetLoadedImage
SomaZ May 27, 2018
c7ecd92
cleanup
SomaZ May 27, 2018
d71f7bf
Merge pull request #59 from SomaZ/rend2-update
xycaleth May 27, 2018
fe6616f
Make rend2 build and work on linux
Monsterovich May 23, 2018
1760c5c
Oops
Monsterovich May 23, 2018
edba864
Done: requested changes
Monsterovich May 26, 2018
fae9c42
Fix
Monsterovich May 26, 2018
d8af18a
Fix2
Monsterovich May 26, 2018
1aec78e
Cleaned up!
Monsterovich May 26, 2018
858b91f
Fixed remaining stuff
Monsterovich May 27, 2018
cfb6290
fix6
Monsterovich May 27, 2018
64d7772
fix7
Monsterovich May 27, 2018
acad39e
Merge pull request #60 from Monsterovich/rend2
xycaleth May 27, 2018
6cb1e26
Render top-down depth view of map for weather
xycaleth May 27, 2018
9026b94
Merge pull request #30 from xycaleth/rend2
SomaZ May 27, 2018
04eed5b
Begin/end scene when rendering weather depth map
xycaleth May 27, 2018
dc3edb7
Merge pull request #31 from xycaleth/rend2
SomaZ May 27, 2018
e33258e
Remove unnecessary field assignments
xycaleth May 27, 2018
b567ae2
make sure diffuse stage doesnt get a nullptr
SomaZ Jun 6, 2018
ac21c0b
fix swapped srgb2linear and vice versa
SomaZ Jun 7, 2018
cdc8a43
Merge pull request #63 from SomaZ/rend2-update
xycaleth Jun 9, 2018
cbfc344
Tidy up refdef/viewparms set up for cubemaps
xycaleth May 27, 2018
dfde3ff
r_ssao 2 to debug SSAO output
xycaleth Jun 3, 2018
332f5fb
Fix orientation when rendering weather depth
xycaleth Jun 9, 2018
34f5ead
Fix misc_bsp rendering
xycaleth Dec 3, 2018
d814997
Merge pull request #33 from xycaleth/rend2
SomaZ Dec 21, 2018
235d1a4
deluxemapping patch
SomaZ Apr 6, 2019
c95c6c1
Merge pull request #64 from SomaZ/rend2-update
xycaleth Apr 7, 2019
6980f2b
Fix #40: z-fighting on decal brushes
xycaleth Apr 7, 2019
c346e0f
fix DynamicGlow
SomaZ Apr 8, 2019
1c5895f
Merge pull request #36 from xycaleth/rend2
SomaZ Sep 4, 2019
cde6ef0
Add special case to DEFORM_BULGE
SomaZ Nov 6, 2019
f212f36
Fix drawing sky portals
SomaZ Nov 8, 2019
a2e0b54
Disintegration effect
SomaZ Nov 8, 2019
0b46a60
Add missing API function
SomaZ Nov 8, 2019
e70600b
Fix cg_shadows 3
SomaZ Nov 8, 2019
514ef52
Add cg_shadows 4
SomaZ Nov 10, 2019
cc24aac
fix animation bug
SomaZ Nov 12, 2019
1c74892
fix fog
SomaZ Nov 16, 2019
ae8b884
fix global fog without sky
SomaZ Nov 16, 2019
3f98c24
also allow vertex colored surfaces to use shaders
SomaZ Nov 16, 2019
89b3ec3
fix fileSize of .glsl shader files
SomaZ Dec 1, 2019
ce06d89
Fix force speed.
SomaZ Apr 5, 2020
f7f9a4e
Speedup vertex bone skinning
SomaZ Apr 6, 2020
fc3b862
Add cg_shadows 2
SomaZ Apr 6, 2020
91266fb
Requested Changes
SomaZ Apr 11, 2020
a21cd41
Dont multiply by 0.0
SomaZ Apr 11, 2020
0f2d82d
Update InstallConfig.cmake
SomaZ Apr 14, 2020
7af8d61
Fix new compilation warnings
SomaZ Apr 14, 2020
216f7a8
Use driver-specified uniform block offset alignment
SomaZ Apr 19, 2020
c10ea78
Rework of Uniforms
SomaZ Apr 20, 2020
2f7d8d0
Bring back the old performance
SomaZ Apr 23, 2020
d054862
Set max g2 bones via define
SomaZ Apr 24, 2020
b206c3a
Fixing some bad volumetrics rendering
SomaZ Apr 24, 2020
dcbac8f
Mulitple fixes
SomaZ Apr 29, 2020
a160ae8
Better external lightmap support
SomaZ Aug 10, 2020
217bf6a
Don't scale hdr lightmaps
SomaZ Aug 10, 2020
a5097a9
Rename msaa cvar
SomaZ Aug 10, 2020
6ea4ce2
Fixing hdr vertex colors and lightgrid
SomaZ Aug 18, 2020
3f7d842
Fixing normalmap shading
SomaZ Aug 18, 2020
8befd39
Autoload _specGloss and _rmo
SomaZ Aug 27, 2020
eba1e85
Set some default values at bsp load
SomaZ Aug 27, 2020
15ec417
Moving the Sun Light in Texel-Sized Increments
SomaZ Aug 27, 2020
c5bacc3
Merge remote-tracking branch 'upstream/master' into rend2-shader-cons…
SomaZ Sep 14, 2020
dc0d180
Fix SDL includes
SomaZ Sep 14, 2020
61050c2
Fix rend2 compile
SomaZ Sep 14, 2020
0dc787f
Only change tonemap when HDR lighting found
SomaZ Sep 14, 2020
f83754e
HDR fixes and some cleanup
SomaZ Sep 21, 2020
b991201
Fix shader based external lightmaps
SomaZ Sep 21, 2020
b178022
Update lightall.glsl
Dec 9, 2020
8123993
Merge pull request #45 from Almightygir/rend2-shader-constants-new
SomaZ Dec 9, 2020
9e51c2b
Fixing some bads.
SomaZ Dec 9, 2020
3959c5d
Add .shader stage support for cloth brdf
SomaZ Dec 10, 2020
473a35f
Splitsum approximation for velvet
SomaZ Dec 17, 2020
5509e12
Fix lightstyles
SomaZ Jan 29, 2021
d72bd83
Add user controllable parallax bias
SomaZ Jan 29, 2021
09f10ed
Add ORM format and linearRoughness stage keyword
SomaZ Jan 29, 2021
f4e59c4
Fix dark vanilla lighting
SomaZ Jan 29, 2021
cbf8b65
Fixing lightstyled surfaces again
SomaZ Jan 31, 2021
532cb00
Small fixes
SomaZ Feb 12, 2021
2de18c3
Reworking sun lighting
SomaZ May 18, 2021
34a0ab0
Add mikktspace tangent space
SomaZ Aug 19, 2021
5e35029
Fix for compiler error on linux
SomaZ Aug 19, 2021
f844afe
Some small fixes
SomaZ Oct 12, 2021
b5f26f1
Put tangent space calculations in its own file
SomaZ Nov 15, 2021
45a6e48
Fix rendering Cloud Layer
SomaZ Nov 17, 2021
8b7f787
Fixing bright ambient term
SomaZ Nov 18, 2021
3a37e45
Fixes regarding sky portals
SomaZ Nov 18, 2021
09d35f2
Some cleanup
SomaZ Nov 19, 2021
781c6fe
WIP
SomaZ Apr 19, 2022
d7ad80c
Fix stage collapsing
SomaZ May 9, 2022
b5c2628
Adding dlight shadows back
SomaZ Jun 1, 2022
04d94cd
Don't scale dlights
SomaZ Jun 1, 2022
591d7e5
Another oversight
SomaZ Jun 1, 2022
a10793a
Another oversight...
SomaZ Jun 2, 2022
3960010
Deforms temporary change
SomaZ Aug 11, 2022
b411b6e
Adding more cvar descriptions
SomaZ Aug 11, 2022
3abad87
Fix crash when cubemapping is disabled
SomaZ Aug 11, 2022
f179096
Fixing vertex shader recompiles in runtime
SomaZ Aug 14, 2022
24a2917
Cleanup HDR Lightmap code
SomaZ Aug 14, 2022
c480ff4
Fixing global fog
SomaZ Aug 14, 2022
d90412f
Fix r_lightmap 1
SomaZ Aug 14, 2022
43e2865
Add/Fix very basic flare rendering
SomaZ Aug 16, 2022
5902a2e
Fixing more of the flare rendering code
SomaZ Sep 14, 2022
b5951da
Give surface sprites colors
SomaZ Sep 14, 2022
238744a
Allocate less memory for shadow passes
SomaZ Sep 14, 2022
0aad9f4
Fix vertex layout for ghoul2 models
SomaZ Sep 14, 2022
e171d39
Rename lightIndex to lightMask
SomaZ Sep 21, 2022
a670fde
Some cleanup
SomaZ Oct 1, 2022
662cfd8
Fixes for global fog
SomaZ Oct 1, 2022
316d89b
Add refraction rendering
SomaZ Oct 1, 2022
04f0222
Merge pull request #48 from SomaZ/rend2-shadow_views_rework
SomaZ Oct 1, 2022
b218a58
Merge remote-tracking branch 'upstream/master' into rend2-mikktspace
SomaZ Oct 2, 2022
048e02a
Don't instance surface sprites
SomaZ Oct 2, 2022
d668b97
Little oversight regarding fog
SomaZ Oct 5, 2022
c6c0b89
Fix glass shattering
SomaZ Oct 6, 2022
075669d
Work on the weather system
SomaZ Oct 13, 2022
d970b62
Implementing fx surface sprites
SomaZ Oct 13, 2022
b9c58e1
Remove shadow comparison for pshadows
SomaZ Oct 13, 2022
6802ebe
Implement ghoul2 sabermarks
SomaZ Oct 14, 2022
718ab57
Properly set default vertex color
SomaZ Oct 14, 2022
0d13b36
Dont allow rgbGen const values > 1.0
SomaZ Oct 18, 2022
717792d
Implement r_showTris 1
SomaZ Oct 18, 2022
69b8bae
Add missing things to ghoul2 marks
SomaZ Oct 18, 2022
2547427
Weather system 1.0
SomaZ Oct 20, 2022
f3f48e8
Fix generic shader fog modulation
SomaZ Oct 20, 2022
86a8cb4
More fog fixes
SomaZ Oct 21, 2022
bdcbe3f
Warn on missing fog shader
SomaZ Oct 23, 2022
9d532c4
Make sure scene is empty when rendering cubemaps
SomaZ Oct 23, 2022
956c82d
Apparently a stupid
SomaZ Oct 25, 2022
b506922
Small things
SomaZ Oct 26, 2022
21a5432
Rewrite material system
SomaZ Nov 2, 2022
616a293
Fixing stupids from last commits
SomaZ Nov 2, 2022
af0674c
Fixes regarding fog (again...)
SomaZ Nov 2, 2022
2784f0e
Only update ubos when there's something to update
SomaZ Nov 2, 2022
87a08f2
Allow $whiteimage to be used as specGloss map
SomaZ Nov 2, 2022
fe68e0f
Don't skip shaders with deprecated shader comments
SomaZ Nov 2, 2022
9cbe7e5
[weather] apply friction to down force too
SomaZ Nov 2, 2022
131f187
Remove ioq3 flare code and replace with vanilla way of rendering them
SomaZ Nov 12, 2022
282843f
Fix refraction shader keyword + some cleanup
SomaZ Jan 22, 2023
5a4ef95
Fix md3 model caching
SomaZ Jan 27, 2023
9d0860b
Don't allow parallax mapping on unlit surfaces
SomaZ Feb 1, 2023
4a2cdb9
Initial work on weather zones
SomaZ Mar 1, 2023
d10a0cd
Fix fog on some surfaces with alpha tests
SomaZ Mar 1, 2023
0f61ff2
Properly disable weatherzone code
SomaZ Mar 1, 2023
c2e8fbd
Correct hdr fbo format
SomaZ Mar 1, 2023
0a42fb8
Fix dlighting on brush models
SomaZ Mar 2, 2023
2ef14a7
Get rid of pshadow sampling UB
SomaZ Mar 2, 2023
2eb4012
Fix a crash regarding alpha tests on fog stages
SomaZ Mar 2, 2023
3137cbf
Some cleanup
SomaZ Mar 2, 2023
39529a5
Auto exposure based on frame time
SomaZ Mar 2, 2023
e5c6ea6
Fix compiling vanilla renderers with disabled gore
SomaZ Mar 2, 2023
996de96
Work on rend2 ghoul2 marks
SomaZ Mar 2, 2023
75e9df7
Add flattened surface sprites type
SomaZ Mar 2, 2023
96d9b3c
Pack surface sprites into chunks of 65535 vertices
SomaZ Mar 11, 2023
250509c
Fix incorrectly blurred ssao image
SomaZ Mar 11, 2023
bc393d5
Fix specularScale implementation
SomaZ Mar 12, 2023
dd5ab37
Fix refraction shading with r_hdr 0
SomaZ Mar 12, 2023
af10d8c
Correct index buffer for surface sprites
SomaZ Mar 12, 2023
72c9bc3
Add loading additional deluxemaps
SomaZ Mar 13, 2023
f057162
Don't flip hdr lightmaps
SomaZ Mar 16, 2023
5603b15
[weather] Implement Inside/Outside brushes
SomaZ Mar 16, 2023
35a6e6e
[weather] Add velocity skewing factor
SomaZ Mar 16, 2023
f2253f1
Merge branch 'JACoders:master' into rend2
SomaZ Mar 16, 2023
ff90981
Try fixing linux builds
SomaZ Mar 16, 2023
0a6df9a
Add rend2 release workflow
SomaZ Mar 16, 2023
3495f20
Attempt at fixing Linux x86 builds
SomaZ Mar 16, 2023
d4e161b
Attempt at fixing #51
SomaZ Mar 19, 2023
9bf025d
Preventing a crash before fatal server error
SomaZ Mar 19, 2023
6fb97ce
Don't load packed images again and again
SomaZ Mar 19, 2023
8908489
Skip glow stages when testing for fog pass
SomaZ Mar 19, 2023
65e32a3
Attempt at fixing #51 Nr.2
SomaZ Mar 19, 2023
01b6b47
Attempt at fixing #51 Nr.3
SomaZ Mar 22, 2023
240466b
Doubled MAX_RENDER_COMMANDS to match Vanilla...
SomaZ Mar 22, 2023
b071edf
Reset write offsets when rendering a frame fails
SomaZ Mar 22, 2023
be41229
Don't try to create surface sprite vbos when not needed
SomaZ Mar 22, 2023
40f8dc1
Make sure there are cubemaps for every map
SomaZ Mar 22, 2023
57bf7d3
Add back r_drawfog
SomaZ Mar 22, 2023
7d88a2a
Rework shutdown sequence
SomaZ Mar 23, 2023
f8da494
Some more work on sync handling
SomaZ Mar 25, 2023
a0dd4e6
Apply OpenJK vanilla renderer commit to rend2
SomaZ Mar 26, 2023
8aada3d
Add loading default external deluxemaps
SomaZ Mar 30, 2023
1870d6a
Some lightall cleanup
SomaZ Mar 30, 2023
1632b6f
Temporary AMD fix
SomaZ Mar 30, 2023
65136cc
Fix bad auto exposure
SomaZ Apr 3, 2023
6275c70
Fix bad auto exposure pt2
SomaZ Apr 3, 2023
06b250d
Don't add weather surfaces when theres no world
SomaZ Apr 3, 2023
2aa0682
Correctly load all lightmaps with external deluxemaps
SomaZ Apr 3, 2023
03bef72
Fix in-game menu model rendering
SomaZ Apr 3, 2023
ff0d50f
Fix dark menu models when r_ssao 1
SomaZ Apr 3, 2023
fc0d4ea
Just do this properly...
SomaZ Apr 3, 2023
1bca588
Make sure weather system is initialized properly
SomaZ Apr 4, 2023
bb5ef7f
Fix flickering in loading screen when cubemaps
SomaZ Apr 16, 2023
517e32d
Don't load cubemaps for misc_bsp entities
SomaZ Apr 16, 2023
3d86b9e
Fix sunlights shadow glsl define
SomaZ Apr 16, 2023
7356f06
Fix fov aspect correction in sky portals
SomaZ Apr 16, 2023
9837090
Fix fog related crash
SomaZ Apr 29, 2023
88e2129
Crude fix for some glow + fog surfaces
SomaZ Apr 29, 2023
05451a3
Cleanup
SomaZ Apr 29, 2023
db90512
More cleanup
SomaZ Apr 29, 2023
d9d854e
More cleanup
SomaZ May 3, 2023
33dff65
Remove r_mergeLightmaps and always atlas internal lightmaps
SomaZ May 3, 2023
f039000
Don't render ssao in skyportals
SomaZ May 4, 2023
63bc85a
Explicitly set camera ubo for sky draws
SomaZ May 4, 2023
1f3703a
Flip normals for backfacing triangles
SomaZ May 4, 2023
c6fb4d2
Use metalness workflow as default
SomaZ May 4, 2023
2535335
Use correct luma for auto exposure
SomaZ May 6, 2023
f3a4183
Disable vertex animation support
SomaZ May 6, 2023
46bbfc7
Revert removing setting shader times
SomaZ May 10, 2023
90d5d91
Correct shader time ubo
SomaZ May 10, 2023
370265f
Fix remaining lightsyles issues
SomaZ May 10, 2023
c4c87fb
More cleanup
SomaZ May 10, 2023
a8131e1
Store md3 surfaces in one vbo per mesh instead of
SomaZ May 18, 2023
def172f
Merge md3 surfaces pt 2
SomaZ May 18, 2023
daf2d29
Merge ghoul2 draws per shader
SomaZ May 18, 2023
dbc3a71
Try fixing x86 ubuntu builds
SomaZ May 19, 2023
e4d62d3
Only modulate sun shadows when there's a shadowmap
SomaZ May 19, 2023
e241654
Mini cleanup
SomaZ May 19, 2023
08681e4
Don't upload bone matrices multiple times per frame
SomaZ May 22, 2023
a2f4bbb
Reset numDrawSurfs after each dlight shadow render
SomaZ May 22, 2023
7d0956d
Fix rendering weather brushes
SomaZ May 23, 2023
9f7ec62
Clear depth buffer before rendering the splash screen
SomaZ May 23, 2023
86282be
Mini cleanup
SomaZ May 23, 2023
a727f57
Make sure there is always a valid ubo bind
SomaZ May 23, 2023
3d859c6
Remove min() from light loop in lightall shader
SomaZ May 23, 2023
57434fb
Remove unused variables
SomaZ May 23, 2023
da2200f
Remove PR noise
SomaZ May 23, 2023
f152ed9
Remove PR noise 2
SomaZ May 23, 2023
b411479
Merge branch 'JACoders:master' into rend2
SomaZ May 23, 2023
722066e
Remove PR noise 3
SomaZ May 23, 2023
685b955
Remove PR noise 4
SomaZ May 23, 2023
23800c9
Remove PR noise 5
SomaZ May 23, 2023
d027a07
Remove PR noise 6
SomaZ May 23, 2023
274542e
Don't upload shader instance ubo blocks if not needed
SomaZ May 23, 2023
af9e019
Cleanup cubemap rendering code
SomaZ May 24, 2023
323f230
Properly track glState.currentGlobalUBO
SomaZ May 27, 2023
a4eace2
Disable viewport scissor for mirrors for now
SomaZ May 28, 2023
f1f78a0
Fix r_forceSun 2
SomaZ May 28, 2023
d349b68
WIP Scene handling rewrite
SomaZ Jun 21, 2023
9df2102
Fix weather TD occlusion
SomaZ Jul 2, 2023
5ff5390
Render weather only in portal and main views
SomaZ Jul 2, 2023
0237769
Fix shader compile when r_sunlightmode == 0
SomaZ Jul 2, 2023
4f5ca20
Remove rend2 github action
SomaZ Sep 13, 2023
ac26d13
Dependency update
SomaZ Sep 13, 2023
c4d39a1
Draw all sprites even if they exceed the usual bucket size
SomaZ Sep 30, 2023
3544f14
[MP] fix off-by-one in TruncateGLExtensionsString which affects mods…
SomaZ Sep 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ option(BuildMPDed "Whether to create projects for the MP dedicated server (openj
option(BuildMPGame "Whether to create projects for the MP server-side gamecode (jampgamex86.dll)" ON)
option(BuildMPCGame "Whether to create projects for the MP clientside gamecode (cgamex86.dll)" ON)
option(BuildMPUI "Whether to create projects for the MP UI code (uix86.dll)" ON)
option(BuildMPRend2 "Whether to create projects for the EXPERIMENTAL MP rend2 renderer (rd-rend2_x86.dll)" ON)
option(BuildSPEngine "Whether to create projects for the SP engine (openjk_sp.exe)" ON)
option(BuildSPGame "Whether to create projects for the SP gamecode (jagamex86.dll)" ON)
option(BuildSPRdVanilla "Whether to create projects for the SP default renderer (rdsp-vanilla_x86.dll)" ON)
Expand Down Expand Up @@ -154,6 +155,7 @@ set(MPDed "openjkded.${Architecture}")
set(MPGame "jampgame${Architecture}")
set(MPCGame "cgame${Architecture}")
set(MPUI "ui${Architecture}")
set(MPRend2 "rd-rend2_${Architecture}")
set(JK2SPEngine "openjo_sp.${Architecture}")
set(JK2SPGame "jospgame${Architecture}")
set(JK2SPVanillaRenderer "rdjosp-vanilla_${Architecture}")
Expand Down
5 changes: 5 additions & 0 deletions codemp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ if(BuildMPRdVanilla)
add_subdirectory("${MPDir}/rd-vanilla")
endif(BuildMPRdVanilla)

# Add rend2 JKA Renderer Project
if(BuildMPRend2)
add_subdirectory("${MPDir}/rd-rend2")
endif(BuildMPRend2)

# Common things between Engine and Dedicated Server
if(BuildMPEngine OR BuildMPDed)

Expand Down
4 changes: 4 additions & 0 deletions codemp/ghoul2/G2_gore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "G2_gore.h"
#include "../rd-common/tr_common.h"

#ifdef _G2_GORE

GoreTextureCoordinates::GoreTextureCoordinates()
{
Com_Memset (tex, 0, sizeof (tex));
Expand All @@ -39,3 +41,5 @@ GoreTextureCoordinates::~GoreTextureCoordinates()
}
}
}

#endif
56 changes: 26 additions & 30 deletions codemp/ghoul2/ghoul2_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,17 @@ struct surfaceInfo_t
int genPolySurfaceIndex; // used to point back to the original surface and poly if this is a generated surface
int genLod; // used to determine original lod of original surface and poly hit location

surfaceInfo_t():
offFlags(0),
surface(0),
genBarycentricJ(0),
genBarycentricI(0),
genPolySurfaceIndex(0),
genLod(0)
{}

surfaceInfo_t()
: offFlags(0)
, surface(0)
, genBarycentricJ(0)
, genBarycentricI(0)
, genPolySurfaceIndex(0)
, genLod(0)
{
}
};



#define MDXABONEDEF // used in the mdxformat.h file to stop redefinitions of the bone struct.

// we save the whole structure here.
Expand Down Expand Up @@ -153,26 +151,24 @@ struct boneInfo_t
int airTime; //base is in air, be more quick and sensitive about collisions
//rww - RAGDOLL_END

boneInfo_t():
boneNumber(-1),
flags(0),
startFrame(0),
endFrame(0),
startTime(0),
pauseTime(0),
animSpeed(0),
blendFrame(0),
blendLerpFrame(0),
blendTime(0),
blendStart(0),
boneBlendTime(0),
boneBlendStart(0),
lastTime(0),
RagFlags(0)
boneInfo_t()
: boneNumber(-1)
, flags(0)
, startFrame(0)
, endFrame(0)
, startTime(0)
, pauseTime(0)
, animSpeed(0)
, blendFrame(0)
, blendLerpFrame(0)
, blendTime(0)
, blendStart(0)
, boneBlendTime(0)
, boneBlendStart(0)
, lastTime(0)
, RagFlags(0)
{
matrix.matrix[0][0] = matrix.matrix[0][1] = matrix.matrix[0][2] = matrix.matrix[0][3] =
matrix.matrix[1][0] = matrix.matrix[1][1] = matrix.matrix[1][2] = matrix.matrix[1][3] =
matrix.matrix[2][0] = matrix.matrix[2][1] = matrix.matrix[2][2] = matrix.matrix[2][3] = 0.0f;
Com_Memset(&matrix, 0, sizeof(matrix));
}

};
Expand Down
124 changes: 124 additions & 0 deletions codemp/qcommon/qfiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,130 @@ typedef struct md3Header_s {
int ofsEnd; // end of file
} md3Header_t;

/*
==============================================================================

MDR file format

==============================================================================
*/

/*
* Here are the definitions for Ravensoft's model format of md4. Raven stores their
* playermodels in .mdr files, in some games, which are pretty much like the md4
* format implemented by ID soft. It seems like ID's original md4 stuff is not used at all.
* MDR is being used in EliteForce, JediKnight2 and Soldiers of Fortune2 (I think).
* So this comes in handy for anyone who wants to make it possible to load player
* models from these games.
* This format has bone tags, which is similar to the thing you have in md3 I suppose.
* Raven has released their version of md3view under GPL enabling me to add support
* to this codebase. Thanks to Steven Howes aka Skinner for helping with example
* source code.
*
* - Thilo Schulz ([email protected])
*/

#define MDR_IDENT (('5'<<24)+('M'<<16)+('D'<<8)+'R')
#define MDR_VERSION 2
#define MDR_MAX_BONES 128

typedef struct {
int boneIndex; // these are indexes into the boneReferences,
float boneWeight; // not the global per-frame bone list
vec3_t offset;
} mdrWeight_t;

typedef struct {
vec3_t normal;
vec2_t texCoords;
int numWeights;
mdrWeight_t weights[1]; // variable sized
} mdrVertex_t;

typedef struct {
int indexes[3];
} mdrTriangle_t;

typedef struct {
int ident;

char name[MAX_QPATH]; // polyset name
char shader[MAX_QPATH];
int shaderIndex; // for in-game use

int ofsHeader; // this will be a negative number

int numVerts;
int ofsVerts;

int numTriangles;
int ofsTriangles;

// Bone references are a set of ints representing all the bones
// present in any vertex weights for this surface. This is
// needed because a model may have surfaces that need to be
// drawn at different sort times, and we don't want to have
// to re-interpolate all the bones for each surface.
int numBoneReferences;
int ofsBoneReferences;

int ofsEnd; // next surface follows
} mdrSurface_t;

typedef struct {
float matrix[3][4];
} mdrBone_t;

typedef struct {
vec3_t bounds[2]; // bounds of all surfaces of all LOD's for this frame
vec3_t localOrigin; // midpoint of bounds, used for sphere cull
float radius; // dist from localOrigin to corner
char name[16];
mdrBone_t bones[1]; // [numBones]
} mdrFrame_t;

typedef struct {
unsigned char Comp[24]; // MC_COMP_BYTES is in MatComp.h, but don't want to couple
} mdrCompBone_t;

typedef struct {
vec3_t bounds[2]; // bounds of all surfaces of all LOD's for this frame
vec3_t localOrigin; // midpoint of bounds, used for sphere cull
float radius; // dist from localOrigin to corner
mdrCompBone_t bones[1]; // [numBones]
} mdrCompFrame_t;

typedef struct {
int numSurfaces;
int ofsSurfaces; // first surface, others follow
int ofsEnd; // next lod follows
} mdrLOD_t;

typedef struct {
int boneIndex;
char name[32];
} mdrTag_t;

typedef struct {
int ident;
int version;

char name[MAX_QPATH]; // model name

// frames and bones are shared by all levels of detail
int numFrames;
int numBones;
int ofsFrames; // mdrFrame_t[numFrames]

// each level of detail has completely separate sets of surfaces
int numLODs;
int ofsLODs;

int numTags;
int ofsTags;

int ofsEnd; // end of file
} mdrHeader_t;

/*
==============================================================================
Expand Down
36 changes: 2 additions & 34 deletions codemp/rd-common/tr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,39 +296,6 @@ typedef struct skin_s {
/*
Ghoul2 Insert End
*/
typedef enum {
MOD_BAD,
MOD_BRUSH,
MOD_MESH,
/*
Ghoul2 Insert Start
*/
MOD_MDXM,
MOD_MDXA
/*
Ghoul2 Insert End
*/
} modtype_t;

typedef struct model_s {
char name[MAX_QPATH];
modtype_t type;
int index; // model = tr.models[model->index]

int dataSize; // just for listing purposes
struct bmodel_s *bmodel; // only if type == MOD_BRUSH
md3Header_t *md3[MD3_MAX_LODS]; // only if type == MOD_MESH
/*
Ghoul2 Insert Start
*/
mdxmHeader_t *mdxm; // only if type == MOD_GL2M which is a GHOUL II Mesh file NOT a GHOUL II animation file
mdxaHeader_t *mdxa; // only if type == MOD_GL2A which is a GHOUL II Animation file
/*
Ghoul2 Insert End
*/
int numLods;
qboolean bspInstance;
} model_t;

#define MAX_RENDER_STRINGS 8
#define MAX_RENDER_STRING_LENGTH 32
Expand Down Expand Up @@ -372,7 +339,8 @@ typedef int stereoFrame_t;
typedef enum { // r_ext_preferred_tc_method
TC_NONE,
TC_S3TC,
TC_S3TC_DXT
TC_S3TC_DXT,
TC_S3TC_ARB
} textureCompression_t;

typedef struct glconfig_s {
Expand Down
10 changes: 5 additions & 5 deletions codemp/rd-dedicated/G2_API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2485,6 +2485,11 @@ qboolean G2API_SkinlessModel(CGhoul2Info_v& ghoul2, int modelIndex)
return qtrue;
}

int G2API_Ghoul2Size(CGhoul2Info_v &ghoul2)
{
return ghoul2.size();
}

//#ifdef _SOF2
#ifdef _G2_GORE
void ResetGoreTag(); // put here to reduce coupling
Expand Down Expand Up @@ -2521,11 +2526,6 @@ void G2API_ClearSkinGore ( CGhoul2Info_v &ghoul2 )
}
}

int G2API_Ghoul2Size ( CGhoul2Info_v &ghoul2 )
{
return ghoul2.size();
}

extern int G2_DecideTraceLod(CGhoul2Info &ghoul2, int useLod);
void G2API_AddSkinGore(CGhoul2Info_v &ghoul2,SSkinGoreData &gore)
{
Expand Down
1 change: 1 addition & 0 deletions codemp/rd-dedicated/G2_bolts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.

#include "ghoul2/G2.h"
#include "ghoul2/g2_local.h"
#include "tr_local.h"

//=====================================================================================================================
// Bolt List handling routines - so entities can attach themselves to any part of the model in question
Expand Down
11 changes: 7 additions & 4 deletions codemp/rd-dedicated/G2_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "server/server.h"
#include "ghoul2/g2_local.h"

#include "tr_local.h"
#ifdef _G2_GORE
#include "ghoul2/G2_gore.h"

#include "tr_local.h"

#define GORE_TAG_UPPER (256)
#define GORE_TAG_MASK (~255)

Expand Down Expand Up @@ -549,6 +548,7 @@ void G2_TransformModel(CGhoul2Info_v &ghoul2, const int frameNum, vec3_t scale,
vec3_t correctScale;
qboolean firstModelOnly = qfalse;

#ifdef _G2_GORE
if ( cg_g2MarksAllModels == NULL )
{
cg_g2MarksAllModels = ri.Cvar_Get( "cg_g2MarksAllModels", "0", 0, "" );
Expand All @@ -559,7 +559,7 @@ void G2_TransformModel(CGhoul2Info_v &ghoul2, const int frameNum, vec3_t scale,
{
firstModelOnly = qtrue;
}

#endif

VectorCopy(scale, correctScale);
// check for scales of 0 - that's the default I believe
Expand Down Expand Up @@ -1497,6 +1497,7 @@ void G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, Colli
shader_t *cust_shader;
qboolean firstModelOnly = qfalse;

#ifdef _G2_GORE
if ( cg_g2MarksAllModels == NULL )
{
cg_g2MarksAllModels = ri.Cvar_Get( "cg_g2MarksAllModels", "0", 0, "" );
Expand All @@ -1507,6 +1508,7 @@ void G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, Colli
{
firstModelOnly = qtrue;
}
#endif

// walk each possible model for this entity and try tracing against it
for (i=0; i<ghoul2.size(); i++)
Expand Down Expand Up @@ -1552,14 +1554,15 @@ void G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, Colli
}

lod = G2_DecideTraceLod(ghoul2[i],useLod);
#ifdef _G2_GORE
if ( skipIfLODNotMatch )
{//we only want to hit this SPECIFIC LOD...
if ( lod != useLod )
{//doesn't match, skip this model
continue;
}
}

#endif
//reset the quick surface override lookup
G2_FindOverrideSurface(-1, ghoul2[i].mSlist);

Expand Down
Loading