/** R_SetFrustum */ void R_SetFrustum() { // rotate VPN right by FOV_X/2 degrees Math3D.RotatePointAroundVector(frustum[0].normal, vup, vpn, -(90f - r_newrefdef.fov_x / 2f)); // rotate VPN left by FOV_X/2 degrees Math3D.RotatePointAroundVector(frustum[1].normal, vup, vpn, 90f - r_newrefdef.fov_x / 2f); // rotate VPN up by FOV_X/2 degrees Math3D.RotatePointAroundVector(frustum[2].normal, vright, vpn, 90f - r_newrefdef.fov_y / 2f); // rotate VPN down by FOV_X/2 degrees Math3D.RotatePointAroundVector(frustum[3].normal, vright, vpn, -(90f - r_newrefdef.fov_y / 2f)); for (int i = 0; i < 4; i++) { frustum[i].type = Defines.PLANE_ANYZ; frustum[i].dist = Math3D.DotProduct(r_origin, frustum[i].normal); frustum[i].signbits = (byte) SignbitsForPlane(frustum[i]); } }
/** R_DrawBeam */ void R_DrawBeam(entity_t e) { oldorigin[0] = e.oldorigin[0]; oldorigin[1] = e.oldorigin[1]; oldorigin[2] = e.oldorigin[2]; origin[0] = e.origin[0]; origin[1] = e.origin[1]; origin[2] = e.origin[2]; normalized_direction[0] = direction[0] = oldorigin[0] - origin[0]; normalized_direction[1] = direction[1] = oldorigin[1] - origin[1]; normalized_direction[2] = direction[2] = oldorigin[2] - origin[2]; if (Math3D.VectorNormalize(normalized_direction) == 0.0f) return; Math3D.PerpendicularVector(perpvec, normalized_direction); Math3D.VectorScale(perpvec, e.frame / 2, perpvec); for (int i = 0; i < 6; i++) { Math3D.RotatePointAroundVector( start_points[i], normalized_direction, perpvec, (360.0f / NUM_BEAM_SEGS) * i); Math3D.VectorAdd(start_points[i], origin, start_points[i]); Math3D.VectorAdd(start_points[i], direction, end_points[i]); } GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); float r = (d_8to24table[e.skinnum & 0xFF]) & 0xFF; float g = (d_8to24table[e.skinnum & 0xFF] >> 8) & 0xFF; float b = (d_8to24table[e.skinnum & 0xFF] >> 16) & 0xFF; r *= 1 / 255.0f; g *= 1 / 255.0f; b *= 1 / 255.0f; GL11.glColor4f(r, g, b, e.alpha); GL11.glBegin(GL11.GL_TRIANGLE_STRIP); float[] v; for (int i = 0; i < NUM_BEAM_SEGS; i++) { v = start_points[i]; GL11.glVertex3f(v[0], v[1], v[2]); v = end_points[i]; GL11.glVertex3f(v[0], v[1], v[2]); v = start_points[(i + 1) % NUM_BEAM_SEGS]; GL11.glVertex3f(v[0], v[1], v[2]); v = end_points[(i + 1) % NUM_BEAM_SEGS]; GL11.glVertex3f(v[0], v[1], v[2]); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); }