2001-10-23 17:20:56 +00:00
|
|
|
/*
|
|
|
|
gl_mod_alias.c
|
|
|
|
|
2004-02-08 02:49:38 +00:00
|
|
|
Draw Alias Model
|
2001-10-23 17:20:56 +00:00
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2001-10-23 17:20:56 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "QF/skin.h"
|
2021-07-24 05:19:52 +00:00
|
|
|
|
|
|
|
#include "QF/scene/entity.h"
|
|
|
|
|
2001-10-23 17:20:56 +00:00
|
|
|
#include "QF/GL/defines.h"
|
|
|
|
#include "QF/GL/funcs.h"
|
2022-03-14 05:31:23 +00:00
|
|
|
#include "QF/GL/qf_alias.h"
|
2001-10-23 17:20:56 +00:00
|
|
|
#include "QF/GL/qf_rlight.h"
|
|
|
|
#include "QF/GL/qf_rmain.h"
|
|
|
|
#include "QF/GL/qf_rsurf.h"
|
|
|
|
#include "QF/GL/qf_vid.h"
|
|
|
|
|
|
|
|
#include "compat.h"
|
2012-02-14 08:28:09 +00:00
|
|
|
#include "r_internal.h"
|
2022-03-07 14:32:44 +00:00
|
|
|
#include "vid_gl.h"
|
2001-10-23 17:20:56 +00:00
|
|
|
|
|
|
|
typedef struct {
|
2004-05-02 21:21:00 +00:00
|
|
|
vec3_t normal;
|
|
|
|
vec3_t vert;
|
2001-10-23 17:20:56 +00:00
|
|
|
} blended_vert_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2004-05-02 21:21:00 +00:00
|
|
|
blended_vert_t *verts;
|
|
|
|
int *order;
|
|
|
|
tex_coord_t *tex_coord;
|
|
|
|
int count;
|
2001-10-23 17:20:56 +00:00
|
|
|
} vert_order_t;
|
|
|
|
|
2012-02-17 09:33:07 +00:00
|
|
|
static vec3_t shadevector;
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2003-04-08 04:13:49 +00:00
|
|
|
|
2008-07-19 05:40:57 +00:00
|
|
|
static void
|
2003-04-08 04:13:49 +00:00
|
|
|
GL_DrawAliasFrameTri (vert_order_t *vo)
|
|
|
|
{
|
2004-05-02 21:21:00 +00:00
|
|
|
int count = vo->count;
|
2004-03-15 21:32:19 +00:00
|
|
|
blended_vert_t *verts = vo->verts;
|
2004-05-02 21:21:00 +00:00
|
|
|
tex_coord_t *tex_coord = vo->tex_coord;
|
2004-03-10 08:14:38 +00:00
|
|
|
|
2003-04-08 04:13:49 +00:00
|
|
|
qfglBegin (GL_TRIANGLES);
|
|
|
|
do {
|
2004-04-28 04:07:50 +00:00
|
|
|
// texture coordinates come from the draw list
|
2003-04-08 04:13:49 +00:00
|
|
|
qfglTexCoord2fv (tex_coord->st);
|
2004-04-28 04:07:50 +00:00
|
|
|
tex_coord++;
|
|
|
|
|
|
|
|
// normals and vertices come from the frame list
|
2004-03-10 08:14:38 +00:00
|
|
|
qfglNormal3fv (verts->normal);
|
2003-04-08 04:13:49 +00:00
|
|
|
qfglVertex3fv (verts->vert);
|
|
|
|
verts++;
|
2004-03-10 08:14:38 +00:00
|
|
|
} while (count--);
|
|
|
|
qfglEnd ();
|
2003-04-08 04:13:49 +00:00
|
|
|
}
|
|
|
|
|
2003-08-11 06:05:07 +00:00
|
|
|
static inline void
|
2003-04-08 04:13:49 +00:00
|
|
|
GL_DrawAliasFrameTriMulti (vert_order_t *vo)
|
|
|
|
{
|
2004-05-02 21:21:00 +00:00
|
|
|
int count = vo->count;
|
2004-03-15 21:32:19 +00:00
|
|
|
blended_vert_t *verts = vo->verts;
|
2004-05-02 21:21:00 +00:00
|
|
|
tex_coord_t *tex_coord = vo->tex_coord;
|
2003-04-08 04:13:49 +00:00
|
|
|
|
|
|
|
qfglBegin (GL_TRIANGLES);
|
|
|
|
do {
|
|
|
|
// texture coordinates come from the draw list
|
|
|
|
qglMultiTexCoord2fv (gl_mtex_enum + 0, tex_coord->st);
|
|
|
|
qglMultiTexCoord2fv (gl_mtex_enum + 1, tex_coord->st);
|
|
|
|
tex_coord++;
|
|
|
|
|
2004-03-15 21:32:19 +00:00
|
|
|
// normals and vertices come from the frame list
|
2004-03-10 08:14:38 +00:00
|
|
|
qfglNormal3fv (verts->normal);
|
2003-04-08 04:13:49 +00:00
|
|
|
qfglVertex3fv (verts->vert);
|
|
|
|
verts++;
|
|
|
|
} while (--count);
|
|
|
|
qfglEnd ();
|
|
|
|
}
|
|
|
|
|
2008-07-19 05:40:57 +00:00
|
|
|
static void
|
2002-01-02 19:23:09 +00:00
|
|
|
GL_DrawAliasFrame (vert_order_t *vo)
|
|
|
|
{
|
2004-05-02 21:21:00 +00:00
|
|
|
int count;
|
|
|
|
int *order = vo->order;
|
2004-03-15 21:32:19 +00:00
|
|
|
blended_vert_t *verts = vo->verts;
|
2002-01-02 19:23:09 +00:00
|
|
|
|
|
|
|
while ((count = *order++)) {
|
|
|
|
// get the vertex count and primitive type
|
|
|
|
if (count < 0) {
|
|
|
|
count = -count;
|
|
|
|
qfglBegin (GL_TRIANGLE_FAN);
|
|
|
|
} else {
|
|
|
|
qfglBegin (GL_TRIANGLE_STRIP);
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
// texture coordinates come from the draw list
|
|
|
|
qfglTexCoord2fv ((float *) order);
|
|
|
|
order += 2;
|
|
|
|
|
2004-03-15 21:32:19 +00:00
|
|
|
// normals and vertices come from the frame list
|
2004-03-10 08:14:38 +00:00
|
|
|
qfglNormal3fv (verts->normal);
|
2002-01-02 19:23:09 +00:00
|
|
|
qfglVertex3fv (verts->vert);
|
|
|
|
verts++;
|
|
|
|
} while (--count);
|
|
|
|
|
|
|
|
qfglEnd ();
|
|
|
|
}
|
2001-10-23 17:20:56 +00:00
|
|
|
}
|
|
|
|
|
2003-08-11 06:05:07 +00:00
|
|
|
static inline void
|
2002-04-16 16:51:35 +00:00
|
|
|
GL_DrawAliasFrameMulti (vert_order_t *vo)
|
|
|
|
{
|
2004-05-02 21:21:00 +00:00
|
|
|
int count;
|
|
|
|
int *order = vo->order;
|
2004-03-15 21:32:19 +00:00
|
|
|
blended_vert_t *verts = vo->verts;
|
2002-04-16 16:51:35 +00:00
|
|
|
|
|
|
|
while ((count = *order++)) {
|
|
|
|
// get the vertex count and primitive type
|
|
|
|
if (count < 0) {
|
|
|
|
count = -count;
|
|
|
|
qfglBegin (GL_TRIANGLE_FAN);
|
|
|
|
} else {
|
|
|
|
qfglBegin (GL_TRIANGLE_STRIP);
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
// texture coordinates come from the draw list
|
|
|
|
qglMultiTexCoord2fv (gl_mtex_enum + 0, (float *) order);
|
|
|
|
qglMultiTexCoord2fv (gl_mtex_enum + 1, (float *) order);
|
|
|
|
order += 2;
|
|
|
|
|
2004-03-15 21:32:19 +00:00
|
|
|
// normals and vertices come from the frame list
|
2004-03-10 08:14:38 +00:00
|
|
|
qfglNormal3fv (verts->normal);
|
2002-04-16 16:51:35 +00:00
|
|
|
qfglVertex3fv (verts->vert);
|
|
|
|
verts++;
|
|
|
|
} while (--count);
|
|
|
|
|
|
|
|
qfglEnd ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-17 07:11:42 +00:00
|
|
|
/*
|
|
|
|
GL_DrawAliasShadowTri
|
|
|
|
|
|
|
|
Standard shadow drawing (triangles version)
|
|
|
|
*/
|
|
|
|
static void
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
GL_DrawAliasShadowTri (transform_t transform, const aliashdr_t *paliashdr,
|
|
|
|
const vert_order_t *vo)
|
2012-07-17 07:11:42 +00:00
|
|
|
{
|
2021-01-09 11:42:23 +00:00
|
|
|
int count = vo->count;
|
2012-07-17 07:11:42 +00:00
|
|
|
const blended_vert_t *verts = vo->verts;
|
|
|
|
float height, lheight;
|
|
|
|
vec3_t point;
|
|
|
|
const vec_t *scale = paliashdr->mdl.scale;
|
|
|
|
const vec_t *scale_origin = paliashdr->mdl.scale_origin;
|
2021-03-19 11:18:45 +00:00
|
|
|
vec4f_t entorigin;
|
2012-07-17 07:11:42 +00:00
|
|
|
|
2021-07-22 06:39:28 +00:00
|
|
|
entorigin = Transform_GetWorldPosition (transform);
|
2021-03-19 11:18:45 +00:00
|
|
|
lheight = entorigin[2] - lightspot[2];
|
2012-07-17 07:11:42 +00:00
|
|
|
height = -lheight + 1.0;
|
|
|
|
|
|
|
|
qfglBegin (GL_TRIANGLES);
|
|
|
|
|
|
|
|
do {
|
|
|
|
// normals and vertices come from the frame list
|
|
|
|
point[0] = verts->vert[0] * scale[0] + scale_origin[0];
|
|
|
|
point[1] = verts->vert[1] * scale[1] + scale_origin[1];
|
|
|
|
point[2] = verts->vert[2] * scale[2] + scale_origin[2] + lheight;
|
|
|
|
|
|
|
|
point[0] -= shadevector[0] * point[2];
|
|
|
|
point[1] -= shadevector[1] * point[2];
|
|
|
|
point[2] = height;
|
|
|
|
qfglVertex3fv (point);
|
|
|
|
|
|
|
|
verts++;
|
|
|
|
} while (--count);
|
|
|
|
|
|
|
|
qfglEnd ();
|
|
|
|
}
|
|
|
|
|
2001-10-23 17:20:56 +00:00
|
|
|
/*
|
|
|
|
GL_DrawAliasShadow
|
|
|
|
|
|
|
|
Standard shadow drawing
|
|
|
|
*/
|
|
|
|
static void
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
GL_DrawAliasShadow (transform_t transform, const aliashdr_t *paliashdr,
|
2021-07-22 06:39:28 +00:00
|
|
|
const vert_order_t *vo)
|
2001-10-23 17:20:56 +00:00
|
|
|
{
|
2004-05-02 21:21:00 +00:00
|
|
|
float height, lheight;
|
|
|
|
int count;
|
2012-05-05 08:55:30 +00:00
|
|
|
const int *order = vo->order;
|
2004-05-02 21:21:00 +00:00
|
|
|
vec3_t point;
|
2012-05-05 08:55:30 +00:00
|
|
|
const blended_vert_t *verts = vo->verts;
|
2021-03-19 11:18:45 +00:00
|
|
|
vec4f_t entorigin;
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2021-07-22 06:39:28 +00:00
|
|
|
entorigin = Transform_GetWorldPosition (transform);
|
2021-03-19 11:18:45 +00:00
|
|
|
lheight = entorigin[2] - lightspot[2];
|
2001-10-23 17:20:56 +00:00
|
|
|
height = -lheight + 1.0;
|
|
|
|
|
|
|
|
while ((count = *order++)) {
|
|
|
|
// get the vertex count and primitive type
|
|
|
|
if (count < 0) {
|
|
|
|
count = -count;
|
|
|
|
qfglBegin (GL_TRIANGLE_FAN);
|
|
|
|
} else
|
|
|
|
qfglBegin (GL_TRIANGLE_STRIP);
|
|
|
|
|
2012-05-05 09:01:00 +00:00
|
|
|
order += 2 * count; // skip texture coords
|
2001-10-23 17:20:56 +00:00
|
|
|
do {
|
2004-03-15 21:32:19 +00:00
|
|
|
// normals and vertices come from the frame list
|
2001-10-23 17:20:56 +00:00
|
|
|
point[0] =
|
2001-12-30 04:16:25 +00:00
|
|
|
verts->vert[0] * paliashdr->mdl.scale[0] +
|
2001-10-23 17:20:56 +00:00
|
|
|
paliashdr->mdl.scale_origin[0];
|
|
|
|
point[1] =
|
2001-12-30 04:16:25 +00:00
|
|
|
verts->vert[1] * paliashdr->mdl.scale[1] +
|
2001-10-23 17:20:56 +00:00
|
|
|
paliashdr->mdl.scale_origin[1];
|
|
|
|
point[2] =
|
2001-12-30 04:16:25 +00:00
|
|
|
verts->vert[2] * paliashdr->mdl.scale[2] +
|
2002-08-20 00:48:59 +00:00
|
|
|
paliashdr->mdl.scale_origin[2] + lheight;
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2002-08-20 00:48:59 +00:00
|
|
|
point[0] -= shadevector[0] * point[2];
|
|
|
|
point[1] -= shadevector[1] * point[2];
|
2001-10-23 17:20:56 +00:00
|
|
|
point[2] = height;
|
|
|
|
qfglVertex3fv (point);
|
|
|
|
|
|
|
|
verts++;
|
|
|
|
} while (--count);
|
|
|
|
|
|
|
|
qfglEnd ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-13 07:57:45 +00:00
|
|
|
static inline vert_order_t *
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
GL_GetAliasFrameVerts16 (aliashdr_t *paliashdr, entity_t e)
|
2001-10-23 17:20:56 +00:00
|
|
|
{
|
2022-10-25 03:53:30 +00:00
|
|
|
animation_t *animation = Ent_GetComponent (e.id, scene_animation, e.reg);
|
|
|
|
float blend = R_AliasGetLerpedFrames (animation, paliashdr);
|
2012-01-04 07:26:52 +00:00
|
|
|
int count, i;
|
2010-11-26 00:22:04 +00:00
|
|
|
trivertx16_t *verts;
|
2011-12-13 07:57:45 +00:00
|
|
|
vert_order_t *vo;
|
|
|
|
blended_vert_t *vo_v;
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2010-11-26 00:22:04 +00:00
|
|
|
|
2011-12-13 07:57:45 +00:00
|
|
|
verts = (trivertx16_t *) ((byte *) paliashdr + paliashdr->posedata);
|
|
|
|
|
|
|
|
count = paliashdr->poseverts;
|
2021-07-28 06:01:45 +00:00
|
|
|
vo = Hunk_TempAlloc (0, sizeof (*vo) + count * sizeof (blended_vert_t));
|
2011-12-13 07:57:45 +00:00
|
|
|
vo->order = (int *) ((byte *) paliashdr + paliashdr->commands);
|
|
|
|
vo->verts = (blended_vert_t *) &vo[1];
|
|
|
|
if (paliashdr->tex_coord) {
|
|
|
|
vo->tex_coord = (tex_coord_t *) ((byte *) paliashdr
|
|
|
|
+ paliashdr->tex_coord);
|
|
|
|
} else {
|
|
|
|
vo->tex_coord = NULL;
|
|
|
|
}
|
|
|
|
vo->count = count;
|
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (!gl_lerp_anim)
|
2012-01-04 07:26:52 +00:00
|
|
|
blend = 1.0;
|
2011-12-13 07:57:45 +00:00
|
|
|
|
|
|
|
|
2012-01-04 07:26:52 +00:00
|
|
|
if (blend == 0.0) {
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
verts = verts + animation->pose1 * count;
|
2012-01-04 07:26:52 +00:00
|
|
|
} else if (blend == 1.0) {
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
verts = verts + animation->pose2 * count;
|
2012-01-04 07:26:52 +00:00
|
|
|
} else {
|
|
|
|
trivertx16_t *verts1, *verts2;
|
2011-12-13 07:57:45 +00:00
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
verts1 = verts + animation->pose1 * count;
|
|
|
|
verts2 = verts + animation->pose2 * count;
|
2012-01-04 07:26:52 +00:00
|
|
|
|
|
|
|
for (i = 0, vo_v = vo->verts; i < count;
|
|
|
|
i++, vo_v++, verts1++, verts2++) {
|
|
|
|
float *n1, *n2;
|
|
|
|
|
|
|
|
VectorBlend (verts1->v, verts2->v, blend, vo_v->vert);
|
|
|
|
n1 = r_avertexnormals[verts1->lightnormalindex];
|
|
|
|
n2 = r_avertexnormals[verts2->lightnormalindex];
|
|
|
|
VectorBlend (n1, n2, blend, vo_v->normal);
|
|
|
|
if (VectorIsZero (vo_v->normal)) {
|
|
|
|
if (blend < 0.5) {
|
|
|
|
VectorCopy (n1, vo_v->normal);
|
|
|
|
} else {
|
|
|
|
VectorCopy (n2, vo_v->normal);
|
2004-03-10 08:14:38 +00:00
|
|
|
}
|
2001-10-23 17:20:56 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-04 07:26:52 +00:00
|
|
|
return vo;
|
2001-10-23 17:20:56 +00:00
|
|
|
}
|
2002-08-12 06:14:55 +00:00
|
|
|
|
2004-03-10 08:14:38 +00:00
|
|
|
for (i = 0, vo_v = vo->verts; i < count; i++, vo_v++, verts++) {
|
|
|
|
VectorCopy (verts->v, vo_v->vert);
|
|
|
|
VectorCopy (r_avertexnormals[verts->lightnormalindex], vo_v->normal);
|
2002-01-07 03:46:56 +00:00
|
|
|
}
|
2011-12-13 07:57:45 +00:00
|
|
|
return vo;
|
2002-01-07 03:46:56 +00:00
|
|
|
}
|
|
|
|
|
2003-08-11 06:05:07 +00:00
|
|
|
static inline vert_order_t *
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
GL_GetAliasFrameVerts (aliashdr_t *paliashdr, entity_t e)
|
2002-01-07 03:46:56 +00:00
|
|
|
{
|
2022-10-25 03:53:30 +00:00
|
|
|
animation_t *animation = Ent_GetComponent (e.id, scene_animation, e.reg);
|
|
|
|
float blend = R_AliasGetLerpedFrames (animation, paliashdr);
|
2012-01-04 07:26:52 +00:00
|
|
|
int count, i;
|
2011-12-13 07:57:45 +00:00
|
|
|
trivertx_t *verts;
|
2002-01-07 03:46:56 +00:00
|
|
|
vert_order_t *vo;
|
2011-12-13 07:57:45 +00:00
|
|
|
blended_vert_t *vo_v;
|
2002-01-07 03:46:56 +00:00
|
|
|
|
2010-11-26 00:22:04 +00:00
|
|
|
|
2011-12-13 07:57:45 +00:00
|
|
|
verts = (trivertx_t *) ((byte *) paliashdr + paliashdr->posedata);
|
|
|
|
|
|
|
|
count = paliashdr->poseverts;
|
2021-07-28 06:01:45 +00:00
|
|
|
vo = Hunk_TempAlloc (0, sizeof (*vo) + count * sizeof (blended_vert_t));
|
2002-01-07 03:46:56 +00:00
|
|
|
vo->order = (int *) ((byte *) paliashdr + paliashdr->commands);
|
2002-08-20 00:48:59 +00:00
|
|
|
vo->verts = (blended_vert_t *) &vo[1];
|
2003-04-08 04:13:49 +00:00
|
|
|
if (paliashdr->tex_coord) {
|
2011-12-13 07:57:45 +00:00
|
|
|
vo->tex_coord = (tex_coord_t *) ((byte *) paliashdr + paliashdr->tex_coord);
|
2003-04-08 04:13:49 +00:00
|
|
|
} else {
|
|
|
|
vo->tex_coord = NULL;
|
|
|
|
}
|
|
|
|
vo->count = count;
|
2002-01-07 03:46:56 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (!gl_lerp_anim)
|
2012-01-04 07:26:52 +00:00
|
|
|
blend = 1.0;
|
2011-12-13 07:57:45 +00:00
|
|
|
|
2012-01-04 07:26:52 +00:00
|
|
|
if (blend == 0.0) {
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
verts = verts + animation->pose1 * count;
|
2012-01-04 07:26:52 +00:00
|
|
|
} else if (blend == 1.0) {
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
verts = verts + animation->pose2 * count;
|
2012-01-04 07:26:52 +00:00
|
|
|
} else {
|
2011-12-13 07:57:45 +00:00
|
|
|
trivertx_t *verts1, *verts2;
|
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
verts1 = verts + animation->pose1 * count;
|
|
|
|
verts2 = verts + animation->pose2 * count;
|
2012-01-04 07:26:52 +00:00
|
|
|
|
|
|
|
for (i = 0, vo_v = vo->verts; i < count;
|
|
|
|
i++, vo_v++, verts1++, verts2++) {
|
|
|
|
float *n1, *n2;
|
|
|
|
|
|
|
|
VectorBlend (verts1->v, verts2->v, blend, vo_v->vert);
|
|
|
|
n1 = r_avertexnormals[verts1->lightnormalindex];
|
|
|
|
n2 = r_avertexnormals[verts2->lightnormalindex];
|
|
|
|
VectorBlend (n1, n2, blend, vo_v->normal);
|
|
|
|
if (VectorIsZero (vo_v->normal)) {
|
|
|
|
if (blend < 0.5) {
|
|
|
|
VectorCopy (n1, vo_v->normal);
|
|
|
|
} else {
|
|
|
|
VectorCopy (n2, vo_v->normal);
|
2011-12-13 07:57:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-01-04 07:26:52 +00:00
|
|
|
return vo;
|
2011-12-13 07:57:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0, vo_v = vo->verts; i < count; i++, vo_v++, verts++) {
|
|
|
|
VectorCopy (verts->v, vo_v->vert);
|
|
|
|
VectorCopy (r_avertexnormals[verts->lightnormalindex], vo_v->normal);
|
|
|
|
}
|
2001-10-23 17:20:56 +00:00
|
|
|
return vo;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
gl_R_DrawAliasModel (entity_t e)
|
2001-10-23 17:20:56 +00:00
|
|
|
{
|
2004-05-02 21:21:00 +00:00
|
|
|
float radius, minlight, d;
|
|
|
|
float position[4] = {0.0, 0.0, 0.0, 1.0},
|
|
|
|
color[4] = {0.0, 0.0, 0.0, 1.0},
|
|
|
|
dark[4] = {0.0, 0.0, 0.0, 1.0},
|
|
|
|
emission[4] = {0.0, 0.0, 0.0, 1.0};
|
|
|
|
int gl_light, texture;
|
|
|
|
int fb_texture = 0, used_lights = 0;
|
2023-06-13 09:06:11 +00:00
|
|
|
bool is_fullbright = false;
|
2004-05-02 21:21:00 +00:00
|
|
|
unsigned lnum;
|
|
|
|
aliashdr_t *paliashdr;
|
|
|
|
dlight_t *l;
|
|
|
|
vec3_t dist, scale;
|
2021-03-19 11:18:45 +00:00
|
|
|
vec4f_t origin;
|
2001-10-23 17:20:56 +00:00
|
|
|
vert_order_t *vo;
|
2022-10-25 03:53:30 +00:00
|
|
|
renderer_t *renderer = Ent_GetComponent (e.id, scene_renderer, e.reg);
|
|
|
|
model_t *model = renderer->model;
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2002-08-23 04:09:00 +00:00
|
|
|
radius = model->radius;
|
2022-10-25 03:53:30 +00:00
|
|
|
transform_t transform = Entity_Transform (e);
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
origin = Transform_GetWorldPosition (transform);
|
|
|
|
VectorCopy (Transform_GetWorldScale (transform), scale);
|
2021-03-19 11:18:45 +00:00
|
|
|
//FIXME assumes uniform scale
|
|
|
|
if (scale[0] != 1.0) {
|
|
|
|
radius *= scale[0];
|
|
|
|
}
|
2022-03-30 14:50:12 +00:00
|
|
|
if (R_CullSphere (r_refdef.frustum, (vec_t*)&origin, radius)) {//FIXME
|
2001-12-19 18:32:26 +00:00
|
|
|
return;
|
2021-03-19 11:18:45 +00:00
|
|
|
}
|
2001-10-23 17:20:56 +00:00
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
gl_modelalpha = renderer->colormod[3];
|
2004-03-10 08:14:38 +00:00
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
is_fullbright = (model->fullbright || renderer->fullbright);
|
|
|
|
minlight = max (model->min_light, renderer->min_light);
|
2004-05-02 21:21:00 +00:00
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
qfglColor4fv (renderer->colormod);
|
2012-05-21 23:23:22 +00:00
|
|
|
|
2004-05-02 21:21:00 +00:00
|
|
|
if (!is_fullbright) {
|
2004-07-11 00:37:48 +00:00
|
|
|
float lightadj;
|
|
|
|
|
2001-10-23 17:20:56 +00:00
|
|
|
// get lighting information
|
2022-03-30 14:50:12 +00:00
|
|
|
R_LightPoint (&r_refdef.worldmodel->brush, origin);//FIXME
|
2004-07-11 00:37:48 +00:00
|
|
|
|
|
|
|
lightadj = (ambientcolor[0] + ambientcolor[1] + ambientcolor[2]) / 765.0;
|
|
|
|
|
|
|
|
// Do minlight stuff here since that's how software does it :)
|
|
|
|
|
|
|
|
if (lightadj > 0) {
|
|
|
|
if (lightadj < minlight)
|
|
|
|
lightadj = minlight / lightadj;
|
|
|
|
else
|
|
|
|
lightadj = 1.0;
|
2012-05-21 23:23:22 +00:00
|
|
|
|
2004-07-11 00:37:48 +00:00
|
|
|
// 255 is fullbright
|
|
|
|
VectorScale (ambientcolor, lightadj / 255.0, ambientcolor);
|
|
|
|
} else {
|
|
|
|
ambientcolor[0] = ambientcolor[1] = ambientcolor[2] = minlight;
|
|
|
|
}
|
2004-05-02 21:21:00 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (gl_vector_light) {
|
2004-05-02 21:21:00 +00:00
|
|
|
for (l = r_dlights, lnum = 0; lnum < r_maxdlights; lnum++, l++) {
|
2012-02-14 08:28:09 +00:00
|
|
|
if (l->die >= vr_data.realtime) {
|
2021-03-19 11:18:45 +00:00
|
|
|
VectorSubtract (l->origin, origin, dist);
|
2004-05-02 21:21:00 +00:00
|
|
|
if ((d = DotProduct (dist, dist)) > // Out of range
|
|
|
|
((l->radius + radius) * (l->radius + radius))) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-05-21 23:23:22 +00:00
|
|
|
|
|
|
|
|
2004-05-02 21:21:00 +00:00
|
|
|
if (used_lights >= gl_max_lights) {
|
|
|
|
// For solid lighting, multiply by 0.5 since it's cos
|
|
|
|
// 60 and 60 is a good guesstimate at the average
|
|
|
|
// incident angle. Seems to match vector lighting
|
|
|
|
// best, too.
|
|
|
|
VectorMultAdd (emission,
|
|
|
|
0.5 / ((d * 0.01 / l->radius) + 0.5),
|
|
|
|
l->color, emission);
|
|
|
|
continue;
|
|
|
|
}
|
2004-03-10 08:14:38 +00:00
|
|
|
|
2004-05-02 21:21:00 +00:00
|
|
|
VectorCopy (l->origin, position);
|
|
|
|
|
|
|
|
VectorCopy (l->color, color);
|
|
|
|
color[3] = 1.0;
|
|
|
|
|
|
|
|
gl_light = GL_LIGHT0 + used_lights;
|
|
|
|
qfglEnable (gl_light);
|
|
|
|
qfglLightfv (gl_light, GL_POSITION, position);
|
|
|
|
qfglLightfv (gl_light, GL_AMBIENT, color);
|
|
|
|
qfglLightfv (gl_light, GL_DIFFUSE, color);
|
|
|
|
qfglLightfv (gl_light, GL_SPECULAR, color);
|
|
|
|
// 0.01 is used here because it just seemed to match
|
|
|
|
// the bmodel lighting best. it's over r instead of r*r
|
|
|
|
// so that larger-radiused lights will be brighter
|
|
|
|
qfglLightf (gl_light, GL_QUADRATIC_ATTENUATION,
|
|
|
|
0.01 / (l->radius));
|
|
|
|
used_lights++;
|
|
|
|
}
|
|
|
|
}
|
2004-03-10 08:14:38 +00:00
|
|
|
|
2004-05-02 21:21:00 +00:00
|
|
|
VectorAdd (ambientcolor, emission, emission);
|
|
|
|
d = max (emission[0], max (emission[1], emission[2]));
|
|
|
|
// 1.5 to allow some pastelization (curb darkness from dlight)
|
|
|
|
if (d > 1.5) {
|
|
|
|
VectorScale (emission, 1.5 / d, emission);
|
|
|
|
}
|
2004-03-10 08:14:38 +00:00
|
|
|
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglMaterialfv (GL_FRONT, GL_EMISSION, emission);
|
|
|
|
} else {
|
|
|
|
VectorCopy (ambientcolor, emission);
|
|
|
|
|
|
|
|
for (l = r_dlights, lnum = 0; lnum < r_maxdlights; lnum++, l++) {
|
2012-02-14 08:28:09 +00:00
|
|
|
if (l->die >= vr_data.realtime) {
|
2021-03-19 11:18:45 +00:00
|
|
|
VectorSubtract (l->origin, origin, dist);
|
2012-05-21 23:23:22 +00:00
|
|
|
|
2004-05-02 21:21:00 +00:00
|
|
|
if ((d = DotProduct (dist, dist)) > (l->radius + radius) *
|
|
|
|
(l->radius + radius)) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-05-21 23:23:22 +00:00
|
|
|
|
2004-05-02 21:21:00 +00:00
|
|
|
// For solid lighting, multiply by 0.5 since it's cos 60
|
|
|
|
// and 60 is a good guesstimate at the average incident
|
|
|
|
// angle. Seems to match vector lighting best, too.
|
|
|
|
VectorMultAdd (emission,
|
|
|
|
(0.5 / ((d * 0.01 / l->radius) + 0.5)),
|
|
|
|
l->color, emission);
|
|
|
|
}
|
|
|
|
}
|
2012-05-21 23:23:22 +00:00
|
|
|
|
|
|
|
d = max (emission[0], max (emission[1], emission[2]));
|
2004-05-02 21:21:00 +00:00
|
|
|
// 1.5 to allow some fading (curb emission making stuff dark)
|
|
|
|
if (d > 1.5) {
|
|
|
|
VectorScale (emission, 1.5 / d, emission);
|
2001-10-23 17:20:56 +00:00
|
|
|
}
|
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
emission[0] *= renderer->colormod[0];
|
|
|
|
emission[1] *= renderer->colormod[1];
|
|
|
|
emission[2] *= renderer->colormod[2];
|
|
|
|
emission[3] *= renderer->colormod[3];
|
2004-03-15 21:32:19 +00:00
|
|
|
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglColor4fv (emission);
|
|
|
|
}
|
2001-10-23 17:20:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// locate the proper data
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
if (!(paliashdr = renderer->model->aliashdr)) {
|
|
|
|
paliashdr = Cache_Get (&renderer->model->cache);
|
2021-03-09 14:52:40 +00:00
|
|
|
}
|
2022-03-07 14:32:44 +00:00
|
|
|
gl_ctx->alias_polys += paliashdr->mdl.numtris;
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2002-01-02 19:23:09 +00:00
|
|
|
// if the model has a colorised/external skin, use it, otherwise use
|
|
|
|
// the skin embedded in the model data
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
if (renderer->skin && renderer->skin->texnum && !gl_nocolors) {
|
|
|
|
skin_t *skin = renderer->skin;
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2012-01-23 07:16:30 +00:00
|
|
|
texture = skin->texnum;
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (gl_fb_models) {
|
2012-01-23 07:16:30 +00:00
|
|
|
fb_texture = skin->auxtex;
|
2001-10-23 17:20:56 +00:00
|
|
|
}
|
2001-11-21 08:14:05 +00:00
|
|
|
} else {
|
|
|
|
maliasskindesc_t *skindesc;
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
animation_t *animation = Ent_GetComponent (e.id, scene_animation,
|
2022-10-25 03:53:30 +00:00
|
|
|
e.reg);
|
|
|
|
skindesc = R_AliasGetSkindesc (animation, renderer->skinnum, paliashdr);
|
2001-11-21 08:14:05 +00:00
|
|
|
texture = skindesc->texnum;
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (gl_fb_models && !is_fullbright) {
|
2001-11-21 08:14:05 +00:00
|
|
|
fb_texture = skindesc->fb_texnum;
|
2021-03-09 14:52:40 +00:00
|
|
|
}
|
2001-10-23 17:20:56 +00:00
|
|
|
}
|
|
|
|
|
2004-02-08 02:49:38 +00:00
|
|
|
if (paliashdr->mdl.ident == HEADER_MDL16) {
|
2012-01-05 03:48:15 +00:00
|
|
|
// because we multipled by 256 when we loaded the verts, we have to
|
|
|
|
// scale by 1/256 when drawing.
|
2021-03-19 11:18:45 +00:00
|
|
|
//FIXME see scaling above
|
|
|
|
VectorScale (paliashdr->mdl.scale, 1 / 256.0, scale);
|
2012-01-04 07:26:52 +00:00
|
|
|
vo = GL_GetAliasFrameVerts16 (paliashdr, e);
|
2003-04-03 23:09:43 +00:00
|
|
|
} else {
|
2021-03-19 11:18:45 +00:00
|
|
|
//FIXME see scaling above
|
|
|
|
VectorScale (paliashdr->mdl.scale, 1, scale);
|
2012-01-04 07:26:52 +00:00
|
|
|
vo = GL_GetAliasFrameVerts (paliashdr, e);
|
2003-04-03 23:09:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// setup the transform
|
|
|
|
qfglPushMatrix ();
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
gl_R_RotateForEntity (Transform_GetWorldMatrixPtr (transform));
|
2003-04-03 23:09:43 +00:00
|
|
|
|
|
|
|
qfglTranslatef (paliashdr->mdl.scale_origin[0],
|
|
|
|
paliashdr->mdl.scale_origin[1],
|
|
|
|
paliashdr->mdl.scale_origin[2]);
|
|
|
|
qfglScalef (scale[0], scale[1], scale[2]);
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2012-02-17 09:33:07 +00:00
|
|
|
if (gl_modelalpha < 1.0)
|
2002-01-02 19:23:09 +00:00
|
|
|
qfglDepthMask (GL_FALSE);
|
|
|
|
|
2003-04-03 23:09:43 +00:00
|
|
|
// draw all the triangles
|
2004-05-02 21:21:00 +00:00
|
|
|
if (is_fullbright) {
|
2002-08-12 06:14:55 +00:00
|
|
|
qfglBindTexture (GL_TEXTURE_2D, texture);
|
2012-05-21 23:23:22 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (gl_vector_light) {
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglDisable (GL_LIGHTING);
|
2012-02-22 02:09:09 +00:00
|
|
|
if (!gl_tess)
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglDisable (GL_NORMALIZE);
|
|
|
|
}
|
2012-05-21 23:23:22 +00:00
|
|
|
|
2003-04-08 04:13:49 +00:00
|
|
|
if (vo->tex_coord)
|
2004-03-10 08:14:38 +00:00
|
|
|
GL_DrawAliasFrameTri (vo);
|
2012-05-21 23:23:22 +00:00
|
|
|
else
|
2004-03-10 08:14:38 +00:00
|
|
|
GL_DrawAliasFrame (vo);
|
2012-05-21 23:23:22 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (gl_vector_light) {
|
2012-02-22 02:09:09 +00:00
|
|
|
if (!gl_tess)
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglEnable (GL_NORMALIZE);
|
|
|
|
qfglEnable (GL_LIGHTING);
|
|
|
|
}
|
2002-08-12 06:14:55 +00:00
|
|
|
} else if (!fb_texture) {
|
|
|
|
// Model has no fullbrights, don't bother with multi
|
2002-04-16 16:51:35 +00:00
|
|
|
qfglBindTexture (GL_TEXTURE_2D, texture);
|
2003-04-08 04:13:49 +00:00
|
|
|
if (vo->tex_coord)
|
|
|
|
GL_DrawAliasFrameTri (vo);
|
|
|
|
else
|
|
|
|
GL_DrawAliasFrame (vo);
|
2002-04-16 16:51:35 +00:00
|
|
|
} else { // try multitexture
|
2004-02-24 20:50:55 +00:00
|
|
|
if (gl_mtex_active_tmus >= 2) { // set up the textures
|
2002-04-16 16:51:35 +00:00
|
|
|
qglActiveTexture (gl_mtex_enum + 0);
|
|
|
|
qfglBindTexture (GL_TEXTURE_2D, texture);
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2002-04-16 16:51:35 +00:00
|
|
|
qglActiveTexture (gl_mtex_enum + 1);
|
|
|
|
qfglEnable (GL_TEXTURE_2D);
|
2004-02-21 05:36:19 +00:00
|
|
|
qfglBindTexture (GL_TEXTURE_2D, fb_texture);
|
2002-04-16 16:51:35 +00:00
|
|
|
|
2003-04-08 04:13:49 +00:00
|
|
|
// do the heavy lifting
|
|
|
|
if (vo->tex_coord)
|
|
|
|
GL_DrawAliasFrameTriMulti (vo);
|
2004-02-21 05:36:19 +00:00
|
|
|
else
|
2003-04-08 04:13:49 +00:00
|
|
|
GL_DrawAliasFrameMulti (vo);
|
2002-04-16 16:51:35 +00:00
|
|
|
|
|
|
|
// restore the settings
|
|
|
|
qfglDisable (GL_TEXTURE_2D);
|
|
|
|
qglActiveTexture (gl_mtex_enum + 0);
|
|
|
|
} else {
|
2003-04-08 04:13:49 +00:00
|
|
|
if (vo->tex_coord) {
|
|
|
|
qfglBindTexture (GL_TEXTURE_2D, texture);
|
|
|
|
GL_DrawAliasFrameTri (vo);
|
2004-03-10 08:14:38 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (gl_vector_light) {
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglDisable (GL_LIGHTING);
|
2012-02-22 02:09:09 +00:00
|
|
|
if (!gl_tess)
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglDisable (GL_NORMALIZE);
|
|
|
|
}
|
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
qfglColor4fv (renderer->colormod);
|
2004-05-02 21:21:00 +00:00
|
|
|
|
2010-12-10 12:40:36 +00:00
|
|
|
qfglBindTexture (GL_TEXTURE_2D, fb_texture);
|
2004-03-10 08:14:38 +00:00
|
|
|
GL_DrawAliasFrameTri (vo);
|
2012-05-21 23:23:22 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (gl_vector_light) {
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglEnable (GL_LIGHTING);
|
2012-02-22 02:09:09 +00:00
|
|
|
if (!gl_tess)
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglEnable (GL_NORMALIZE);
|
|
|
|
}
|
2003-04-08 04:13:49 +00:00
|
|
|
} else {
|
|
|
|
qfglBindTexture (GL_TEXTURE_2D, texture);
|
|
|
|
GL_DrawAliasFrame (vo);
|
2004-03-10 08:14:38 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (gl_vector_light) {
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglDisable (GL_LIGHTING);
|
2012-02-22 02:09:09 +00:00
|
|
|
if (!gl_tess)
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglDisable (GL_NORMALIZE);
|
|
|
|
}
|
2012-05-21 23:23:22 +00:00
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
qfglColor4fv (renderer->colormod);
|
2012-05-21 23:23:22 +00:00
|
|
|
|
2003-04-08 04:13:49 +00:00
|
|
|
qfglBindTexture (GL_TEXTURE_2D, fb_texture);
|
2004-03-10 08:14:38 +00:00
|
|
|
GL_DrawAliasFrame (vo);
|
2012-05-21 23:23:22 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (gl_vector_light) {
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglEnable (GL_LIGHTING);
|
2012-02-22 02:09:09 +00:00
|
|
|
if (!gl_tess)
|
2004-05-02 21:21:00 +00:00
|
|
|
qfglEnable (GL_NORMALIZE);
|
|
|
|
}
|
2003-04-08 04:13:49 +00:00
|
|
|
}
|
2002-04-16 16:51:35 +00:00
|
|
|
}
|
2001-10-23 17:20:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
qfglPopMatrix ();
|
|
|
|
|
2001-12-19 18:32:26 +00:00
|
|
|
// torches, grenades, and lightning bolts do not have shadows
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
if (r_shadows && model->shadow_alpha) {
|
2021-03-09 14:52:40 +00:00
|
|
|
mat4f_t shadow_mat;
|
2012-07-17 08:10:48 +00:00
|
|
|
|
2001-10-23 17:20:56 +00:00
|
|
|
qfglPushMatrix ();
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
gl_R_RotateForEntity (Transform_GetWorldMatrixPtr (transform));
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2012-02-22 02:09:09 +00:00
|
|
|
if (!gl_tess)
|
2004-03-15 21:32:19 +00:00
|
|
|
qfglDisable (GL_NORMALIZE);
|
2004-04-27 22:18:23 +00:00
|
|
|
qfglDisable (GL_LIGHTING);
|
2004-04-28 04:07:50 +00:00
|
|
|
qfglDisable (GL_TEXTURE_2D);
|
2002-06-14 04:14:52 +00:00
|
|
|
qfglDepthMask (GL_FALSE);
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2012-02-17 09:33:07 +00:00
|
|
|
if (gl_modelalpha < 1.0) {
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
VectorBlend (renderer->colormod, dark, 0.5, color);
|
2012-02-17 09:33:07 +00:00
|
|
|
color[3] = gl_modelalpha * (model->shadow_alpha / 255.0);
|
2004-03-15 21:32:19 +00:00
|
|
|
qfglColor4fv (color);
|
|
|
|
} else {
|
|
|
|
color_black[3] = model->shadow_alpha;
|
|
|
|
qfglColor4ubv (color_black);
|
|
|
|
}
|
2021-03-09 14:52:40 +00:00
|
|
|
//FIXME fully vectorize
|
2021-03-10 10:06:15 +00:00
|
|
|
vec4f_t vec = { 0.707106781, 0, 0.707106781, 0 };
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
Transform_GetWorldMatrix (transform, shadow_mat);
|
2021-03-09 14:52:40 +00:00
|
|
|
mat4ftranspose (shadow_mat, shadow_mat);
|
2021-03-10 10:06:15 +00:00
|
|
|
vec = m3vmulf (shadow_mat, vec);
|
2021-03-09 14:52:40 +00:00
|
|
|
VectorCopy (vec, shadevector);
|
2012-07-17 07:11:42 +00:00
|
|
|
if (vo->tex_coord)
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
GL_DrawAliasShadowTri (transform, paliashdr, vo);
|
2012-07-17 07:11:42 +00:00
|
|
|
else
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
GL_DrawAliasShadow (transform, paliashdr, vo);
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2002-06-14 04:14:52 +00:00
|
|
|
qfglDepthMask (GL_TRUE);
|
2001-10-23 17:20:56 +00:00
|
|
|
qfglEnable (GL_TEXTURE_2D);
|
2004-03-15 21:32:19 +00:00
|
|
|
qfglEnable (GL_LIGHTING);
|
2012-02-22 02:09:09 +00:00
|
|
|
if (!gl_tess)
|
2004-03-15 21:32:19 +00:00
|
|
|
qfglEnable (GL_NORMALIZE);
|
2001-10-23 17:20:56 +00:00
|
|
|
qfglPopMatrix ();
|
2012-02-17 09:33:07 +00:00
|
|
|
} else if (gl_modelalpha < 1.0) {
|
2002-06-14 04:14:52 +00:00
|
|
|
qfglDepthMask (GL_TRUE);
|
2004-02-21 05:36:19 +00:00
|
|
|
}
|
2001-10-23 17:20:56 +00:00
|
|
|
|
2004-03-10 08:14:38 +00:00
|
|
|
while (used_lights--) {
|
|
|
|
qfglDisable (GL_LIGHT0 + used_lights);
|
|
|
|
}
|
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
if (!renderer->model->aliashdr) {
|
|
|
|
Cache_Release (&renderer->model->cache);
|
2021-03-09 14:52:40 +00:00
|
|
|
}
|
2001-10-23 17:20:56 +00:00
|
|
|
}
|