fteqw/quakec/csaddon/src/brush_draw.qc

132 lines
4.5 KiB
Plaintext
Raw Normal View History

openxr plugin: tweaked - inputs should be working properly now, and are visible to csqc. subject to further breaking changes, however. _pext_vrinputs: added cvar to enable vr inputs protocol extension allowing vr inputs to be networked to ssqc too. defaults to 0 for now, will be renamed when deemed final. updates menu: the prompt to enable sources is now more explicit instead of expecting the user to have a clue. updates menu: added a v3 sources format, which should be more maintainable. not final. updates menu: try to give reasons why sources might be failing (to help blame ISPs if they try fucking over TTH dns again). presets menu: no longer closes the instant a preset is chosen. some presets have a couple of modifiers listed. force the demo loop in the background to serve as a preview. prompts menus: now does word wrapping. ftemaster: support importing server lists from other master servers (requested by Eukara). server: try to detect when non-reply inbound packets are blocked by firewalls/nats/etc (using ftemaster to do so). qcvm: added pointcontentsmask builtin, allowing it to probe more than just world, with fte's full contentbit range instead of just q1 legacy. qcvm: memfill8 builtin now works on createbuffer() pointers. qcvm: add missing unsigned ops. Fixed double comparison ops. fixed bug with op_store_i64. added missing OP_LOADP_I64 qcc: added '#pragma framerate RATE' for overriding implicit nextthink durations. qcc: fixed '#pragma DONT_COMPILE_THIS_FILE' to not screw up comments. qcc: added __GITURL__ __GITHASH__ __GITDATE__ __GITDATETIME__ __GITDESC__ for any mods that might want to make use of that. qcc: fix up -Fhashonly a little setrenderer: support for vulkan gpu enumeration. rulesets: reworked to support custom rulesets (using hashes to catch haxxors, though still nothing prevents just changing the client to ignore rulesets) bspx: use our BIH code for the bspx BRUSHLIST lump instead of the older less efficient code. (static)iqm+obj: these model formats can now be used for the worldmodel (with a suitable .ent file). Also using BIH for much better collision performance. pmove: tried to optimise PM_NudgePosition, should boost fps in stress tests. wayland: fix a crash on startup. mousegrabs now works better. imagetool: uses sdl for previews. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5813 fc73d0e0-1445-4013-8a0c-d673dee63da5
2021-04-14 06:21:04 +01:00
void(int mod, int id) DrawEngineBrushWireframe =
{
const vector col = '1 0 0';
for(int facenum = 0;;)
{
int points = brush_getfacepoints(mod, id, ++facenum, &facepoints[0], MAX_FACEPOINTS);
if (!points)
break; //end of face list, I guess
R_BeginPolygon("chop");
R_PolygonVertex(facepoints[0], '0 0', col, 1);
for (int point = 1; point < points; point++)
{
R_PolygonVertex(facepoints[point], '0 0', col, 1);
R_EndPolygon();
R_PolygonVertex(facepoints[point], '0 0', col, 1);
}
R_PolygonVertex(facepoints[0], '0 0', col, 1);
R_EndPolygon();
}
};
void(brushface_t *faces, int numfaces, string shader, vector col, float alpha) DrawQCBrushWireframe =
{
int f;
int point, points;
for(f = 0; f < numfaces;)
{
points = brush_calcfacepoints(++f, faces, numfaces, facepoints, MAX_FACEPOINTS);
if (!points)
continue; //should probably warn somehow about this
R_BeginPolygon(shader);
R_PolygonVertex(facepoints[0], '0 0', col, alpha);
for (point = 0; point < points-1; )
{
point++;
R_PolygonVertex(facepoints[point], '0 0', col, alpha);
R_EndPolygon();
R_PolygonVertex(facepoints[point], '0 0', col, alpha);
}
R_PolygonVertex(facepoints[0], '0 0', col, alpha);
R_EndPolygon();
}
};
void(brushface_t *faces, int numfaces, string shader, vector col, float alpha) DrawQCBrushSolid =
{
int f;
int point, points;
for(f = 0; f < numfaces;)
{
points = brush_calcfacepoints(++f, faces, numfaces, facepoints, MAX_FACEPOINTS);
if (!points)
continue; //should probably warn somehow about this
R_BeginPolygon(shader);
for (point = 0; point < points; point++)
R_PolygonVertex(facepoints[point], '0 0', col, alpha);
R_EndPolygon();
}
};
void(brushface_t *faces, int numfaces, vector col, float alpha) DrawQCBrushTextured =
{
int f;
int point, points;
for(f = 0; f < numfaces; f++)
{
points = brush_calcfacepoints(1+f, faces, numfaces, facepoints, MAX_FACEPOINTS);
if (points)
{
//this is unfortunate. the built in shaders expect to use lightmaps. we don't have those.
//because lightmaps are special things, we end up in a real mess. so lets just make sure there's a shader now, because we can.
//FIXME: we don't manage to pick up the size of the original wad image
shaderforname(faces[f].shadername,
sprintf("{"
"{\n"
"map \"%s\"\n"
"rgbgen vertex\n"
"alphagen vertex\n"
"}\n"
"}", faces[f].shadername));
vector sz = drawgetimagesize(faces[f].shadername);
R_BeginPolygon(faces[f].shadername);
for (point = 0; point < points; point++)
R_PolygonVertex(facepoints[point], [(facepoints[point] * faces[f].sdir + faces[f].sbias)/sz_x, (facepoints[point] * faces[f].tdir + faces[f].tbias)/sz_y], col, alpha);
R_EndPolygon();
}
}
};
void(vector *p, int points, string shader, vector col, float alpha) DrawAxisExtensions =
{
R_BeginPolygon(shader);
for (int point = 0; point < points; point++)
{
R_PolygonVertex(p[point] + [ 64, 0, 0], '0 0', col, alpha);
R_PolygonVertex(p[point] + [-64, 0, 0], '0 0', col, alpha);
R_EndPolygon();
R_PolygonVertex(p[point] + [0, 64, 0], '0 0', col, alpha);
R_PolygonVertex(p[point] + [0, -64, 0], '0 0', col, alpha);
R_EndPolygon();
R_PolygonVertex(p[point] + [0, 0, 64], '0 0', col, alpha);
R_PolygonVertex(p[point] + [0, 0, -64], '0 0', col, alpha);
R_EndPolygon();
}
};
void(int brushid) editor_drawbbox =
{
static vector bbox[2];
int p = brush_getfacepoints(selectedbrushmodel, brushid, 0, bbox, bbox.length);
if (p == 2)
{
R_BeginPolygon("chop");
#define line(x,y) R_PolygonVertex(x, '0 0', '1 0 0', 1); R_PolygonVertex(y, '0 0', '1 0 0', 1); R_EndPolygon()
line(bbox[0], ([bbox[1][0], bbox[0][1], bbox[0][2]]));
line(bbox[0], ([bbox[0][0], bbox[1][1], bbox[0][2]]));
line(bbox[0], ([bbox[0][0], bbox[0][1], bbox[1][2]]));
line(bbox[1], ([bbox[0][0], bbox[1][1], bbox[1][2]]));
line(bbox[1], ([bbox[1][0], bbox[0][1], bbox[1][2]]));
line(bbox[1], ([bbox[1][0], bbox[1][1], bbox[0][2]]));
line(([bbox[1][0], bbox[0][1], bbox[0][2]]), ([bbox[1][0], bbox[1][1], bbox[0][2]]));
line(([bbox[1][0], bbox[0][1], bbox[0][2]]), ([bbox[1][0], bbox[0][1], bbox[1][2]]));
line(([bbox[0][0], bbox[1][1], bbox[0][2]]), ([bbox[0][0], bbox[1][1], bbox[1][2]]));
line(([bbox[0][0], bbox[1][1], bbox[0][2]]), ([bbox[1][0], bbox[1][1], bbox[0][2]]));
line(([bbox[0][0], bbox[0][1], bbox[1][2]]), ([bbox[0][0], bbox[1][1], bbox[1][2]]));
line(([bbox[0][0], bbox[0][1], bbox[1][2]]), ([bbox[1][0], bbox[0][1], bbox[1][2]]));
#undef line
}
};