out[2] = v->z + (out[2] * iw + 1.0f) * v->depth * 0.5f;
}
-static void R_Viewport_ApplyNearClipPlane(r_viewport_t *v, double normalx, double normaly, double normalz, double dist)
+static void R_Viewport_ApplyNearClipPlane(r_viewport_t *v, float normalx, float normaly, float normalz, float dist)
{
- double q[4];
- double d;
+ float q[4];
+ float d;
float clipPlane[4], v3[3], v4[3];
float normal[3];
v->m[14] = clipPlane[3] * d;
}
-void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, double x1, double y1, double x2, double y2, double nearclip, double farclip, const double *nearplane)
+void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float x1, float y1, float x2, float y2, float nearclip, float farclip, const float *nearplane)
{
float left = x1, right = x2, bottom = y2, top = y1, zNear = nearclip, zFar = farclip;
memset(v, 0, sizeof(*v));
#endif
}
-void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, double frustumx, double frustumy, double nearclip, double farclip, const double *nearplane)
+void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float nearclip, float farclip, const float *nearplane)
{
matrix4x4_t tempmatrix, basematrix;
memset(v, 0, sizeof(*v));
R_Viewport_ApplyNearClipPlane(v, nearplane[0], nearplane[1], nearplane[2], nearplane[3]);
}
-void R_Viewport_InitPerspectiveInfinite(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, double frustumx, double frustumy, double nearclip, const double *nearplane)
+void R_Viewport_InitPerspectiveInfinite(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float frustumx, float frustumy, float nearclip, const float *nearplane)
{
matrix4x4_t tempmatrix, basematrix;
- const double nudge = 1.0 - 1.0 / (1<<23);
+ const float nudge = 1.0 - 1.0 / (1<<23);
memset(v, 0, sizeof(*v));
if(v_flipped.integer)
}
}
+int R_Mesh_TexBound(unsigned int unitnum, int id)
+{
+ gltextureunit_t *unit = gl_state.units + unitnum;
+ if (unitnum >= vid.teximageunits)
+ return 0;
+ if (id == GL_TEXTURE_2D)
+ return unit->t2d;
+ if (id == GL_TEXTURE_3D)
+ return unit->t3d;
+ if (id == GL_TEXTURE_CUBE_MAP_ARB)
+ return unit->tcubemap;
+ if (id == GL_TEXTURE_RECTANGLE_ARB)
+ return unit->trectangle;
+ return 0;
+}
+
void R_Mesh_TexBindAll(unsigned int unitnum, int tex2d, int tex3d, int texcubemap, int texrectangle)
{
gltextureunit_t *unit = gl_state.units + unitnum;