MCPcopy Create free account
hub / github.com/assaultcube/AC / readdepth

Function readdepth

source/src/rendergl.cpp:1004–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1002// could be replaced by a more acurate version of monster.cpp los() if needed
1003
1004void readdepth(int w, int h, vec &pos)
1005{
1006 glReadPixels(w/2, h/2, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &cursordepth);
1007 vec screen(0, 0, depthcorrect(cursordepth)*2 - 1);
1008 vec4 world;
1009 invmvpmatrix.transform(screen, world);
1010 pos = vec(world.x, world.y, world.z).div(world.w);
1011 intersectgeometry(camera1->o, pos);
1012}
1013
1014VARP(ignoreoverride_nowaterreflect, 0, 0, 1);
1015VARP(ignoreoverride_nostencilshadows, 0, 0, 1);

Callers 1

gl_drawframeFunction · 0.85

Calls 4

depthcorrectFunction · 0.85
vecClass · 0.85
intersectgeometryFunction · 0.85
transformMethod · 0.80

Tested by

no test coverage detected