2012-05-18 14:31:14 +00:00
|
|
|
/*
|
|
|
|
sw_riqm.c
|
|
|
|
|
|
|
|
SW IQM rendering
|
|
|
|
|
|
|
|
Copyright (C) 2012 Bill Currie <bill@taniwha.org>
|
|
|
|
|
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
|
|
Date: 2012/5/18
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "QF/cvar.h"
|
|
|
|
#include "QF/image.h"
|
|
|
|
#include "QF/render.h"
|
|
|
|
#include "QF/skin.h"
|
|
|
|
#include "QF/sys.h"
|
|
|
|
|
2021-07-24 05:19:52 +00:00
|
|
|
#include "QF/scene/entity.h"
|
|
|
|
|
2012-05-18 14:31:14 +00:00
|
|
|
#include "d_ifacea.h"
|
|
|
|
#include "r_internal.h"
|
|
|
|
|
2012-07-15 13:32:06 +00:00
|
|
|
#ifdef PIC
|
|
|
|
#undef USE_INTEL_ASM //XXX asm pic hack
|
|
|
|
#endif
|
|
|
|
|
2012-05-18 14:31:14 +00:00
|
|
|
#define LIGHT_MIN 5 // lowest light value we'll allow, to
|
|
|
|
// avoid the need for inner-loop light
|
|
|
|
// clamping
|
|
|
|
|
2022-03-17 06:04:30 +00:00
|
|
|
static vec3_t r_lightvec;
|
2012-05-18 14:31:14 +00:00
|
|
|
static int r_ambientlight;
|
|
|
|
static float r_shadelight;
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
calc_light (float *normal)
|
|
|
|
{
|
2022-03-17 06:04:30 +00:00
|
|
|
float lightcos = DotProduct (normal, r_lightvec);
|
2012-05-18 14:31:14 +00:00
|
|
|
int temp = r_ambientlight;
|
|
|
|
|
|
|
|
if (lightcos < 0) {
|
|
|
|
temp += (int) (r_shadelight * lightcos);
|
|
|
|
|
|
|
|
// clamp; because we limited the minimum ambient and shading
|
|
|
|
// light, we don't have to clamp low light, just bright
|
|
|
|
if (temp < 0)
|
|
|
|
temp = 0;
|
|
|
|
}
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
R_IQMTransformAndProjectFinalVerts (iqm_t *iqm, swiqm_t *sw, iqmframe_t *frame)
|
|
|
|
{
|
|
|
|
finalvert_t *fv = pfinalverts;
|
|
|
|
float zi;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < iqm->num_verts; i++, fv++) {
|
|
|
|
byte *vert = iqm->vertices + i * iqm->stride;
|
|
|
|
uint32_t bind = *(uint32_t *) (vert + sw->bindices->offset);
|
|
|
|
vec_t *mat = (vec_t *) &frame[bind];
|
|
|
|
float *position = (float *) (vert + sw->position->offset);
|
|
|
|
float *normal = (float *) (vert + sw->normal->offset);
|
|
|
|
int32_t *texcoord = (int32_t *) (vert + sw->texcoord->offset);
|
2012-05-20 06:21:25 +00:00
|
|
|
vec3_t tv, tn;
|
2012-05-18 14:31:14 +00:00
|
|
|
Mat4MultVec (mat, position, tv);
|
2012-05-20 06:21:25 +00:00
|
|
|
Mat4as3MultVec (mat, normal, tn);
|
2012-05-18 15:34:15 +00:00
|
|
|
zi = 1.0 / (DotProduct (tv, aliastransform[2])
|
|
|
|
+ aliastransform[2][3]);
|
2012-05-18 14:31:14 +00:00
|
|
|
fv->v[5] = zi;
|
2012-05-18 15:34:15 +00:00
|
|
|
fv->v[0] = (DotProduct (tv, aliastransform[0])
|
|
|
|
+ aliastransform[0][3]) * zi + aliasxcenter;
|
|
|
|
fv->v[1] = (DotProduct (tv, aliastransform[1])
|
|
|
|
+ aliastransform[1][3]) * zi + aliasxcenter;
|
2012-05-18 14:31:14 +00:00
|
|
|
fv->v[2] = texcoord[0];
|
|
|
|
fv->v[3] = texcoord[1];
|
2012-05-20 06:21:25 +00:00
|
|
|
fv->v[4] = calc_light (tn);
|
2012-05-18 14:31:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-18 15:18:03 +00:00
|
|
|
static void
|
|
|
|
iqm_setup_skin (swiqm_t *sw, int skinnum)
|
|
|
|
{
|
|
|
|
tex_t *skin = sw->skins[skinnum];
|
|
|
|
|
|
|
|
r_affinetridesc.pskin = skin->data;
|
|
|
|
r_affinetridesc.skinwidth = skin->width;
|
|
|
|
r_affinetridesc.skinheight = skin->height;
|
|
|
|
r_affinetridesc.seamfixupX16 = (skin->width >> 1) << 16;
|
|
|
|
|
|
|
|
if (r_affinetridesc.drawtype) {
|
|
|
|
D_PolysetUpdateTables (); // FIXME: precalc...
|
|
|
|
} else {
|
|
|
|
#ifdef USE_INTEL_ASM
|
|
|
|
D_Aff8Patch (acolormap);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-18 14:31:14 +00:00
|
|
|
static void
|
|
|
|
R_IQMPrepareUnclippedPoints (iqm_t *iqm, swiqm_t *sw, iqmframe_t *frame)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
R_IQMTransformAndProjectFinalVerts (iqm, sw, frame);
|
|
|
|
|
|
|
|
if (r_affinetridesc.drawtype)
|
|
|
|
D_PolysetDrawFinalVerts (pfinalverts, iqm->num_verts);
|
|
|
|
|
|
|
|
r_affinetridesc.pfinalverts = pfinalverts;
|
|
|
|
for (i = 0; i < iqm->num_meshes; i++) {
|
|
|
|
iqmmesh *mesh = &iqm->meshes[i];
|
|
|
|
uint16_t *tris;
|
2012-05-18 15:18:03 +00:00
|
|
|
|
|
|
|
iqm_setup_skin (sw, i);
|
|
|
|
|
2012-05-18 14:31:14 +00:00
|
|
|
tris = iqm->elements + mesh->first_triangle;
|
|
|
|
r_affinetridesc.ptriangles = (mtriangle_t *) tris;
|
|
|
|
r_affinetridesc.numtriangles = mesh->num_triangles;
|
|
|
|
D_PolysetDraw ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
R_IQMPreparePoints (iqm_t *iqm, swiqm_t *sw, iqmframe_t *frame)
|
|
|
|
{
|
|
|
|
finalvert_t *fv = pfinalverts;
|
|
|
|
auxvert_t *av = pauxverts;
|
|
|
|
int i;
|
|
|
|
uint32_t j;
|
|
|
|
finalvert_t *pfv[3];
|
|
|
|
|
|
|
|
for (i = 0; i < iqm->num_verts; i++, fv++, av++) {
|
|
|
|
byte *vert = iqm->vertices + i * iqm->stride;
|
|
|
|
uint32_t bind = *(uint32_t *) (vert + sw->bindices->offset);
|
|
|
|
vec_t *mat = (vec_t *) &frame[bind];
|
|
|
|
float *position = (float *) (vert + sw->position->offset);
|
|
|
|
float *normal = (float *) (vert + sw->normal->offset);
|
|
|
|
int32_t *texcoord = (int32_t *) (vert + sw->texcoord->offset);
|
2012-05-20 06:21:25 +00:00
|
|
|
vec3_t tv, tn;
|
2012-05-18 15:34:15 +00:00
|
|
|
Mat4MultVec (mat, position, tv);
|
2012-05-20 06:21:25 +00:00
|
|
|
Mat4as3MultVec (mat, normal, tn);
|
2012-05-18 15:34:15 +00:00
|
|
|
av->fv[0] = DotProduct (tv, aliastransform[0]) + aliastransform[0][3];
|
|
|
|
av->fv[1] = DotProduct (tv, aliastransform[1]) + aliastransform[1][3];
|
|
|
|
av->fv[2] = DotProduct (tv, aliastransform[2]) + aliastransform[2][3];
|
2012-05-18 14:31:14 +00:00
|
|
|
fv->v[2] = texcoord[0];
|
|
|
|
fv->v[3] = texcoord[1];
|
|
|
|
fv->flags = 0;
|
2012-05-20 06:21:25 +00:00
|
|
|
fv->v[4] = calc_light (tn);
|
2012-05-18 14:31:14 +00:00
|
|
|
R_AliasClipAndProjectFinalVert (fv, av);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < iqm->num_meshes; i++) {
|
|
|
|
iqmmesh *mesh = &iqm->meshes[i];
|
|
|
|
mtriangle_t *mtri;
|
2012-05-18 15:18:03 +00:00
|
|
|
|
|
|
|
iqm_setup_skin (sw, i);
|
|
|
|
|
2012-05-18 14:31:14 +00:00
|
|
|
mtri = (mtriangle_t *) iqm->elements + mesh->first_triangle;
|
|
|
|
r_affinetridesc.numtriangles = 1;
|
|
|
|
for (j = 0; j < mesh->num_triangles; j++, mtri++) {
|
|
|
|
pfv[0] = &pfinalverts[mtri->vertindex[0]];
|
|
|
|
pfv[1] = &pfinalverts[mtri->vertindex[1]];
|
|
|
|
pfv[2] = &pfinalverts[mtri->vertindex[2]];
|
|
|
|
|
2012-05-21 23:23:22 +00:00
|
|
|
if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags
|
2012-05-18 14:31:14 +00:00
|
|
|
& (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))
|
|
|
|
continue; // completely clipped
|
|
|
|
|
2012-05-21 23:23:22 +00:00
|
|
|
if (!((pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)
|
2012-05-18 14:31:14 +00:00
|
|
|
& (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))) {// totally unclipped
|
|
|
|
r_affinetridesc.pfinalverts = pfinalverts;
|
|
|
|
r_affinetridesc.ptriangles = mtri;
|
|
|
|
D_PolysetDraw ();
|
|
|
|
} else { // partially clipped
|
|
|
|
R_AliasClipTriangle (mtri);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
R_IQMSetupLighting (entity_t ent, alight_t *plighting)
|
2012-05-18 14:31:14 +00:00
|
|
|
{
|
|
|
|
// guarantee that no vertex will ever be lit below LIGHT_MIN, so we don't
|
|
|
|
// have to clamp off the bottom
|
|
|
|
r_ambientlight = plighting->ambientlight;
|
|
|
|
|
|
|
|
if (r_ambientlight < LIGHT_MIN)
|
|
|
|
r_ambientlight = LIGHT_MIN;
|
|
|
|
|
|
|
|
r_ambientlight = (255 - r_ambientlight) << VID_CBITS;
|
|
|
|
|
|
|
|
if (r_ambientlight < LIGHT_MIN)
|
|
|
|
r_ambientlight = LIGHT_MIN;
|
|
|
|
|
|
|
|
r_shadelight = plighting->shadelight;
|
|
|
|
|
|
|
|
if (r_shadelight < 0)
|
|
|
|
r_shadelight = 0;
|
|
|
|
|
|
|
|
r_shadelight *= VID_GRADES;
|
|
|
|
|
|
|
|
// rotate the lighting vector into the model's frame of reference
|
2021-03-09 14:52:40 +00:00
|
|
|
mat4f_t mat;
|
[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_t transform = Entity_Transform (ent);
|
|
|
|
Transform_GetWorldMatrix (transform, mat);
|
2021-03-09 14:52:40 +00:00
|
|
|
//FIXME vectorize
|
2022-03-17 06:04:30 +00:00
|
|
|
r_lightvec[0] = DotProduct (plighting->lightvec, mat[0]);
|
|
|
|
r_lightvec[1] = DotProduct (plighting->lightvec, mat[1]);
|
|
|
|
r_lightvec[2] = DotProduct (plighting->lightvec, mat[2]);
|
2012-05-18 14:31:14 +00:00
|
|
|
}
|
|
|
|
|
2012-05-18 15:43:26 +00:00
|
|
|
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
|
|
|
R_IQMSetUpTransform (entity_t ent, int trivial_accept)
|
2012-05-18 15:43:26 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
float rotationmatrix[3][4];
|
|
|
|
vec3_t forward, left, up;
|
|
|
|
|
2021-03-09 14:52:40 +00:00
|
|
|
mat4f_t mat;
|
[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_t transform = Entity_Transform (ent);
|
|
|
|
Transform_GetWorldMatrix (transform, mat);
|
2021-03-09 14:52:40 +00:00
|
|
|
VectorCopy (mat[0], forward);
|
|
|
|
VectorCopy (mat[1], left);
|
|
|
|
VectorCopy (mat[2], up);
|
2012-05-18 15:43:26 +00:00
|
|
|
|
|
|
|
// TODO: can do this with simple matrix rearrangement
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
rotationmatrix[i][0] = forward[i];
|
|
|
|
rotationmatrix[i][1] = left[i];
|
|
|
|
rotationmatrix[i][2] = up[i];
|
|
|
|
}
|
|
|
|
|
[renderer] Clean up use of vup/vright/vpn
This moves the common camera setup code out of the individual drivers,
and completely removes vup/vright/vpn from the non-software renderers.
This has highlighted the craziness around AngleVectors with it putting
+X forward, -Y right and +Z up. The main issue with this is it requires
a 90 degree pre-rotation about the Z axis to get the camera pointing in
the right direction, and that's for the native sw renderer (vulkan needs
a 90 degree pre-rotation about X, and gl and glsl need to invert an
axis, too), though at least it's just a matrix swizzle and vector
negation. However, it does mean the camera matrices can't be used
directly.
Also rename vpn to vfwd (still abbreviated, but fwd is much clearer in
meaning (to me, at least) than pn (plane normal, I guess, but which
way?)).
2022-03-14 00:34:24 +00:00
|
|
|
rotationmatrix[0][3] = r_entorigin[0] - r_refdef.frame.position[0];
|
|
|
|
rotationmatrix[1][3] = r_entorigin[1] - r_refdef.frame.position[1];
|
|
|
|
rotationmatrix[2][3] = r_entorigin[2] - r_refdef.frame.position[2];
|
2012-05-18 15:43:26 +00:00
|
|
|
|
2022-03-14 02:56:10 +00:00
|
|
|
R_ConcatTransforms (r_viewmatrix, rotationmatrix, aliastransform);
|
2012-05-18 15:43:26 +00:00
|
|
|
|
|
|
|
// do the scaling up of x and y to screen coordinates as part of the transform
|
|
|
|
// for the unclipped case (it would mess up clipping in the clipped case).
|
|
|
|
// Also scale down z, so 1/z is scaled 31 bits for free, and scale down x and y
|
|
|
|
// correspondingly so the projected x and y come out right
|
|
|
|
// FIXME: make this work for clipped case too?
|
|
|
|
|
|
|
|
if (trivial_accept) {
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
aliastransform[0][i] *= aliasxscale *
|
|
|
|
(1.0 / ((float) 0x8000 * 0x10000));
|
|
|
|
aliastransform[1][i] *= aliasyscale *
|
|
|
|
(1.0 / ((float) 0x8000 * 0x10000));
|
|
|
|
aliastransform[2][i] *= 1.0 / ((float) 0x8000 * 0x10000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-18 14:31:14 +00:00
|
|
|
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
|
|
|
R_IQMDrawModel (entity_t ent, alight_t *plighting)
|
2012-05-18 14:31:14 +00:00
|
|
|
{
|
2022-10-25 03:53:30 +00:00
|
|
|
renderer_t *renderer = Ent_GetComponent (ent.id, scene_renderer, ent.reg);
|
[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
|
|
|
model_t *model = renderer->model;
|
2012-05-18 14:31:14 +00:00
|
|
|
iqm_t *iqm = (iqm_t *) model->aliashdr;
|
|
|
|
swiqm_t *sw = (swiqm_t *) iqm->extra_data;
|
|
|
|
int size;
|
|
|
|
float blend;
|
|
|
|
iqmframe_t *frame;
|
|
|
|
|
2012-05-18 15:34:15 +00:00
|
|
|
size = (CACHE_SIZE - 1)
|
2012-05-18 14:31:14 +00:00
|
|
|
+ sizeof (finalvert_t) * (iqm->num_verts + 1)
|
|
|
|
+ sizeof (auxvert_t) * iqm->num_verts;
|
2022-10-25 03:53:30 +00:00
|
|
|
|
|
|
|
animation_t *animation = Ent_GetComponent (ent.id, scene_animation,
|
|
|
|
ent.reg);
|
[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
|
|
|
blend = R_IQMGetLerpedFrames (animation, iqm);
|
|
|
|
frame = R_IQMBlendPalette (iqm, animation->pose1, animation->pose2,
|
2021-03-09 14:52:40 +00:00
|
|
|
blend, size, sw->blend_palette,
|
|
|
|
sw->palette_size);
|
2012-05-18 15:34:15 +00:00
|
|
|
|
2012-05-18 14:31:14 +00:00
|
|
|
pfinalverts = (finalvert_t *) &frame[sw->palette_size];
|
|
|
|
pfinalverts = (finalvert_t *)
|
|
|
|
(((intptr_t) &pfinalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
|
|
|
|
pauxverts = (auxvert_t *) &pfinalverts[iqm->num_verts + 1];
|
2012-05-21 23:23:22 +00:00
|
|
|
|
2022-10-25 03:53:30 +00:00
|
|
|
visibility_t *visibility = Ent_GetComponent (ent.id, scene_visibility,
|
|
|
|
ent.reg);
|
[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
|
|
|
R_IQMSetUpTransform (ent, visibility->trivial_accept);
|
2012-05-18 14:31:14 +00:00
|
|
|
|
|
|
|
R_IQMSetupLighting (ent, plighting);
|
[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
|
|
|
r_affinetridesc.drawtype = (visibility->trivial_accept == 3) &&
|
2012-05-18 14:31:14 +00:00
|
|
|
r_recursiveaffinetriangles;
|
|
|
|
|
|
|
|
//if (!acolormap)
|
2022-03-29 04:08:58 +00:00
|
|
|
acolormap = r_colormap;
|
2012-05-18 14:31:14 +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
|
|
|
//FIXME depth hack
|
|
|
|
if (ent.id != vr_data.view_model.id)
|
2012-05-18 14:31:14 +00:00
|
|
|
ziscale = (float) 0x8000 *(float) 0x10000;
|
|
|
|
else
|
|
|
|
ziscale = (float) 0x8000 *(float) 0x10000 *3.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
|
|
|
if (visibility->trivial_accept)
|
2012-05-18 14:31:14 +00:00
|
|
|
R_IQMPrepareUnclippedPoints (iqm, sw, frame);
|
|
|
|
else
|
|
|
|
R_IQMPreparePoints (iqm, sw, frame);
|
|
|
|
}
|