SW now tries (but fails miserably) to render iqm models.

Something seems to be very wrong with the transforms.
This commit is contained in:
Bill Currie 2012-05-18 23:31:14 +09:00
parent da87ac0ce5
commit fb10f38fd4
8 changed files with 392 additions and 42 deletions

View file

@ -159,7 +159,9 @@ void R_DrawSolidClippedSubmodelPolygons (model_t *pmodel);
void R_AddPolygonEdges (emitpoint_t *pverts, int numverts, int miplevel);
surf_t *R_GetSurf (void);
void R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av);
void R_AliasDrawModel (alight_t *plighting);
void R_IQMDrawModel (alight_t *plighting);
maliasskindesc_t *R_AliasGetSkindesc (int skinnum, aliashdr_t *hdr);
maliasframedesc_t *R_AliasGetFramedesc (int framenum, aliashdr_t *hdr);
float R_AliasGetLerpedFrames (entity_t *ent, aliashdr_t *hdr);
@ -228,6 +230,8 @@ extern float leftclip, topclip, rightclip, bottomclip;
extern int r_acliptype;
extern finalvert_t *pfinalverts;
extern auxvert_t *pauxverts;
extern float ziscale;
extern float aliastransform[3][4];
qboolean R_AliasCheckBBox (void);

View file

@ -168,6 +168,23 @@ sw_iqm_load_textures (iqm_t *iqm)
dstring_delete (str);
}
static void
sw_iqm_convert_tris (iqm_t *iqm)
{
mtriangle_t *tris;
uint32_t i;
uint32_t num_tris;
num_tris = iqm->num_elements / 3;
tris = malloc (num_tris * sizeof (mtriangle_t));
for (i = 0; i < num_tris; i++) {
tris[i].facesfront = 1;
VectorCopy (iqm->elements + i * 3, tris[i].vertindex);
}
free (iqm->elements);
iqm->elements = (uint16_t *) tris;
}
void
sw_Mod_IQMFinish (model_t *mod)
{
@ -189,4 +206,5 @@ sw_Mod_IQMFinish (model_t *mod)
sw->bindices = &iqm->vertexarrays[i];
}
sw_iqm_load_textures (iqm);
sw_iqm_convert_tris (iqm);
}

View file

@ -18,8 +18,8 @@ sw_src= \
d_edge.c d_fill.c d_init.c d_modech.c d_part.c d_polyse.c d_scan.c \
d_sky.c d_sprite.c d_surf.c d_vars.c d_zpoint.c draw.c fpu.c nonintel.c \
screen.c sw_graph.c sw_raclip.c sw_ralias.c sw_rbsp.c sw_rdraw.c \
sw_redge.c sw_rmain.c sw_rmisc.c sw_rpart.c sw_rsky.c sw_rsprite.c \
sw_rsurf.c \
sw_redge.c sw_riqm.c sw_rmain.c sw_rmisc.c sw_rpart.c sw_rsky.c \
sw_rsprite.c sw_rsurf.c \
vid_common_sw.c
libswrend_asm_la_LDFLAGS= @STATIC@

View file

@ -56,7 +56,7 @@ float r_shadelight;
static aliashdr_t *paliashdr;
finalvert_t *pfinalverts;
auxvert_t *pauxverts;
static float ziscale;
float ziscale;
static model_t *pmodel;
static vec3_t alias_forward, alias_right, alias_up;
@ -239,7 +239,7 @@ R_AliasTransformVector (vec3_t in, vec3_t out)
out[2] = DotProduct (in, aliastransform[2]) + aliastransform[2][3];
}
static void
void
R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av)
{
if (av->fv[2] < ALIAS_Z_CLIP_PLANE) {
@ -333,12 +333,12 @@ R_AliasPreparePoints (void)
pfv[1] = &pfinalverts[ptri->vertindex[1]];
pfv[2] = &pfinalverts[ptri->vertindex[2]];
if (pfv[0]->flags & pfv[1]->flags & pfv[2]->
flags & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))
if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags
& (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))
continue; // completely clipped
if (!((pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) &
(ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))) { // totally unclipped
if (!((pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)
& (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))) { // totally unclipped
r_affinetridesc.pfinalverts = pfinalverts;
r_affinetridesc.ptriangles = ptri;
D_PolysetDraw ();

View file

@ -0,0 +1,317 @@
/*
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"
#include "d_ifacea.h"
#include "r_internal.h"
#define LIGHT_MIN 5 // lowest light value we'll allow, to
// avoid the need for inner-loop light
// clamping
static vec3_t r_plightvec;
static int r_ambientlight;
static float r_shadelight;
static inline int
calc_light (float *normal)
{
float lightcos = DotProduct (normal, r_plightvec);
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);
vec3_t tv;
Mat4MultVec (mat, position, tv);
zi = 1.0 / tv[2];
fv->v[5] = zi;
fv->v[0] = tv[0] * zi + aliasxcenter;
fv->v[1] = tv[1] * zi + aliasxcenter;
fv->v[2] = texcoord[0];
fv->v[3] = texcoord[1];
fv->v[4] = calc_light (normal);
}
}
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;
tex_t *skin = sw->skins[i];
maliasskindesc_t skindesc = {0, 0, 0, 0};
// setup skin
r_affinetridesc.pskindesc = &skindesc;
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
}
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);
Mat4MultVec (mat, position, av->fv);
fv->v[2] = texcoord[0];
fv->v[3] = texcoord[1];
fv->flags = 0;
fv->v[4] = calc_light (normal);
R_AliasClipAndProjectFinalVert (fv, av);
}
for (i = 0; i < iqm->num_meshes; i++) {
iqmmesh *mesh = &iqm->meshes[i];
mtriangle_t *mtri;
tex_t *skin = sw->skins[i];
maliasskindesc_t skindesc = {0, 0, 0, 0};
// setup skin
r_affinetridesc.pskindesc = &skindesc;
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
}
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]];
if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags
& (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))
continue; // completely clipped
if (!((pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)
& (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);
}
}
}
}
// NOTE: in1 is row major but in2 is column major
// WARNING: will NOT work if in2 and out are the same location
static void
iqm_concat_transforms (float in1[3][4], const mat4_t in2, mat4_t out)
{
out[0] = DotProduct (in1[0], in2 + 0);
out[1] = DotProduct (in1[1], in2 + 0);
out[2] = DotProduct (in1[2], in2 + 0);
out[3] = 0;
out[4] = DotProduct (in1[0], in2 + 4);
out[5] = DotProduct (in1[1], in2 + 4);
out[6] = DotProduct (in1[2], in2 + 4);
out[7] = 0;
out[8] = DotProduct (in1[0], in2 + 8);
out[9] = DotProduct (in1[1], in2 + 8);
out[10] = DotProduct (in1[2], in2 + 8);
out[11] = 0;
out[12] = DotProduct (in1[0], in2 + 12) + in1[0][3];
out[13] = DotProduct (in1[1], in2 + 12) + in1[1][3];
out[14] = DotProduct (in1[2], in2 + 12) + in1[2][3];
out[15] = 1;
}
static void
R_IQMSetupLighting (entity_t *ent, alight_t *plighting)
{
// 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
r_plightvec[0] = DotProduct (plighting->plightvec, ent->transform + 0);
r_plightvec[1] = DotProduct (plighting->plightvec, ent->transform + 4);
r_plightvec[2] = DotProduct (plighting->plightvec, ent->transform + 8);
}
void
R_IQMDrawModel (alight_t *plighting)
{
entity_t *ent = currententity;
model_t *model = ent->model;
iqm_t *iqm = (iqm_t *) model->aliashdr;
swiqm_t *sw = (swiqm_t *) iqm->extra_data;
int size;
float blend;
iqmframe_t *frame;
int i, j;
size = (sw->palette_size - iqm->num_joints) * sizeof (iqmframe_t);
size += (CACHE_SIZE - 1)
+ sizeof (finalvert_t) * (iqm->num_verts + 1)
+ sizeof (auxvert_t) * iqm->num_verts;
blend = R_IQMGetLerpedFrames (ent, iqm);
frame = R_IQMBlendFrames (iqm, ent->pose1, ent->pose2, blend, size);
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];
R_AliasSetUpTransform (ent->trivial_accept);
for (i = iqm->num_joints; i < sw->palette_size; i++) {
vec_t *mat = (vec_t *) &frame[i];
mat4_t tmat;
iqmblend_t *blend = &sw->blend_palette[i];
vec_t *f;
f = (vec_t *) &frame[blend->indices[0]];
Mat4Scale (f, blend->weights[0] / 255.0, tmat);
for (j = 1; j < 4; j++) {
if (!blend->weights[j])
break;
f = (vec_t *) &frame[blend->indices[j]];
Mat4MultAdd (tmat, blend->weights[j] / 255.0, f, tmat);
}
iqm_concat_transforms (aliastransform, tmat, mat);
}
R_IQMSetupLighting (ent, plighting);
r_affinetridesc.drawtype = (ent->trivial_accept == 3) &&
r_recursiveaffinetriangles;
//if (!acolormap)
acolormap = vid.colormap8;
if (ent != vr_data.view_model)
ziscale = (float) 0x8000 *(float) 0x10000;
else
ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
if (ent->trivial_accept)
R_IQMPrepareUnclippedPoints (iqm, sw, frame);
else
R_IQMPreparePoints (iqm, sw, frame);
}

View file

@ -369,6 +369,7 @@ R_DrawEntitiesOnList (void)
break;
case mod_alias:
case mod_iqm:
VectorCopy (currententity->origin, r_entorigin);
VectorSubtract (r_origin, r_entorigin, modelorg);
@ -376,7 +377,9 @@ R_DrawEntitiesOnList (void)
// see if the bounding box lets us trivially reject, also
// sets trivial accept status
if (R_AliasCheckBBox ()) {
currententity->trivial_accept = 0; //FIXME
if (currententity->model->type == mod_iqm//FIXME
|| R_AliasCheckBBox ()) {
// 128 instead of 255 due to clamping below
j = max (R_LightPoint (currententity->origin), minlight * 128);
@ -402,7 +405,10 @@ R_DrawEntitiesOnList (void)
if (lighting.ambientlight + lighting.shadelight > 192)
lighting.shadelight = 192 - lighting.ambientlight;
R_AliasDrawModel (&lighting);
if (currententity->model->type == mod_iqm)
R_IQMDrawModel (&lighting);
else
R_AliasDrawModel (&lighting);
}
break;

View file

@ -52,6 +52,7 @@
#define Draw_nString sw32_Draw_nString
#define R_AliasCheckBBox sw32_R_AliasCheckBBox
#define R_AliasClipTriangle sw32_R_AliasClipTriangle
#define R_AliasClipAndProjectFinalVert sw32_R_AliasClipAndProjectFinalVert
#define R_AliasDrawModel sw32_R_AliasDrawModel
#define R_AliasProjectFinalVert sw32_R_AliasProjectFinalVert
#define R_AliasSetUpTransform sw32_R_AliasSetUpTransform
@ -289,6 +290,7 @@ extern struct surf_s *sw32_surfaces;
#undef Draw_nString
#undef R_AliasCheckBBox
#undef R_AliasClipTriangle
#undef R_AliasClipAndProjectFinalVert
#undef R_AliasDrawModel
#undef R_AliasProjectFinalVert
#undef R_AliasSetUpTransform

View file

@ -59,7 +59,7 @@ float sw32_r_shadelight;
static aliashdr_t *paliashdr;
finalvert_t *sw32_pfinalverts;
auxvert_t *sw32_pauxverts;
static float ziscale;
static float sw32_ziscale;
static model_t *pmodel;
static vec3_t alias_forward, alias_right, alias_up;
@ -70,7 +70,7 @@ int sw32_r_amodels_drawn;
static int a_skinwidth;
static int r_anumverts;
static float aliastransform[3][4];
static float sw32_aliastransform[3][4];
typedef struct {
int index0;
@ -238,14 +238,17 @@ sw32_R_AliasCheckBBox (void)
void
sw32_R_AliasTransformVector (vec3_t in, vec3_t out)
{
out[0] = DotProduct (in, aliastransform[0]) + aliastransform[0][3];
out[1] = DotProduct (in, aliastransform[1]) + aliastransform[1][3];
out[2] = DotProduct (in, aliastransform[2]) + aliastransform[2][3];
out[0] = DotProduct (in, sw32_aliastransform[0])
+ sw32_aliastransform[0][3];
out[1] = DotProduct (in, sw32_aliastransform[1])
+ sw32_aliastransform[1][3];
out[2] = DotProduct (in, sw32_aliastransform[2])
+ sw32_aliastransform[2][3];
}
static void
R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av)
void
sw32_R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av)
{
if (av->fv[2] < ALIAS_Z_CLIP_PLANE) {
fv->flags |= ALIAS_Z_CLIP;
@ -274,23 +277,23 @@ R_AliasTransformFinalVert16 (auxvert_t *av, trivertx_t *pverts)
vextra[0] = pverts->v[0] + pextra->v[0] / (float)256;
vextra[1] = pverts->v[1] + pextra->v[1] / (float)256;
vextra[2] = pverts->v[2] + pextra->v[2] / (float)256;
av->fv[0] = DotProduct (vextra, aliastransform[0]) +
aliastransform[0][3];
av->fv[1] = DotProduct (vextra, aliastransform[1]) +
aliastransform[1][3];
av->fv[2] = DotProduct (vextra, aliastransform[2]) +
aliastransform[2][3];
av->fv[0] = DotProduct (vextra, sw32_aliastransform[0]) +
sw32_aliastransform[0][3];
av->fv[1] = DotProduct (vextra, sw32_aliastransform[1]) +
sw32_aliastransform[1][3];
av->fv[2] = DotProduct (vextra, sw32_aliastransform[2]) +
sw32_aliastransform[2][3];
}
static void
R_AliasTransformFinalVert8 (auxvert_t *av, trivertx_t *pverts)
{
av->fv[0] = DotProduct (pverts->v, aliastransform[0]) +
aliastransform[0][3];
av->fv[1] = DotProduct (pverts->v, aliastransform[1]) +
aliastransform[1][3];
av->fv[2] = DotProduct (pverts->v, aliastransform[2]) +
aliastransform[2][3];
av->fv[0] = DotProduct (pverts->v, sw32_aliastransform[0]) +
sw32_aliastransform[0][3];
av->fv[1] = DotProduct (pverts->v, sw32_aliastransform[1]) +
sw32_aliastransform[1][3];
av->fv[2] = DotProduct (pverts->v, sw32_aliastransform[2]) +
sw32_aliastransform[2][3];
}
/*
@ -400,7 +403,7 @@ sw32_R_AliasSetUpTransform (int trivial_accept)
// viewmatrix[1][3] = 0;
// viewmatrix[2][3] = 0;
R_ConcatTransforms (viewmatrix, rotationmatrix, aliastransform);
R_ConcatTransforms (viewmatrix, rotationmatrix, sw32_aliastransform);
// 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).
@ -409,11 +412,11 @@ sw32_R_AliasSetUpTransform (int trivial_accept)
// FIXME: make this work for clipped case too?
if (trivial_accept) {
for (i = 0; i < 4; i++) {
aliastransform[0][i] *= sw32_aliasxscale *
sw32_aliastransform[0][i] *= sw32_aliasxscale *
(1.0 / ((float) 0x8000 * 0x10000));
aliastransform[1][i] *= sw32_aliasyscale *
sw32_aliastransform[1][i] *= sw32_aliasyscale *
(1.0 / ((float) 0x8000 * 0x10000));
aliastransform[2][i] *= 1.0 / ((float) 0x8000 * 0x10000);
sw32_aliastransform[2][i] *= 1.0 / ((float) 0x8000 * 0x10000);
}
}
}
@ -465,18 +468,18 @@ sw32_R_AliasTransformAndProjectFinalVerts (finalvert_t *fv, stvert_t *pstverts)
for (i = 0; i < r_anumverts; i++, fv++, pverts++, pstverts++) {
// transform and project
zi = 1.0 / (DotProduct (pverts->v, aliastransform[2]) +
aliastransform[2][3]);
zi = 1.0 / (DotProduct (pverts->v, sw32_aliastransform[2]) +
sw32_aliastransform[2][3]);
// x, y, and z are scaled down by 1/2**31 in the transform, so 1/z is
// scaled up by 1/2**31, and the scaling cancels out for x and y in
// the projection
fv->v[5] = zi;
fv->v[0] = ((DotProduct (pverts->v, aliastransform[0]) +
aliastransform[0][3]) * zi) + sw32_aliasxcenter;
fv->v[1] = ((DotProduct (pverts->v, aliastransform[1]) +
aliastransform[1][3]) * zi) + sw32_aliasycenter;
fv->v[0] = ((DotProduct (pverts->v, sw32_aliastransform[0]) +
sw32_aliastransform[0][3]) * zi) + sw32_aliasxcenter;
fv->v[1] = ((DotProduct (pverts->v, sw32_aliastransform[1]) +
sw32_aliastransform[1][3]) * zi) + sw32_aliasycenter;
fv->v[2] = pstverts->s;
fv->v[3] = pstverts->t;
@ -509,7 +512,7 @@ sw32_R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av)
// project points
zi = 1.0 / av->fv[2];
fv->v[5] = zi * ziscale;
fv->v[5] = zi * sw32_ziscale;
fv->v[0] = (av->fv[0] * sw32_aliasxscale * zi) + sw32_aliasxcenter;
fv->v[1] = (av->fv[1] * sw32_aliasyscale * zi) + sw32_aliasycenter;
@ -657,9 +660,9 @@ sw32_R_AliasDrawModel (alight_t *plighting)
}
if (currententity != vr_data.view_model)
ziscale = (float) 0x8000 *(float) 0x10000;
sw32_ziscale = (float) 0x8000 *(float) 0x10000;
else
ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
sw32_ziscale = (float) 0x8000 *(float) 0x10000 *3.0;
if (currententity->trivial_accept)
R_AliasPrepareUnclippedPoints ();