mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Updates
This commit is contained in:
parent
f1f9ed744d
commit
8e1b2ea296
27 changed files with 4196 additions and 12 deletions
|
@ -240,7 +240,8 @@ if (WITH_CLIENT)
|
|||
include("code/renderergl2/glsl/shaders.cmake")
|
||||
#file(GLOB_RECURSE SOURCES_RENDERER "code/sdl/*.c" "code/renderer/*.c" "code/renderer/*.cpp")
|
||||
file(GLOB_RECURSE SOURCES_RENDERER "code/sdl/*.c" "code/renderercommon/*.c" "code/renderergl2/*.c" "code/renderergl2/*.cpp")
|
||||
list(FILTER SOURCES_RENDERER EXCLUDE REGEX "(.*)/tr_subs.c")
|
||||
list(FILTER SOURCES_RENDERER EXCLUDE REGEX "code/renderergl2/tr_subs.c")
|
||||
list(FILTER SOURCES_RENDERER EXCLUDE REGEX "code/renderergl2/tr_model.c")
|
||||
set(SOURCES_CLIENT_APP ${SOURCES_APP} ${SOURCES_SERVER} ${SOURCES_CLIENT} ${SOURCES_UILIB} ${SOURCES_LIBS} ${SOURCES_RENDERER} ${SHADER_SRCS})
|
||||
|
||||
add_executable(openmohaa ${SOURCES_PLATFORM_SPECIFIC} ${SOURCES_CLIENT_APP} ${SOURCES_CLIENT_PLATFORM_SPECIFIC})
|
||||
|
@ -282,7 +283,7 @@ if (WITH_CLIENT)
|
|||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(openmohaa PRIVATE sdl2 sdl2main)
|
||||
target_link_libraries(openmohaa PRIVATE opengl32 sdl2 sdl2main)
|
||||
endif()
|
||||
|
||||
target_link_libraries(openmohaa PRIVATE wsock32 ws2_32)
|
||||
|
|
|
@ -1087,11 +1087,11 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
|
|||
|
||||
if( clc.state > CA_DISCONNECTED && cge && !Key_GetCatcher() && cge->CG_CheckCaptureKey( key, down, time ) && key != K_ESCAPE )
|
||||
{
|
||||
if( key != '`' && key != '~' )
|
||||
if (key == K_CONSOLE || (keys[K_SHIFT].down && key == K_ESCAPE))
|
||||
return;
|
||||
}
|
||||
|
||||
if( key == '`' || key == '~' )
|
||||
if (key == K_CONSOLE || (keys[K_SHIFT].down && key == K_ESCAPE))
|
||||
{
|
||||
if( !down ) {
|
||||
return;
|
||||
|
|
|
@ -3174,7 +3174,7 @@ void CL_Init( void ) {
|
|||
}
|
||||
|
||||
// ~ and `, as keys and characters
|
||||
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE );
|
||||
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60 0x11e", CVAR_ARCHIVE );
|
||||
|
||||
// userinfo
|
||||
name = Cvar_Get ("name", "UnnamedSoldier", CVAR_USERINFO | CVAR_ARCHIVE );
|
||||
|
|
|
@ -1680,6 +1680,8 @@ void Com_Frame( void ) {
|
|||
msec = com_frameTime - lastTime;
|
||||
} while ( msec < minMsec );
|
||||
|
||||
IN_Frame();
|
||||
|
||||
#ifndef DEDICATED
|
||||
if( com_dedicated->integer || CL_FinishedIntro() )
|
||||
{
|
||||
|
|
|
@ -26,6 +26,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include "../renderercommon/tr_public.h"
|
||||
#include "qgl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
IMGTYPE_COLORALPHA, // for color, lightmap, diffuse, and specular
|
||||
|
@ -168,4 +172,8 @@ void GLimp_SetGamma( unsigned char red[256],
|
|||
unsigned char blue[256] );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,18 +34,21 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define REFENTITYNUM_WORLD ((1<<REFENTITYNUM_BITS) - 1)
|
||||
|
||||
// renderfx flags
|
||||
/*
|
||||
#define RF_MINLIGHT 0x0001 // allways have some light (viewmodel, some items)
|
||||
#define RF_THIRD_PERSON 0x0002 // don't draw through eyes, only mirrors (player bodies, chat sprites)
|
||||
#define RF_FIRST_PERSON 0x0004 // only draw through eyes (view weapon, damage blood blob)
|
||||
#define RF_DEPTHHACK 0x0008 // for view weapon Z crunching
|
||||
|
||||
#define RF_CROSSHAIR 0x0010 // This item is a cross hair and will draw over everything similar to
|
||||
*/
|
||||
#define RF_CROSSHAIR (1<<31) // This item is a cross hair and will draw over everything similar to
|
||||
// DEPTHHACK in stereo rendering mode, with the difference that the
|
||||
// projection matrix won't be hacked to reduce the stereo separation as
|
||||
// is done for the gun.
|
||||
|
||||
#define RF_NOSHADOW 0x0040 // don't add stencil shadows
|
||||
|
||||
/*
|
||||
#define RF_LIGHTING_ORIGIN 0x0080 // use refEntity->lightingOrigin instead of refEntity->origin
|
||||
// for lighting. This allows entities to sink into the floor
|
||||
// with their origin going solid, and allows all parts of a
|
||||
|
@ -54,7 +57,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define RF_SHADOW_PLANE 0x0100 // use refEntity->shadowPlane
|
||||
#define RF_WRAP_FRAMES 0x0200 // mod the model frames by the maxframes to allow continuous
|
||||
// animation without needing to know the frame count
|
||||
|
||||
*/
|
||||
// refdef flags
|
||||
#define RDF_NOWORLDMODEL 0x0001 // used for player configuration screen
|
||||
#define RDF_HYPERSPACE 0x0004 // teleportation effect
|
||||
|
|
34
code/renderergl2/new/tr_bsp.c
Normal file
34
code/renderergl2/new/tr_bsp.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
int RE_MapVersion(void)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RE_PrintBSPFileSizes(void)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
38
code/renderergl2/new/tr_cmds.c
Normal file
38
code/renderergl2/new/tr_cmds.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
static backEndCounters_t pc_save;
|
||||
|
||||
/*
|
||||
=====================
|
||||
R_PerformanceCounters
|
||||
=====================
|
||||
*/
|
||||
void R_SavePerformanceCounters(void) {
|
||||
memcpy(&pc_save, &backEnd.pc, sizeof(pc_save));
|
||||
}
|
||||
|
||||
void R_SyncRenderThread() {
|
||||
R_IssuePendingRenderCommands();
|
||||
}
|
440
code/renderergl2/new/tr_draw.c
Normal file
440
code/renderergl2/new/tr_draw.c
Normal file
|
@ -0,0 +1,440 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code 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.
|
||||
|
||||
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// tr_draw.c -- drawing
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
vec4_t r_colorWhite = { 1.0, 1.0, 1.0, 1.0 };
|
||||
|
||||
/*
|
||||
================
|
||||
Draw_SetColor
|
||||
================
|
||||
*/
|
||||
void Draw_SetColor(const vec4_t rgba) {
|
||||
#if 1
|
||||
if (!rgba) {
|
||||
rgba = r_colorWhite;
|
||||
}
|
||||
|
||||
backEnd.color2D[0] = (byte)(rgba[0] * tr.identityLightByte);
|
||||
backEnd.color2D[1] = (byte)(rgba[1] * tr.identityLightByte);
|
||||
backEnd.color2D[2] = (byte)(rgba[2] * tr.identityLightByte);
|
||||
backEnd.color2D[3] = (byte)(rgba[3] * 255.0);
|
||||
#else
|
||||
RE_SetColor(rgba);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Draw_StretchPic
|
||||
================
|
||||
*/
|
||||
void Draw_StretchPic(float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader) {
|
||||
#if 1
|
||||
shader_t* shader;
|
||||
|
||||
R_SyncRenderThread();
|
||||
|
||||
if (hShader) {
|
||||
shader = R_GetShaderByHandle(hShader);
|
||||
}
|
||||
else {
|
||||
shader = tr.defaultShader;
|
||||
}
|
||||
|
||||
if (w <= 0) {
|
||||
w = shader->stages[0]->bundle[0].image[0]->width;
|
||||
h = shader->stages[0]->bundle[0].image[0]->height;
|
||||
}
|
||||
|
||||
// draw the pic
|
||||
RB_Color4f(backEnd.color2D[0], backEnd.color2D[1], backEnd.color2D[2], backEnd.color2D[3]);
|
||||
RB_BeginSurface(shader, 0, 0);
|
||||
|
||||
RB_Texcoord2f(s1, t1);
|
||||
RB_Vertex2f(x, y);
|
||||
|
||||
RB_Texcoord2f(s2, t1);
|
||||
RB_Vertex2f(x + w, y);
|
||||
|
||||
RB_Texcoord2f(s1, t2);
|
||||
RB_Vertex2f(x, y + h);
|
||||
|
||||
RB_Texcoord2f(s2, t2);
|
||||
RB_Vertex2f(x + w, y + h);
|
||||
|
||||
RB_StreamEnd();
|
||||
#else
|
||||
RE_StretchPic(x, y, w, h, s1, t1, s2, t2, hShader);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Draw_TilePic
|
||||
================
|
||||
*/
|
||||
void Draw_TilePic(float x, float y, float w, float h, qhandle_t hShader) {
|
||||
shader_t* shader;
|
||||
float picw, pich;
|
||||
|
||||
R_SyncRenderThread();
|
||||
|
||||
if (hShader) {
|
||||
shader = R_GetShaderByHandle(hShader);
|
||||
}
|
||||
else {
|
||||
shader = tr.defaultShader;
|
||||
}
|
||||
|
||||
if (w <= 0) {
|
||||
w = shader->stages[0]->bundle[0].image[0]->width;
|
||||
h = shader->stages[0]->bundle[0].image[0]->height;
|
||||
}
|
||||
|
||||
picw = shader->stages[0]->bundle[0].image[0]->uploadWidth;
|
||||
pich = shader->stages[0]->bundle[0].image[0]->uploadHeight;
|
||||
|
||||
// draw the pic
|
||||
RB_Color4f(backEnd.color2D[0], backEnd.color2D[1], backEnd.color2D[2], backEnd.color2D[3]);
|
||||
|
||||
RB_StreamBegin(shader);
|
||||
|
||||
RB_Texcoord2f(x / picw, y / pich);
|
||||
RB_Vertex2f(x, y);
|
||||
|
||||
RB_Texcoord2f((x + w) / picw, y / pich);
|
||||
RB_Vertex2f(x + w, y);
|
||||
|
||||
RB_Texcoord2f(x / picw, (y + h) / pich);
|
||||
RB_Vertex2f(x, y + h);
|
||||
|
||||
RB_Texcoord2f((x + w) / picw, (y + h) / pich);
|
||||
RB_Vertex2f(x + w, y + h);
|
||||
|
||||
RB_StreamEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Draw_TilePicOffset
|
||||
================
|
||||
*/
|
||||
void Draw_TilePicOffset(float x, float y, float w, float h, qhandle_t hShader, int offsetX, int offsetY) {
|
||||
shader_t* shader;
|
||||
float picw, pich;
|
||||
|
||||
R_SyncRenderThread();
|
||||
|
||||
if (hShader) {
|
||||
shader = R_GetShaderByHandle(hShader);
|
||||
}
|
||||
else {
|
||||
shader = tr.defaultShader;
|
||||
}
|
||||
|
||||
if (w <= 0) {
|
||||
w = shader->stages[0]->bundle[0].image[0]->width;
|
||||
h = shader->stages[0]->bundle[0].image[0]->height;
|
||||
}
|
||||
|
||||
picw = shader->stages[0]->bundle[0].image[0]->uploadWidth;
|
||||
pich = shader->stages[0]->bundle[0].image[0]->uploadHeight;
|
||||
|
||||
// draw the pic
|
||||
RB_Color4f(backEnd.color2D[0], backEnd.color2D[1], backEnd.color2D[2], backEnd.color2D[3]);
|
||||
|
||||
RB_StreamBegin(shader);
|
||||
|
||||
RB_Texcoord2f(x / picw, y / pich);
|
||||
RB_Vertex2f(x + offsetX, y + offsetY);
|
||||
|
||||
RB_Texcoord2f((x + w) / picw, y / pich);
|
||||
RB_Vertex2f(x + offsetX + w, y + offsetY);
|
||||
|
||||
RB_Texcoord2f(x / picw, (y + h) / pich);
|
||||
RB_Vertex2f(x + offsetX, y + offsetY + h);
|
||||
|
||||
RB_Texcoord2f((x + w) / picw, (y + h) / pich);
|
||||
RB_Vertex2f(x + offsetX + w, y + offsetY + h);
|
||||
|
||||
RB_StreamEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Draw_TrianglePic
|
||||
================
|
||||
*/
|
||||
void Draw_TrianglePic(const vec2_t vPoints[3], const vec2_t vTexCoords[3], qhandle_t hShader) {
|
||||
int i;
|
||||
shader_t* shader;
|
||||
|
||||
R_SyncRenderThread();
|
||||
|
||||
if (hShader) {
|
||||
shader = R_GetShaderByHandle(hShader);
|
||||
}
|
||||
else {
|
||||
shader = tr.defaultShader;
|
||||
}
|
||||
|
||||
// draw the pic
|
||||
RB_Color4f(backEnd.color2D[0], backEnd.color2D[1], backEnd.color2D[2], backEnd.color2D[3]);
|
||||
|
||||
RB_BeginSurface(shader, 0, 0);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
RB_Texcoord2f(vTexCoords[i][0], vTexCoords[i][1]);
|
||||
RB_Vertex2f(vPoints[i][0], vPoints[i][1]);
|
||||
}
|
||||
|
||||
RB_StreamEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
RE_DrawBackground_TexSubImage
|
||||
================
|
||||
*/
|
||||
void RE_DrawBackground_TexSubImage(int cols, int rows, int bgr, byte* data) {
|
||||
GLenum format;
|
||||
int w, h;
|
||||
vec4_t quadVerts[4];
|
||||
vec2_t texCoords[4];
|
||||
|
||||
w = glConfig.vidWidth;
|
||||
h = glConfig.vidHeight;
|
||||
|
||||
R_SyncRenderThread();
|
||||
qglFinish();
|
||||
|
||||
if (bgr) {
|
||||
format = GL_BGR_EXT;
|
||||
}
|
||||
else {
|
||||
format = GL_RGB;
|
||||
}
|
||||
|
||||
GL_BindToTMU(tr.scratchImage[0], TB_COLORMAP);
|
||||
|
||||
if (cols == tr.scratchImage[0]->width && rows == tr.scratchImage[0]->height && format == tr.scratchImage[0]->internalFormat)
|
||||
{
|
||||
qglTexSubImage2D(3553, 0, 0, 0, cols, rows, format, 5121, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
tr.scratchImage[0]->uploadWidth = cols;
|
||||
tr.scratchImage[0]->uploadHeight = rows;
|
||||
tr.scratchImage[0]->internalFormat = format;
|
||||
qglTexImage2D(GL_TEXTURE_2D, 0, 3, cols, rows, 0, format, 5121, data);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 9729.0);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 9729.0);
|
||||
}
|
||||
|
||||
qglDisable(GL_CULL_FACE);
|
||||
qglDisable(GL_DEPTH_TEST);
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
|
||||
VectorSet4(quadVerts[0], 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[1], w, 0.0f, 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[2], w, h, 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[3], 0.0f, h, 0.0f, 1.0f);
|
||||
|
||||
VectorSet2(texCoords[0], 0.5f / cols, (rows - 0.5f) / rows);
|
||||
VectorSet2(texCoords[1], (cols - 0.5f) / cols, (rows - 0.5f) / rows);
|
||||
VectorSet2(texCoords[2], (cols - 0.5f) / cols, 0.5f / rows);
|
||||
VectorSet2(texCoords[3], 0.5f / cols, 0.5f / rows);
|
||||
|
||||
GLSL_BindProgram(&tr.textureColorShader);
|
||||
|
||||
GLSL_SetUniformMat4(&tr.textureColorShader, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformVec4(&tr.textureColorShader, UNIFORM_COLOR, colorWhite);
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
RE_DrawBackground_DrawPixels
|
||||
================
|
||||
*/
|
||||
void RE_DrawBackground_DrawPixels(int cols, int rows, int bgr, byte* data) {
|
||||
// FIXME: stub
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
AddBox
|
||||
================
|
||||
*/
|
||||
void AddBox(float x, float y, float w, float h) {
|
||||
R_SyncRenderThread();
|
||||
|
||||
qglDisable(GL_TEXTURE_2D);
|
||||
GL_State(GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
|
||||
|
||||
{
|
||||
shaderProgram_t* sp = &tr.textureColorShader;
|
||||
vec4_t color = { backEnd.color2D[0] / 255.0f, backEnd.color2D[1] / 255.0f, backEnd.color2D[2] / 255.0f, backEnd.color2D[3] / 255.0f };
|
||||
vec4_t quadVerts[4];
|
||||
vec2_t texCoords[4];
|
||||
|
||||
VectorSet4(quadVerts[0], x, y, 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[1], x + w, y, 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[2], x + w, y + h, 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[3], x, y + h, 0.0f, 1.0f);
|
||||
|
||||
VectorSet2(texCoords[0], 0.0f, 0.0f);
|
||||
VectorSet2(texCoords[1], 1.0f, 0.0f);
|
||||
VectorSet2(texCoords[2], 1.0f, 1.0f);
|
||||
VectorSet2(texCoords[3], 0.0f, 1.0f);
|
||||
|
||||
GLSL_BindProgram(sp);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_COLOR, color);
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
}
|
||||
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
DrawBox
|
||||
================
|
||||
*/
|
||||
void DrawBox(float x, float y, float w, float h) {
|
||||
R_SyncRenderThread();
|
||||
|
||||
qglDisable(GL_TEXTURE_2D);
|
||||
GL_State(GLS_DEPTHTEST_DISABLE | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA | GLS_SRCBLEND_SRC_ALPHA);
|
||||
|
||||
{
|
||||
shaderProgram_t* sp = &tr.textureColorShader;
|
||||
vec4_t color = { backEnd.color2D[0] / 255.0f, backEnd.color2D[1] / 255.0f, backEnd.color2D[2] / 255.0f, backEnd.color2D[3] / 255.0f };
|
||||
vec4_t quadVerts[4];
|
||||
vec2_t texCoords[4];
|
||||
|
||||
VectorSet4(quadVerts[0], x, y, 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[1], x + w, y, 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[2], x + w, y + h, 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[3], x, y + h, 0.0f, 1.0f);
|
||||
|
||||
VectorSet2(texCoords[0], 0.0f, 0.0f);
|
||||
VectorSet2(texCoords[1], 1.0f, 0.0f);
|
||||
VectorSet2(texCoords[2], 1.0f, 1.0f);
|
||||
VectorSet2(texCoords[3], 0.0f, 1.0f);
|
||||
|
||||
GLSL_BindProgram(sp);
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_COLOR, color);
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
}
|
||||
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
DrawLineLoop
|
||||
================
|
||||
*/
|
||||
void DrawLineLoop(const vec2_t* points, int count, int stipple_factor, int stipple_mask) {
|
||||
int i;
|
||||
|
||||
R_SyncRenderThread();
|
||||
|
||||
qglDisable(GL_TEXTURE_2D);
|
||||
|
||||
if (stipple_factor) {
|
||||
qglEnable(GL_LINE_STIPPLE);
|
||||
glLineStipple(stipple_factor, stipple_mask);
|
||||
}
|
||||
|
||||
// FIXME: unimplemented
|
||||
/*
|
||||
qglBegin(GL_LINE_LOOP);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
qglVertex2f(points[i][0], points[i][1]);
|
||||
}
|
||||
|
||||
qglEnd();
|
||||
*/
|
||||
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
|
||||
if (stipple_factor) {
|
||||
qglDisable(GL_LINE_STIPPLE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Set2DWindow
|
||||
================
|
||||
*/
|
||||
void Set2DWindow(int x, int y, int w, int h, float left, float right, float bottom, float top, float n, float f) {
|
||||
mat4_t matrix;
|
||||
|
||||
R_SyncRenderThread();
|
||||
qglViewport(x, y, w, h);
|
||||
qglScissor(x, y, w, h);
|
||||
|
||||
Mat4Ortho(left, right, bottom, top, n, f, matrix);
|
||||
GL_SetProjectionMatrix(matrix);
|
||||
Mat4Identity(matrix);
|
||||
GL_SetModelviewMatrix(matrix);
|
||||
|
||||
GL_State(GLS_DEPTHTEST_DISABLE | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA | GLS_SRCBLEND_SRC_ALPHA);
|
||||
qglEnable(GL_BLEND);
|
||||
qglDisable(GL_CULL_FACE);
|
||||
qglDisable(GL_CLIP_PLANE0);
|
||||
|
||||
//if (r_reset_tc_array->integer) {
|
||||
// qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
//}
|
||||
|
||||
if (!backEnd.projection2D)
|
||||
{
|
||||
backEnd.refdef.time = ri.Milliseconds();
|
||||
backEnd.projection2D = qtrue;
|
||||
backEnd.refdef.floatTime = backEnd.refdef.time / 1000.0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
RE_Scissor
|
||||
================
|
||||
*/
|
||||
void RE_Scissor(int x, int y, int width, int height) {
|
||||
qglEnable(GL_SCISSOR_TEST);
|
||||
qglScissor(x, y, width, height);
|
||||
}
|
545
code/renderergl2/new/tr_font.cpp
Normal file
545
code/renderergl2/new/tr_font.cpp
Normal file
|
@ -0,0 +1,545 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
// tr_font.cpp -- font rendering
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
#define MAX_LOADED_FONTS 255
|
||||
|
||||
static fontheader_t s_loadedFonts[MAX_LOADED_FONTS];
|
||||
static int s_numLoadedFonts = 0;
|
||||
static float s_fontHeightScale = 1.0;
|
||||
static float s_fontGeneralScale = 1.0;
|
||||
static float s_fontZ = 0.0;
|
||||
|
||||
void R_SetFontHeightScale(float scale)
|
||||
{
|
||||
s_fontHeightScale = scale;
|
||||
}
|
||||
|
||||
void R_SetFontScale(float scale)
|
||||
{
|
||||
s_fontGeneralScale = scale;
|
||||
}
|
||||
|
||||
void R_SetFontZ(float zed)
|
||||
{
|
||||
s_fontZ = zed;
|
||||
}
|
||||
|
||||
fontheader_t* R_LoadFont(const char* name)
|
||||
{
|
||||
int i;
|
||||
char* theFile;
|
||||
fontheader_t* header;
|
||||
char* ref;
|
||||
const char* token;
|
||||
qboolean error;
|
||||
|
||||
error = qfalse;
|
||||
|
||||
for (i = 0; i < s_numLoadedFonts; i++)
|
||||
{
|
||||
header = &s_loadedFonts[i];
|
||||
if (!Q_stricmp(name, header->name)) {
|
||||
return header;
|
||||
}
|
||||
}
|
||||
|
||||
if (s_numLoadedFonts >= MAX_LOADED_FONTS)
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "LoadFont: Too many fonts loaded! Couldn't load %s\n", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
va("fonts/%s.RitualFont", name);
|
||||
if (ri.FS_ReadFile(va("fonts/%s.RitualFont", name), (void**)&theFile) == -1)
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "LoadFont: Couldn't load font %s\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
header = &s_loadedFonts[s_numLoadedFonts];
|
||||
header->height = 0.0;
|
||||
header->aspectRatio = 0.0;
|
||||
Q_strncpyz(header->name, name, sizeof(header->name));
|
||||
|
||||
ref = theFile;
|
||||
while (ref && !error)
|
||||
{
|
||||
token = COM_Parse(&ref);
|
||||
if (!Q_stricmp(token, "RitFont"))
|
||||
{
|
||||
// ignore this token
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Q_stricmp(token, "indirections"))
|
||||
{
|
||||
token = COM_Parse(&ref);
|
||||
if (Q_stricmp(token, "{"))
|
||||
{
|
||||
error = qtrue;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
token = COM_Parse(&ref);
|
||||
if (!token[0]) {
|
||||
error = qtrue;
|
||||
break;
|
||||
}
|
||||
|
||||
header->indirection[i] = atoi(token);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
break;
|
||||
}
|
||||
|
||||
token = COM_Parse(&ref);
|
||||
if (Q_stricmp(token, "}"))
|
||||
{
|
||||
error = qtrue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!Q_stricmp(token, "locations"))
|
||||
{
|
||||
token = COM_Parse(&ref);
|
||||
if (Q_stricmp(token, "{"))
|
||||
{
|
||||
error = qtrue;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
token = COM_Parse(&ref);
|
||||
if (Q_stricmp(token, "{")) {
|
||||
error = qtrue;
|
||||
break;
|
||||
}
|
||||
|
||||
if (header->aspectRatio == 0.0)
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "WARNING: aspect decl must be before locations in font '%s'", name);
|
||||
break;
|
||||
}
|
||||
|
||||
header->locations[i].pos[0] = atof(COM_Parse(&ref)) / 256.0;
|
||||
header->locations[i].pos[1] = atof(COM_Parse(&ref)) * header->aspectRatio / 256.0;
|
||||
header->locations[i].size[0] = atof(COM_Parse(&ref)) / 256.0;
|
||||
header->locations[i].size[1] = atof(COM_Parse(&ref)) * header->aspectRatio / 256.0;
|
||||
|
||||
token = COM_Parse(&ref);
|
||||
if (Q_stricmp(token, "}"))
|
||||
{
|
||||
error = qtrue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (error) {
|
||||
break;
|
||||
}
|
||||
|
||||
token = COM_Parse(&ref);
|
||||
if (Q_stricmp(token, "}"))
|
||||
{
|
||||
error = qtrue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!Q_stricmp(token, "height"))
|
||||
{
|
||||
// parse the header height
|
||||
token = COM_Parse(&ref);
|
||||
header->height = atof(token);
|
||||
}
|
||||
else if (!Q_stricmp(token, "aspect"))
|
||||
{
|
||||
// parse the aspect ratio
|
||||
token = COM_Parse(&ref);
|
||||
header->aspectRatio = atof(token);
|
||||
}
|
||||
else
|
||||
{
|
||||
// unknown token
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (token[0])
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "WARNING: Unknown token '%s' parsing font '%s'\n", token, name);
|
||||
error = qtrue;
|
||||
}
|
||||
|
||||
R_LoadFontShader(header);
|
||||
if (!header->height || !header->aspectRatio) {
|
||||
// invalid height or aspect ratio
|
||||
error = qtrue;
|
||||
}
|
||||
|
||||
ri.FS_FreeFile(theFile);
|
||||
if (error)
|
||||
{
|
||||
ri.Printf(3, "WARNING: Error parsing font %s.\n", name);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_numLoadedFonts++;
|
||||
return header;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void R_LoadFontShader(fontheader_t* font)
|
||||
{
|
||||
int i;
|
||||
int save;
|
||||
char filename[64];
|
||||
shader_t* fontshader;
|
||||
|
||||
save = r_sequencenumber;
|
||||
r_sequencenumber = -1;
|
||||
Com_sprintf(filename, sizeof(filename), "gfx/fonts/%s", font->name);
|
||||
font->shader = R_FindShader(filename, -1, qfalse);
|
||||
r_sequencenumber = save;
|
||||
|
||||
if (!font->shader) {
|
||||
ri.Error(ERR_DROP, "Could not load font shader for %s\n", filename);
|
||||
}
|
||||
|
||||
fontshader = (shader_t*)font->shader;
|
||||
if (fontshader->numUnfoggedPasses > 0)
|
||||
{
|
||||
for (i = 0; i < fontshader->numUnfoggedPasses; i++)
|
||||
{
|
||||
if (fontshader->stages[0] != NULL && fontshader->stages[0]->active)
|
||||
{
|
||||
fontshader->stages[0]->rgbGen = CGEN_GLOBAL_COLOR;
|
||||
fontshader->stages[0]->alphaGen = AGEN_GLOBAL_ALPHA;
|
||||
}
|
||||
}
|
||||
|
||||
font->trhandle = r_sequencenumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
font->trhandle = r_sequencenumber;
|
||||
}
|
||||
}
|
||||
|
||||
void R_DrawString(fontheader_t* font, const char* text, float x, float y, int maxlen, qboolean bVirtualScreen) {
|
||||
float charHeight;
|
||||
float startx, starty;
|
||||
int i;
|
||||
float fWidthScale, fHeightScale;
|
||||
|
||||
i = 0;
|
||||
startx = x;
|
||||
starty = y;
|
||||
fWidthScale = (double)glConfig.vidWidth / 640.0;
|
||||
fHeightScale = (double)glConfig.vidHeight / 480.0;
|
||||
|
||||
if (!font) {
|
||||
return;
|
||||
}
|
||||
|
||||
R_SyncRenderThread();
|
||||
|
||||
if (font->trhandle != r_sequencenumber) {
|
||||
font->shader = NULL;
|
||||
}
|
||||
|
||||
if (!font->shader) {
|
||||
R_LoadFontShader(font);
|
||||
}
|
||||
|
||||
charHeight = s_fontHeightScale * font->height * s_fontGeneralScale;
|
||||
RB_BeginSurface((shader_t*)font->shader, 0, 0);
|
||||
|
||||
for (i = 0; text[i]; i++) {
|
||||
unsigned char c;
|
||||
int indirected;
|
||||
letterloc_t* loc;
|
||||
|
||||
c = text[i];
|
||||
|
||||
if (maxlen != -1 && i >= maxlen) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\t':
|
||||
indirected = font->indirection[32];
|
||||
if (indirected == -1) {
|
||||
Com_DPrintf("R_DrawString: no space-character in font!\n");
|
||||
}
|
||||
else {
|
||||
x = s_fontGeneralScale * font->locations[indirected].size[0] * 256.0 * 3.0 + x;
|
||||
}
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
starty = charHeight + starty;
|
||||
x = startx;
|
||||
y = starty;
|
||||
break;
|
||||
|
||||
case '\r':
|
||||
x = startx;
|
||||
break;
|
||||
|
||||
default:
|
||||
indirected = font->indirection[c];
|
||||
if (indirected == -1)
|
||||
{
|
||||
Com_DPrintf("R_DrawString: no 0x%02x-character in font!\n", c);
|
||||
indirected = font->indirection['?'];
|
||||
if (indirected == -1) {
|
||||
Com_DPrintf("R_DrawString: no '?' character in font!\n");
|
||||
break;
|
||||
}
|
||||
// set the indirection for the next time
|
||||
font->indirection[c] = indirected;
|
||||
}
|
||||
|
||||
if (tess.numVertexes + 4 >= SHADER_MAX_VERTEXES || tess.numIndexes + 6 >= SHADER_MAX_INDEXES) {
|
||||
RB_CheckOverflow(4, 6);
|
||||
}
|
||||
|
||||
loc = &font->locations[indirected];
|
||||
|
||||
// texture coordinates
|
||||
tess.texCoords[tess.numVertexes][0] = loc->pos[0];
|
||||
tess.texCoords[tess.numVertexes][1] = loc->pos[1];
|
||||
tess.texCoords[tess.numVertexes + 1][0] = loc->size[0] + loc->pos[0];
|
||||
tess.texCoords[tess.numVertexes + 1][1] = loc->pos[1];
|
||||
tess.texCoords[tess.numVertexes + 2][0] = loc->pos[0];
|
||||
tess.texCoords[tess.numVertexes + 2][1] = loc->size[1] + loc->pos[1];
|
||||
tess.texCoords[tess.numVertexes + 3][0] = loc->size[0] + loc->pos[0];
|
||||
tess.texCoords[tess.numVertexes + 3][1] = loc->size[1] + loc->pos[1];
|
||||
|
||||
// vertices position
|
||||
tess.xyz[tess.numVertexes][0] = x;
|
||||
tess.xyz[tess.numVertexes][1] = y;
|
||||
tess.xyz[tess.numVertexes][2] = s_fontZ;
|
||||
tess.xyz[tess.numVertexes + 1][0] = x + s_fontGeneralScale * loc->size[0] * 256.0;
|
||||
tess.xyz[tess.numVertexes + 1][1] = y;
|
||||
tess.xyz[tess.numVertexes + 1][2] = s_fontZ;
|
||||
tess.xyz[tess.numVertexes + 2][0] = x;
|
||||
tess.xyz[tess.numVertexes + 2][1] = y + charHeight;
|
||||
tess.xyz[tess.numVertexes + 2][2] = s_fontZ;
|
||||
tess.xyz[tess.numVertexes + 3][0] = x + s_fontGeneralScale * loc->size[0] * 256.0;
|
||||
tess.xyz[tess.numVertexes + 3][1] = y + charHeight;
|
||||
tess.xyz[tess.numVertexes + 3][2] = s_fontZ;
|
||||
|
||||
// indices
|
||||
tess.indexes[tess.numIndexes] = tess.numVertexes;
|
||||
tess.indexes[tess.numIndexes + 1] = tess.numVertexes + 1;
|
||||
tess.indexes[tess.numIndexes + 2] = tess.numVertexes + 2;
|
||||
tess.indexes[tess.numIndexes + 3] = tess.numVertexes + 1;
|
||||
tess.indexes[tess.numIndexes + 4] = tess.numVertexes + 3;
|
||||
tess.indexes[tess.numIndexes + 5] = tess.numVertexes + 2;
|
||||
|
||||
if (bVirtualScreen)
|
||||
{
|
||||
// scale the string properly if virtual screen
|
||||
tess.xyz[tess.numVertexes][0] *= fWidthScale;
|
||||
tess.xyz[tess.numVertexes][1] *= fHeightScale;
|
||||
tess.xyz[tess.numVertexes + 1][0] *= fWidthScale;
|
||||
tess.xyz[tess.numVertexes + 1][1] *= fHeightScale;
|
||||
tess.xyz[tess.numVertexes + 2][0] *= fWidthScale;
|
||||
tess.xyz[tess.numVertexes + 2][1] *= fHeightScale;
|
||||
tess.xyz[tess.numVertexes + 3][0] *= fWidthScale;
|
||||
tess.xyz[tess.numVertexes + 3][1] *= fHeightScale;
|
||||
}
|
||||
|
||||
x += s_fontGeneralScale * loc->size[0] * 256.0;
|
||||
tess.numVertexes += 4;
|
||||
tess.numIndexes += 6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RB_EndSurface();
|
||||
}
|
||||
|
||||
void R_DrawFloatingString(fontheader_t* font, const char* text, const vec3_t org, const vec4_t color, float scale, int maxlen) {
|
||||
shader_t* fontshader;
|
||||
qhandle_t fsh;
|
||||
float charWidth, charHeight;
|
||||
int i;
|
||||
vec3_t pos;
|
||||
polyVert_t verts[4];
|
||||
|
||||
if (!font) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
R_SyncRenderThread();
|
||||
if (font->trhandle != r_sequencenumber) {
|
||||
font->shader = NULL;
|
||||
}
|
||||
|
||||
if (!font->shader) {
|
||||
R_LoadFontShader(font);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
fontshader = (shader_t*)font->shader;
|
||||
fsh = 0;
|
||||
|
||||
for (i = 0; i < tr.numShaders; i++)
|
||||
{
|
||||
if (fontshader == tr.shaders[i])
|
||||
{
|
||||
fsh = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
charHeight = font->height * s_fontHeightScale * s_fontGeneralScale * scale;
|
||||
VectorCopy(org, pos);
|
||||
|
||||
for (i = 0; text[i]; i++) {
|
||||
unsigned char c;
|
||||
int indirected;
|
||||
letterloc_t* loc;
|
||||
|
||||
c = text[i];
|
||||
indirected = font->indirection[c];
|
||||
if (indirected == -1)
|
||||
{
|
||||
Com_Printf("R_DrawFloatingString: no 0x%02x-character in font!\n", c);
|
||||
continue;
|
||||
}
|
||||
|
||||
loc = &font->locations[indirected];
|
||||
|
||||
// vertices color
|
||||
verts[0].modulate[0] = (int)(color[0] * 255.0);
|
||||
verts[0].modulate[1] = (int)(color[1] * 255.0);
|
||||
verts[0].modulate[2] = (int)(color[2] * 255.0);
|
||||
verts[0].modulate[3] = (int)(color[3] * 255.0);
|
||||
verts[1].modulate[0] = verts[0].modulate[0];
|
||||
verts[1].modulate[1] = verts[0].modulate[1];
|
||||
verts[1].modulate[2] = verts[0].modulate[2];
|
||||
verts[1].modulate[3] = verts[0].modulate[3];
|
||||
verts[2].modulate[0] = verts[0].modulate[0];
|
||||
verts[2].modulate[1] = verts[0].modulate[1];
|
||||
verts[2].modulate[2] = verts[0].modulate[2];
|
||||
verts[2].modulate[3] = verts[0].modulate[3];
|
||||
verts[3].modulate[0] = verts[0].modulate[0];
|
||||
verts[3].modulate[1] = verts[0].modulate[1];
|
||||
verts[3].modulate[2] = verts[0].modulate[2];
|
||||
verts[3].modulate[3] = verts[0].modulate[3];
|
||||
|
||||
// texture coordinates
|
||||
verts[0].st[0] = loc->pos[0];
|
||||
verts[0].st[1] = loc->pos[1];
|
||||
verts[1].st[0] = loc->pos[0] + font->locations[indirected].size[0];
|
||||
verts[1].st[1] = loc->pos[1];
|
||||
verts[2].st[0] = verts[1].st[0];
|
||||
verts[2].st[1] = loc->pos[1] + loc->size[1];
|
||||
verts[3].st[0] = loc->pos[0];
|
||||
verts[3].st[1] = verts[2].st[1];
|
||||
VectorCopy(pos, verts[3].xyz);
|
||||
|
||||
charWidth = font->locations[indirected].size[0] * 256.0 * s_fontGeneralScale * scale;
|
||||
verts[2].xyz[0] = pos[0] + tr.refdef.viewaxis[1][0] * -charWidth;
|
||||
verts[2].xyz[1] = pos[1] + tr.refdef.viewaxis[1][1] * -charWidth;
|
||||
verts[2].xyz[2] = pos[2] + tr.refdef.viewaxis[1][2] * -charWidth;
|
||||
verts[1].xyz[0] = verts[2].xyz[0] + charHeight * tr.refdef.viewaxis[2][0];
|
||||
verts[1].xyz[1] = verts[2].xyz[1] + charHeight * tr.refdef.viewaxis[2][1];
|
||||
verts[1].xyz[2] = verts[2].xyz[2] + charHeight * tr.refdef.viewaxis[2][2];
|
||||
verts[0].xyz[1] = verts[1].xyz[1] + tr.refdef.viewaxis[1][1] * charWidth;
|
||||
verts[0].xyz[2] = verts[1].xyz[2] + tr.refdef.viewaxis[1][2] * charWidth;
|
||||
verts[0].xyz[0] = verts[1].xyz[0] + tr.refdef.viewaxis[1][0] * charWidth;
|
||||
|
||||
RE_AddPolyToScene(fsh, 4, verts, 1);
|
||||
|
||||
pos[0] = verts[2].xyz[0];
|
||||
pos[1] = verts[2].xyz[1];
|
||||
pos[2] = verts[2].xyz[2];
|
||||
}
|
||||
}
|
||||
|
||||
float R_GetFontHeight(const fontheader_t* font)
|
||||
{
|
||||
if (!font) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return font->height * s_fontGeneralScale * s_fontHeightScale;
|
||||
}
|
||||
|
||||
float R_GetFontStringWidth(const fontheader_t* font, const char* s)
|
||||
{
|
||||
float widths;
|
||||
int i;
|
||||
|
||||
widths = 0.0;
|
||||
|
||||
if (!font) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
for (i = 0; s[i]; i++)
|
||||
{
|
||||
int indirected;
|
||||
char c = *s;
|
||||
|
||||
if (c == 9)
|
||||
{
|
||||
indirected = font->indirection[32];
|
||||
if (indirected != -1) {
|
||||
widths += font->locations[indirected].size[0] * 3.0;
|
||||
}
|
||||
else {
|
||||
Com_Printf("R_GetFontStringWidth: no space-character in font!\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
indirected = font->indirection[c];
|
||||
if (indirected != -1) {
|
||||
widths += font->locations[indirected].size[0];
|
||||
}
|
||||
else {
|
||||
Com_Printf("R_GetFontStringWidth: no 0x%02x-character in font!\n", c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return widths * s_fontGeneralScale * 256.0;
|
||||
}
|
174
code/renderergl2/new/tr_init.c
Normal file
174
code/renderergl2/new/tr_init.c
Normal file
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
cvar_t* r_reset_tc_array;
|
||||
cvar_t* r_numdebuglines;
|
||||
|
||||
|
||||
cvar_t* r_staticlod;
|
||||
cvar_t* r_lodscale;
|
||||
cvar_t* r_lodcap;
|
||||
cvar_t* r_lodviewmodelcap;
|
||||
|
||||
cvar_t* r_uselod;
|
||||
cvar_t* lod_LOD;
|
||||
cvar_t* lod_minLOD;
|
||||
cvar_t* lod_maxLOD;
|
||||
cvar_t* lod_LOD_slider;
|
||||
cvar_t* lod_curve_0_val;
|
||||
cvar_t* lod_curve_1_val;
|
||||
cvar_t* lod_curve_2_val;
|
||||
cvar_t* lod_curve_3_val;
|
||||
cvar_t* lod_curve_4_val;
|
||||
cvar_t* lod_edit_0;
|
||||
cvar_t* lod_edit_1;
|
||||
cvar_t* lod_edit_2;
|
||||
cvar_t* lod_edit_3;
|
||||
cvar_t* lod_edit_4;
|
||||
cvar_t* lod_curve_0_slider;
|
||||
cvar_t* lod_curve_1_slider;
|
||||
cvar_t* lod_curve_2_slider;
|
||||
cvar_t* lod_curve_3_slider;
|
||||
cvar_t* lod_curve_4_slider;
|
||||
cvar_t* lod_pitch_val;
|
||||
cvar_t* lod_zee_val;
|
||||
cvar_t* lod_mesh;
|
||||
cvar_t* lod_meshname;
|
||||
cvar_t* lod_tikiname;
|
||||
cvar_t* lod_metric;
|
||||
cvar_t* lod_tris;
|
||||
cvar_t* lod_position;
|
||||
cvar_t* lod_save;
|
||||
cvar_t* lod_tool;
|
||||
|
||||
cvar_t* r_showSkeleton;
|
||||
|
||||
int r_sequencenumber;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
/*
|
||||
** RE_BeginRegistration
|
||||
*/
|
||||
void RE_BeginRegistration(glconfig_t* glconfigOut) {
|
||||
int i;
|
||||
|
||||
R_Init();
|
||||
|
||||
*glconfigOut = glConfig;
|
||||
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
tr.visIndex = 0;
|
||||
// force markleafs to regenerate
|
||||
for (i = 0; i < MAX_VISCOUNTS; i++) {
|
||||
tr.visClusters[i] = -2;
|
||||
}
|
||||
|
||||
R_ClearFlares();
|
||||
RE_ClearScene();
|
||||
|
||||
tr.registered = qtrue;
|
||||
}
|
||||
|
||||
const char* RE_GetGraphicsInfo() {
|
||||
// FIXME: unimplemented
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qboolean R_SetMode(int mode, const glconfig_t* glConfig) {
|
||||
// FIXME: unimplemented
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
void R_SetFullscreen(qboolean fullscreen) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RE_SetRenderTime(int t) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void GetRefAPI_new(refimport_t* ri, refexport_t* re)
|
||||
{
|
||||
re->newre.FreeModels = RE_FreeModels;
|
||||
re->newre.SpawnEffectModel = RE_SpawnEffectModel;
|
||||
re->newre.RegisterServerModel = RE_RegisterServerModel;
|
||||
re->newre.UnregisterServerModel = RE_UnregisterServerModel;
|
||||
re->newre.RefreshShaderNoMip = RE_RefreshShaderNoMip;
|
||||
re->newre.PrintBSPFileSizes = RE_PrintBSPFileSizes;
|
||||
re->newre.MapVersion = RE_MapVersion;
|
||||
re->newre.LoadFont = R_LoadFont;
|
||||
|
||||
re->newre.BeginFrame = RE_BeginFrame;
|
||||
|
||||
re->newre.MarkFragments = R_MarkFragments_New;
|
||||
re->newre.MarkFragmentsForInlineModel = R_MarkFragmentsForInlineModel;
|
||||
re->newre.GetInlineModelBounds = R_GetInlineModelBounds;
|
||||
re->newre.GetLightingForDecal = R_GetLightingForDecal;
|
||||
re->newre.GetLightingForSmoke = R_GetLightingForSmoke;
|
||||
re->newre.R_GatherLightSources = R_GatherLightSources;
|
||||
re->newre.ModelBounds = R_ModelBounds;
|
||||
re->newre.ModelRadius = R_ModelRadius;
|
||||
|
||||
re->newre.AddRefEntityToScene = RE_AddRefEntityToScene;
|
||||
re->newre.AddRefSpriteToScene = RE_AddRefSpriteToScene;
|
||||
re->newre.AddPolyToScene = RE_AddPolyToScene;
|
||||
re->newre.AddTerrainMarkToScene = RE_AddTerrainMarkToScene;
|
||||
re->newre.AddLightToScene = RE_AddLightToScene;
|
||||
re->newre.RenderScene = RE_RenderScene;
|
||||
re->newre.GetRenderEntity = RE_GetRenderEntity;
|
||||
|
||||
re->newre.SavePerformanceCounters = R_SavePerformanceCounters;
|
||||
|
||||
re->newre.R_Model_GetHandle = R_Model_GetHandle;
|
||||
re->newre.DrawStretchRaw = RE_StretchRaw;
|
||||
re->newre.DebugLine = R_DebugLine;
|
||||
re->newre.DrawTilePic = Draw_TilePic;
|
||||
re->newre.DrawTilePicOffset = Draw_TilePicOffset;
|
||||
re->newre.DrawTrianglePic = Draw_TrianglePic;
|
||||
re->newre.DrawBox = DrawBox;
|
||||
re->newre.AddBox = AddBox;
|
||||
re->newre.Set2DWindow = Set2DWindow;
|
||||
re->newre.Scissor = RE_Scissor;
|
||||
re->newre.DrawLineLoop = DrawLineLoop;
|
||||
re->newre.DrawString = R_DrawString;
|
||||
re->newre.GetFontHeight = R_GetFontHeight;
|
||||
re->newre.GetFontStringWidth = R_GetFontStringWidth;
|
||||
re->newre.SwipeBegin = RE_SwipeBegin;
|
||||
re->newre.SwipeEnd = RE_SwipeEnd;
|
||||
re->newre.SetRenderTime = RE_SetRenderTime;
|
||||
re->newre.Noise = R_NoiseGet4f;
|
||||
|
||||
re->newre.SetMode = R_SetMode;
|
||||
re->newre.SetFullscreen = R_SetFullscreen;
|
||||
|
||||
re->newre.GetShaderHeight = RE_GetShaderHeight;
|
||||
re->newre.GetShaderWidth = RE_GetShaderWidth;
|
||||
re->newre.GetGraphicsInfo = RE_GetGraphicsInfo;
|
||||
re->newre.ForceUpdatePose = RE_ForceUpdatePose;
|
||||
re->newre.TIKI_Orientation = RE_TIKI_Orientation;
|
||||
re->newre.TIKI_IsOnGround = RE_TIKI_IsOnGround;
|
||||
re->newre.SetFrameNumber = RE_SetFrameNumber;
|
||||
}
|
33
code/renderergl2/new/tr_light.c
Normal file
33
code/renderergl2/new/tr_light.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
void R_GetLightingForDecal(vec3_t vLight, vec3_t vFacing, vec3_t vOrigin)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void R_GetLightingForSmoke(vec3_t vLight, vec3_t vOrigin)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
447
code/renderergl2/new/tr_local.h
Normal file
447
code/renderergl2/new/tr_local.h
Normal file
|
@ -0,0 +1,447 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
extern int r_sequencenumber;
|
||||
|
||||
void GetRefAPI_new(refimport_t* ri, refexport_t* re);
|
||||
|
||||
extern cvar_t* r_reset_tc_array;
|
||||
extern cvar_t* r_numdebuglines;
|
||||
|
||||
extern cvar_t* r_staticlod;
|
||||
extern cvar_t* r_lodscale;
|
||||
extern cvar_t* r_lodcap;
|
||||
extern cvar_t* r_lodviewmodelcap;
|
||||
|
||||
extern cvar_t* r_uselod;
|
||||
extern cvar_t* lod_LOD;
|
||||
extern cvar_t* lod_minLOD;
|
||||
extern cvar_t* lod_maxLOD;
|
||||
extern cvar_t* lod_LOD_slider;
|
||||
extern cvar_t* lod_curve_0_val;
|
||||
extern cvar_t* lod_curve_1_val;
|
||||
extern cvar_t* lod_curve_2_val;
|
||||
extern cvar_t* lod_curve_3_val;
|
||||
extern cvar_t* lod_curve_4_val;
|
||||
extern cvar_t* lod_edit_0;
|
||||
extern cvar_t* lod_edit_1;
|
||||
extern cvar_t* lod_edit_2;
|
||||
extern cvar_t* lod_edit_3;
|
||||
extern cvar_t* lod_edit_4;
|
||||
extern cvar_t* lod_curve_0_slider;
|
||||
extern cvar_t* lod_curve_1_slider;
|
||||
extern cvar_t* lod_curve_2_slider;
|
||||
extern cvar_t* lod_curve_3_slider;
|
||||
extern cvar_t* lod_curve_4_slider;
|
||||
extern cvar_t* lod_pitch_val;
|
||||
extern cvar_t* lod_zee_val;
|
||||
extern cvar_t* lod_mesh;
|
||||
extern cvar_t* lod_meshname;
|
||||
extern cvar_t* lod_tikiname;
|
||||
extern cvar_t* lod_metric;
|
||||
extern cvar_t* lod_tris;
|
||||
extern cvar_t* lod_position;
|
||||
extern cvar_t* lod_save;
|
||||
extern cvar_t* lod_tool;
|
||||
extern cvar_t* r_showSkeleton;
|
||||
|
||||
typedef union varnodeUnpacked_u {
|
||||
float fVariance;
|
||||
struct {
|
||||
byte flags;
|
||||
unsigned char unused[3];
|
||||
} s;
|
||||
} varnodeUnpacked_t;
|
||||
|
||||
typedef unsigned short terraInt;
|
||||
|
||||
typedef struct terrainVert_s {
|
||||
vec3_t xyz;
|
||||
vec2_t texCoords[2];
|
||||
float fVariance;
|
||||
float fHgtAvg;
|
||||
float fHgtAdd;
|
||||
unsigned int uiDistRecalc;
|
||||
terraInt nRef;
|
||||
terraInt iVertArray;
|
||||
byte* pHgt;
|
||||
terraInt iNext;
|
||||
terraInt iPrev;
|
||||
} terrainVert_t;
|
||||
|
||||
typedef struct terraTri_s {
|
||||
unsigned short iPt[3];
|
||||
terraInt nSplit;
|
||||
unsigned int uiDistRecalc;
|
||||
struct cTerraPatchUnpacked_s* patch;
|
||||
varnodeUnpacked_t* varnode;
|
||||
terraInt index;
|
||||
byte lod;
|
||||
byte byConstChecks;
|
||||
terraInt iLeft;
|
||||
terraInt iRight;
|
||||
terraInt iBase;
|
||||
terraInt iLeftChild;
|
||||
terraInt iRightChild;
|
||||
terraInt iParent;
|
||||
terraInt iPrev;
|
||||
terraInt iNext;
|
||||
} terraTri_t;
|
||||
|
||||
typedef struct srfTerrain_s {
|
||||
surfaceType_t surfaceType;
|
||||
terraInt iVertHead;
|
||||
terraInt iTriHead;
|
||||
terraInt iTriTail;
|
||||
terraInt iMergeHead;
|
||||
int nVerts;
|
||||
int nTris;
|
||||
int lmapSize;
|
||||
int dlightBits[2];
|
||||
float lmapStep;
|
||||
int dlightMap[2];
|
||||
byte* lmData;
|
||||
float lmapX;
|
||||
float lmapY;
|
||||
} srfTerrain_t;
|
||||
|
||||
typedef struct cTerraPatchUnpacked_s {
|
||||
srfTerrain_t drawinfo;
|
||||
int viewCount;
|
||||
int visCountCheck;
|
||||
int visCountDraw;
|
||||
int frameCount;
|
||||
unsigned int uiDistRecalc;
|
||||
float s;
|
||||
float t;
|
||||
vec2_t texCoord[2][2];
|
||||
float x0;
|
||||
float y0;
|
||||
float z0;
|
||||
float zmax;
|
||||
shader_t* shader;
|
||||
short int iNorth;
|
||||
short int iEast;
|
||||
short int iSouth;
|
||||
short int iWest;
|
||||
struct cTerraPatchUnpacked_s* pNextActive;
|
||||
varnodeUnpacked_t varTree[2][63];
|
||||
unsigned char heightmap[81];
|
||||
byte flags;
|
||||
byte byDirty;
|
||||
} cTerraPatchUnpacked_t;
|
||||
|
||||
typedef struct srfStaticModel_s {
|
||||
surfaceType_t surfaceType;
|
||||
struct cStaticModelUnpacked_s* parent;
|
||||
} srfStaticModel_t;
|
||||
|
||||
typedef struct cStaticModelUnpacked_s {
|
||||
qboolean useSpecialLighting;
|
||||
qboolean bLightGridCalculated;
|
||||
qboolean bRendered;
|
||||
char model[128];
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
vec3_t axis[3];
|
||||
float scale;
|
||||
int firstVertexData;
|
||||
int numVertexData;
|
||||
int visCount;
|
||||
dtiki_t* tiki;
|
||||
sphere_dlight_t dlights[32];
|
||||
int numdlights;
|
||||
float radius;
|
||||
float cull_radius;
|
||||
int iGridLighting;
|
||||
float lodpercentage[2];
|
||||
} cStaticModelUnpacked_t;
|
||||
|
||||
typedef struct refSprite_s {
|
||||
surfaceType_t surftype;
|
||||
int hModel;
|
||||
int shaderNum;
|
||||
float origin[3];
|
||||
float scale;
|
||||
float axis[3][3];
|
||||
unsigned char shaderRGBA[4];
|
||||
int renderfx;
|
||||
float shaderTime;
|
||||
} refSprite_t;
|
||||
|
||||
//
|
||||
// tr_shader.c
|
||||
//
|
||||
qhandle_t RE_RefreshShaderNoMip(const char* name);
|
||||
|
||||
//
|
||||
// tr_bsp.c
|
||||
//
|
||||
void RE_PrintBSPFileSizes(void);
|
||||
int RE_MapVersion(void);
|
||||
|
||||
typedef struct skelSurfaceGame_s skelSurfaceGame_t;
|
||||
typedef struct staticSurface_s staticSurface_t;
|
||||
|
||||
/*
|
||||
============================================================
|
||||
|
||||
DRAWING
|
||||
|
||||
============================================================
|
||||
*/
|
||||
void Draw_TilePic(float x, float y, float w, float h, qhandle_t hShader);
|
||||
void Draw_TilePicOffset(float x, float y, float w, float h, qhandle_t hShader, int offsetX, int offsetY);
|
||||
void Draw_TrianglePic(const vec2_t vPoints[3], const vec2_t vTexCoords[3], qhandle_t hShader);
|
||||
void DrawBox(float x, float y, float w, float h);
|
||||
void AddBox(float x, float y, float w, float h);
|
||||
void Set2DWindow(int x, int y, int w, int h, float left, float right, float bottom, float top, float n, float f);
|
||||
void RE_Scissor(int x, int y, int width, int height);
|
||||
void DrawLineLoop(const vec2_t* points, int count, int stipple_factor, int stipple_mask);
|
||||
|
||||
/*
|
||||
============================================================
|
||||
|
||||
FLARES
|
||||
|
||||
============================================================
|
||||
*/
|
||||
|
||||
void R_ClearFlares(void);
|
||||
|
||||
void RB_AddFlare(void* surface, int fogNum, vec3_t point, vec3_t color, vec3_t normal);
|
||||
void RB_AddDlightFlares(void);
|
||||
void RB_RenderFlares(void);
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
FONT
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
fontheader_t* R_LoadFont(const char* name);
|
||||
void R_LoadFontShader(fontheader_t* font);
|
||||
void R_DrawString(fontheader_t* font, const char* text, float x, float y, int maxlen, qboolean bVirtualScreen);
|
||||
float R_GetFontHeight(const fontheader_t* font);
|
||||
float R_GetFontStringWidth(const fontheader_t* font, const char* s);
|
||||
|
||||
/*
|
||||
============================================================
|
||||
|
||||
LIGHTS
|
||||
|
||||
============================================================
|
||||
*/
|
||||
|
||||
void R_DlightBmodel(bmodel_t* bmodel);
|
||||
void R_GetLightingGridValue(const vec3_t vPos, vec3_t vLight);
|
||||
void R_GetLightingForDecal(vec3_t vLight, vec3_t vFacing, vec3_t vOrigin);
|
||||
void R_GetLightingForSmoke(vec3_t vLight, vec3_t vOrigin);
|
||||
void R_SetupEntityLighting(const trRefdef_t* refdef, trRefEntity_t* ent);
|
||||
void RB_SetupEntityGridLighting();
|
||||
void RB_SetupStaticModelGridLighting(trRefdef_t* refdef, cStaticModelUnpacked_t* ent, const vec3_t lightOrigin);
|
||||
void R_TransformDlights(int count, dlight_t* dl, orientationr_t* ori);
|
||||
void RB_Light_Real(unsigned char* colors);
|
||||
void RB_Sphere_BuildDLights();
|
||||
void RB_Sphere_SetupEntity();
|
||||
void RB_Grid_SetupEntity();
|
||||
void RB_Grid_SetupStaticModel();
|
||||
void RB_Light_Fullbright(unsigned char* colors);
|
||||
void R_Sphere_InitLights();
|
||||
int R_GatherLightSources(const vec3_t vPos, vec3_t* pvLightPos, vec3_t* pvLightIntensity, int iMaxLights);
|
||||
void R_UploadDlights();
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
MARKS
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
void R_LevelMarksLoad(const char* szBSPName);
|
||||
void R_LevelMarksInit();
|
||||
void R_LevelMarksFree();
|
||||
void R_UpdateLevelMarksSystem();
|
||||
void R_AddPermanentMarkFragmentSurfaces(void** pFirstMarkFragment, int iNumMarkFragment);
|
||||
|
||||
int R_MarkFragments_New(int numPoints, const vec3_t* points, const vec3_t projection,
|
||||
int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t* fragmentBuffer, float fRadiusSquared);
|
||||
|
||||
int R_MarkFragmentsForInlineModel(clipHandle_t bmodel, const vec3_t angles, const vec3_t origin, int numPoints,
|
||||
const vec3_t* points, const vec3_t projection, int maxPoints, vec3_t pointBuffer,
|
||||
int maxFragments, markFragment_t* fragmentBuffer, float radiusSquared);
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
SKY PORTALS
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
void R_Sky_Init();
|
||||
void R_Sky_Reset();
|
||||
void R_Sky_AddSurf(msurface_t* surf);
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
SPRITE
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
sprite_t* SPR_RegisterSprite(const char* name);
|
||||
void RB_DrawSprite(const refSprite_t* spr);
|
||||
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
SUN FLARE
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
void R_InitLensFlare();
|
||||
void R_DrawLensFlares();
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
SWIPE
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
void RB_DrawSwipeSurface(surfaceType_t* pswipe);
|
||||
void RE_SwipeBegin(float thistime, float life, qhandle_t shader);
|
||||
void RE_SwipeEnd();
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
TERRAIN
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
void R_MarkTerrainPatch(cTerraPatchUnpacked_t* pPatch);
|
||||
void R_AddTerrainSurfaces();
|
||||
void R_InitTerrain();
|
||||
void R_TerrainPrepareFrame();
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
SCENE GENERATION
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
void RE_AddRefSpriteToScene(const refEntity_t* ent);
|
||||
void RE_AddTerrainMarkToScene(int iTerrainIndex, qhandle_t hShader, int numVerts, const polyVert_t* verts, int renderfx);
|
||||
refEntity_t* RE_GetRenderEntity(int entityNumber);
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
TIKI
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
void R_InitStaticModels(void);
|
||||
void RE_FreeModels(void);
|
||||
qhandle_t RE_SpawnEffectModel(const char* szModel, vec3_t vPos, vec3_t* axis);
|
||||
qhandle_t RE_RegisterServerModel(const char* name);
|
||||
void RE_UnregisterServerModel(qhandle_t hModel);
|
||||
orientation_t RE_TIKI_Orientation(refEntity_t* model, int tagnum);
|
||||
qboolean RE_TIKI_IsOnGround(refEntity_t* model, int tagnum, float threshold);
|
||||
float R_ModelRadius(qhandle_t handle);
|
||||
void R_ModelBounds(qhandle_t handle, vec3_t mins, vec3_t maxs);
|
||||
dtiki_t* R_Model_GetHandle(qhandle_t handle);
|
||||
|
||||
float R_GetRadius(refEntity_t* model);
|
||||
void R_GetFrame(refEntity_t* model, struct skelAnimFrame_s* newFrame);
|
||||
void RE_ForceUpdatePose(refEntity_t* model);
|
||||
void RE_SetFrameNumber(int frameNumber);
|
||||
void R_UpdatePoseInternal(refEntity_t* model);
|
||||
void RB_SkelMesh(skelSurfaceGame_t* sf);
|
||||
void RB_StaticMesh(staticSurface_t* staticSurf);
|
||||
void RB_Static_BuildDLights();
|
||||
void R_PrintInfoStaticModels();
|
||||
void R_AddSkelSurfaces(trRefEntity_t* ent);
|
||||
void R_AddStaticModelSurfaces(void);
|
||||
float R_CalcLod(const vec3_t origin, float radius);
|
||||
int R_LerpTag(orientation_t* tag, qhandle_t handle, int startFrame, int endFrame,
|
||||
float frac, const char* tagName);
|
||||
void R_PrintInfoWorldtris(void);
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
UTIL
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
int RE_GetShaderHeight(qhandle_t hShader);
|
||||
int RE_GetShaderWidth(qhandle_t hShader);
|
||||
void RB_StreamBegin(shader_t* shader);
|
||||
void RB_StreamEnd(void);
|
||||
void RB_StreamBeginDrawSurf(void);
|
||||
void RB_StreamEndDrawSurf(void);
|
||||
static void addTriangle(void);
|
||||
void RB_Vertex3fv(vec3_t v);
|
||||
void RB_Vertex3f(vec_t x, vec_t y, vec_t z);
|
||||
void RB_Vertex2f(vec_t x, vec_t y);
|
||||
void RB_Color4f(vec_t r, vec_t g, vec_t b, vec_t a);
|
||||
void RB_Color3f(vec_t r, vec_t g, vec_t b);
|
||||
void RB_Color3fv(vec3_t col);
|
||||
void RB_Color4bv(unsigned char* colors);
|
||||
void RB_Texcoord2f(float s, float t);
|
||||
void RB_Texcoord2fv(vec2_t st);
|
||||
void R_DrawDebugNumber(const vec3_t org, float number, float scale, float r, float g, float b, int precision);
|
||||
void R_DebugRotatedBBox(const vec3_t org, vec3_t ang, vec3_t mins, vec3_t maxs, float r, float g, float b, float alpha);
|
||||
const char* RE_GetGraphicsInfo();
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
WORLD MAP
|
||||
|
||||
=============================================================
|
||||
*/
|
||||
void R_GetInlineModelBounds(int iIndex, vec3_t vMins, vec3_t vMaxs);
|
||||
|
||||
extern int g_nStaticSurfaces;
|
||||
extern qboolean g_bInfostaticmodels;
|
||||
extern qboolean g_bInfoworldtris;
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
void R_DebugCircle(const vec3_t org, float radius, float r, float g, float b, float alpha, qboolean horizontal);
|
||||
void R_DebugLine(const vec3_t start, const vec3_t end, float r, float g, float b, float alpha);
|
||||
|
||||
void RE_SetRenderTime(int t);
|
||||
qboolean R_SetMode(int mode, const glconfig_t* glConfig);
|
||||
void R_SetFullscreen(qboolean fullscreen);
|
||||
void R_SavePerformanceCounters(void);
|
||||
void R_SyncRenderThread(void);
|
107
code/renderergl2/new/tr_local_begin.h
Normal file
107
code/renderergl2/new/tr_local_begin.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef struct suninfo_s {
|
||||
vec3_t color;
|
||||
vec3_t direction;
|
||||
vec3_t flaredirection;
|
||||
char szFlareName[64];
|
||||
qboolean exists;
|
||||
} suninfo_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t transformed;
|
||||
int index;
|
||||
} sphere_dlight_t;
|
||||
|
||||
typedef enum {
|
||||
LIGHT_POINT,
|
||||
LIGHT_DIRECTIONAL,
|
||||
LIGHT_SPOT,
|
||||
LIGHT_SPOT_FAST
|
||||
} lighttype_t;
|
||||
|
||||
typedef struct reallightinfo_s {
|
||||
vec3_t color;
|
||||
lighttype_t eType;
|
||||
float fIntensity;
|
||||
float fDist;
|
||||
float fSpotSlope;
|
||||
float fSpotConst;
|
||||
float fSpotScale;
|
||||
vec3_t vOrigin;
|
||||
vec3_t vDirection;
|
||||
} reallightinfo_t;
|
||||
|
||||
typedef float cube_entry_t[3][4];
|
||||
|
||||
typedef struct {
|
||||
vec3_t origin;
|
||||
vec3_t worldOrigin;
|
||||
vec3_t traceOrigin;
|
||||
float radius;
|
||||
struct mnode_s* leaves[8];
|
||||
void(*TessFunction) (unsigned char* dstColors);
|
||||
union {
|
||||
unsigned char level[4];
|
||||
int value;
|
||||
} ambient;
|
||||
int numRealLights;
|
||||
reallightinfo_t light[32];
|
||||
int bUsesCubeMap;
|
||||
float cubemap[24][3][4];
|
||||
} sphereor_t;
|
||||
|
||||
typedef struct spherel_s {
|
||||
vec3_t origin;
|
||||
vec3_t color;
|
||||
float intensity;
|
||||
struct mnode_s* leaf;
|
||||
int needs_trace;
|
||||
int spot_light;
|
||||
float spot_radiusbydistance;
|
||||
vec3_t spot_dir;
|
||||
int reference_count;
|
||||
} spherel_t;
|
||||
|
||||
typedef enum {
|
||||
SPRITE_PARALLEL,
|
||||
SPRITE_PARALLEL_ORIENTED,
|
||||
SPRITE_ORIENTED,
|
||||
SPRITE_PARALLEL_UPRIGHT
|
||||
} spriteType_t;
|
||||
|
||||
typedef struct {
|
||||
spriteType_t type;
|
||||
float scale;
|
||||
} spriteParms_t;
|
||||
|
||||
typedef struct {
|
||||
float width;
|
||||
float height;
|
||||
float origin_x;
|
||||
float origin_y;
|
||||
float scale;
|
||||
struct shader_s* shader;
|
||||
} sprite_t;
|
122
code/renderergl2/new/tr_main.c
Normal file
122
code/renderergl2/new/tr_main.c
Normal file
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
#define CIRCLE_LENGTH 25
|
||||
|
||||
/*
|
||||
================
|
||||
R_DebugCircle
|
||||
================
|
||||
*/
|
||||
void R_DebugCircle(const vec3_t org, float radius, float r, float g, float b, float alpha, qboolean horizontal) {
|
||||
int i;
|
||||
float ang;
|
||||
debugline_t* line;
|
||||
vec3_t forward, right;
|
||||
vec3_t pos, lastpos;
|
||||
|
||||
if (!ri.newri.DebugLines || !ri.newri.numDebugLines) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (horizontal)
|
||||
{
|
||||
VectorSet(forward, 1, 0, 0);
|
||||
VectorSet(right, 0, 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorCopy(tr.refdef.viewaxis[1], right);
|
||||
VectorCopy(tr.refdef.viewaxis[2], forward);
|
||||
}
|
||||
|
||||
VectorClear(pos);
|
||||
VectorClear(lastpos);
|
||||
|
||||
for (i = 0; i < CIRCLE_LENGTH; i++) {
|
||||
VectorCopy(pos, lastpos);
|
||||
|
||||
ang = (float)i * 0.0174532925199433f;
|
||||
pos[0] = (org[0] + sin(ang) * radius * forward[0]) +
|
||||
cos(ang) * radius * right[0];
|
||||
pos[1] = (org[1] + sin(ang) * radius * forward[1]) +
|
||||
cos(ang) * radius * right[1];
|
||||
pos[2] = (org[2] + sin(ang) * radius * forward[2]) +
|
||||
cos(ang) * radius * right[2];
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
if (*ri.newri.numDebugLines >= r_numdebuglines->integer) {
|
||||
ri.Printf(PRINT_ALL, "R_DebugCircle: Exceeded MAX_DEBUG_LINES\n");
|
||||
return;
|
||||
}
|
||||
|
||||
line = &(*ri.newri.DebugLines)[*ri.newri.numDebugLines];
|
||||
(*ri.newri.numDebugLines)++;
|
||||
VectorCopy(lastpos, line->start);
|
||||
VectorCopy(pos, line->end);
|
||||
VectorSet(line->color, r, g, b);
|
||||
line->alpha = alpha;
|
||||
line->width = 1.0;
|
||||
line->factor = 1;
|
||||
line->pattern = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_DebugLine
|
||||
================
|
||||
*/
|
||||
void R_DebugLine(const vec3_t start, const vec3_t end, float r, float g, float b, float alpha) {
|
||||
debugline_t* line;
|
||||
|
||||
if (!ri.newri.DebugLines || !ri.newri.numDebugLines) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ri.newri.numDebugLines >= r_numdebuglines->integer) {
|
||||
ri.Printf(PRINT_ALL, "R_DebugLine: Exceeded MAX_DEBUG_LINES\n");
|
||||
}
|
||||
|
||||
line = &(*ri.newri.DebugLines)[*ri.newri.numDebugLines];
|
||||
(*ri.newri.numDebugLines)++;
|
||||
VectorCopy(start, line->start);
|
||||
VectorCopy(end, line->end);
|
||||
VectorSet(line->color, r, g, b);
|
||||
line->alpha = alpha;
|
||||
line->width = 1.0;
|
||||
line->factor = 1;
|
||||
line->pattern = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_DrawDebugLines
|
||||
================
|
||||
*/
|
||||
void R_DrawDebugLines(void) {
|
||||
// FIXME: stub
|
||||
}
|
35
code/renderergl2/new/tr_marks.c
Normal file
35
code/renderergl2/new/tr_marks.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../tr_local.h"
|
||||
int R_MarkFragments_New(int numPoints, const vec3_t* points, const vec3_t projection,
|
||||
int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t* fragmentBuffer, float fRadiusSquared) {
|
||||
return R_MarkFragments(numPoints, points, projection, maxPoints, pointBuffer, maxFragments, fragmentBuffer);
|
||||
}
|
||||
|
||||
int R_MarkFragmentsForInlineModel(clipHandle_t bmodel, const vec3_t angles, const vec3_t origin, int numPoints,
|
||||
const vec3_t* points, const vec3_t projection, int maxPoints, vec3_t pointBuffer,
|
||||
int maxFragments, markFragment_t* fragmentBuffer, float radiusSquared)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return 0;
|
||||
}
|
1463
code/renderergl2/new/tr_model.cpp
Normal file
1463
code/renderergl2/new/tr_model.cpp
Normal file
File diff suppressed because it is too large
Load diff
77
code/renderergl2/new/tr_scene.c
Normal file
77
code/renderergl2/new/tr_scene.c
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
extern int r_firstSceneDrawSurf;
|
||||
|
||||
extern int r_numdlights;
|
||||
extern int r_firstSceneDlight;
|
||||
|
||||
extern int r_numentities;
|
||||
extern int r_firstSceneEntity;
|
||||
|
||||
extern int r_numpolys;
|
||||
extern int r_firstScenePoly;
|
||||
|
||||
extern int r_numpolyverts;
|
||||
|
||||
void RE_AddRefSpriteToScene(const refEntity_t* ent) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
R_AddTerrainMarkSurfaces
|
||||
=====================
|
||||
*/
|
||||
void R_AddTerrainMarkSurfaces(void) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
RE_AddTerrainMarkToScene
|
||||
=====================
|
||||
*/
|
||||
void RE_AddTerrainMarkToScene(int iTerrainIndex, qhandle_t hShader, int numVerts, const polyVert_t* verts, int renderfx) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
||||
/*
|
||||
=====================
|
||||
RE_GetRenderEntity
|
||||
=====================
|
||||
*/
|
||||
refEntity_t* RE_GetRenderEntity(int entityNumber) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < r_numentities; i++) {
|
||||
if (backEndData->entities[i].e.entityNumber == entityNumber) {
|
||||
return &backEndData->entities[i].e;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
29
code/renderergl2/new/tr_shader.c
Normal file
29
code/renderergl2/new/tr_shader.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
qhandle_t RE_RefreshShaderNoMip(const char* name) {
|
||||
// FIXME: unimplemented
|
||||
// Workaround
|
||||
return RE_RegisterShaderNoMip(name);
|
||||
}
|
129
code/renderergl2/new/tr_sphere_shade.cpp
Normal file
129
code/renderergl2/new/tr_sphere_shade.cpp
Normal file
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
// tr_sphere_shade.cpp -- sphere shade
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
vec3_t spheredef[6];
|
||||
suninfo_t s_sun;
|
||||
static vec3_t ambientlight;
|
||||
static qboolean bEntityOverbright;
|
||||
static int iEntityLightingMax;
|
||||
static int light_reference_count = 0;
|
||||
|
||||
int compare_light_intensities(const void* p1, const void* p2)
|
||||
{
|
||||
return ((const reallightinfo_t*)p2)->fIntensity - ((const reallightinfo_t*)p1)->fIntensity;
|
||||
}
|
||||
|
||||
static void RB_OptimizeLights()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
static void RB_Light_CubeMap(const color4ub_t colors)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RB_Light_Real(unsigned char* colors)
|
||||
{
|
||||
int i, j;
|
||||
float* normal;
|
||||
float* xyz;
|
||||
unsigned char* color;
|
||||
vec3_t v;
|
||||
vec3_t colorout;
|
||||
float fDot;
|
||||
reallightinfo_t* pLight;
|
||||
|
||||
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
static void RB_Sphere_Light_Sun()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
static qboolean RB_Sphere_CalculateSphereOrigin()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static void RB_Sphere_DrawDebugLine(const spherel_t* thislight, float falloff, const vec3_t origin)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
static void RB_Sphere_AddSpotLight(const spherel_t* thislight)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
static void RB_Sphere_AddLight(const spherel_t* thislight)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
static void RB_Sphere_BuildStaticLights()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RB_Sphere_BuildDLights()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RB_Sphere_SetupEntity()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RB_Grid_SetupEntity()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RB_Grid_SetupStaticModel()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RB_Light_Fullbright(unsigned char* colors)
|
||||
{
|
||||
memset((void*)colors, 0xFF, tess.numVertexes);
|
||||
}
|
||||
|
||||
void R_Sphere_InitLights()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
int R_GatherLightSources(const vec3_t vPos, vec3_t* pvLightPos, vec3_t* pvLightIntensity, int iMaxLights)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return 0;
|
||||
}
|
66
code/renderergl2/new/tr_sprite.c
Normal file
66
code/renderergl2/new/tr_sprite.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2010 su44
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// tr_sprite.c - MoHAA sprite system
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
/*
|
||||
=====================
|
||||
SPR_RegisterSprite
|
||||
=====================
|
||||
*/
|
||||
sprite_t *SPR_RegisterSprite(const char *name)
|
||||
{
|
||||
image_t *spriteImage;
|
||||
shader_t *shader;
|
||||
sprite_t *spr;
|
||||
char shadername[256];
|
||||
COM_StripExtension(name,shadername,sizeof(shadername));
|
||||
shader = R_FindShader(shadername,-1,qfalse,qfalse,qfalse,qfalse);
|
||||
if(shader) {
|
||||
spriteImage = 0;
|
||||
if(shader->stages[0])
|
||||
spriteImage = shader->stages[0]->bundle[0].image[0];
|
||||
if ( !spriteImage ) {
|
||||
ri.Printf(1, "Could not find image for sprite in shader %s\n", name);
|
||||
return 0;
|
||||
}
|
||||
spr = ri.Hunk_Alloc(sizeof(sprite_t), h_dontcare);
|
||||
spr->height = spriteImage->height;
|
||||
spr->width = spriteImage->width;
|
||||
spr->origin_x = spr->width * 0.5;
|
||||
spr->origin_y = spr->height * 0.5;
|
||||
spr->shader = shader;
|
||||
spr->scale = spr->shader->sprite.scale;
|
||||
return spr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
RB_DrawSprite
|
||||
=====================
|
||||
*/
|
||||
void RB_DrawSprite( const refSprite_t *spr ) {
|
||||
// FIXME: stub
|
||||
}
|
44
code/renderergl2/new/tr_swipe.cpp
Normal file
44
code/renderergl2/new/tr_swipe.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
// tr_swipe.cpp -- swipe rendering
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
void RB_DrawSwipeSurface(surfaceType_t* pswipe) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RE_SwipeBegin(float thistime, float life, qhandle_t shader)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RE_SwipePoint(vec3_t point1, vec3_t point2, float time)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void RE_SwipeEnd()
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
260
code/renderergl2/new/tr_util.cpp
Normal file
260
code/renderergl2/new/tr_util.cpp
Normal file
|
@ -0,0 +1,260 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code 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.
|
||||
|
||||
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// tr_util.c -- renderer utility
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
static const size_t colorSize = (1 << (sizeof(uint16_t) * 8)) - 1;
|
||||
static uint16_t cntColor[4];
|
||||
static float cntSt[ 2 ];
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_StreamBegin
|
||||
===============
|
||||
*/
|
||||
void RB_StreamBegin( shader_t *shader ) {
|
||||
RB_BeginSurface( shader, 0, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_StreamEnd
|
||||
===============
|
||||
*/
|
||||
void RB_StreamEnd( void ) {
|
||||
int i;
|
||||
|
||||
if( tess.numVertexes <= 2 ) {
|
||||
RB_EndSurface();
|
||||
return;
|
||||
}
|
||||
|
||||
tess.indexes[ 0 ] = 0;
|
||||
tess.indexes[ 1 ] = 1;
|
||||
tess.indexes[ 2 ] = 2;
|
||||
|
||||
for( i = 0; i < tess.numVertexes - 2; i++ ) {
|
||||
tess.indexes[ i * 3 + 0 ] = ( i & 1 ) + i;
|
||||
tess.indexes[ i * 3 + 1 ] = i - ( ( i & 1 ) - 1 );
|
||||
tess.indexes[ i * 3 + 2 ] = i + 2;
|
||||
tess.numIndexes += 3;
|
||||
}
|
||||
|
||||
RB_EndSurface();
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_StreamBeginDrawSurf
|
||||
===============
|
||||
*/
|
||||
void RB_StreamBeginDrawSurf( void ) {
|
||||
backEnd.dsStreamVert = tess.numVertexes;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_StreamEndDrawSurf
|
||||
===============
|
||||
*/
|
||||
void RB_StreamEndDrawSurf( void ) {
|
||||
int numverts;
|
||||
int i;
|
||||
|
||||
if( tess.numVertexes - backEnd.dsStreamVert <= 2 ) {
|
||||
tess.numVertexes = backEnd.dsStreamVert;
|
||||
return;
|
||||
}
|
||||
|
||||
numverts = tess.numVertexes - backEnd.dsStreamVert - 2;
|
||||
for( i = 0; i < numverts; i++ ) {
|
||||
tess.indexes[ i + tess.numIndexes ] = ( i & 1 ) + i + backEnd.dsStreamVert;
|
||||
tess.indexes[ i + tess.numIndexes + 1 ] = i + backEnd.dsStreamVert - ( ( i & 1 ) - 1 );
|
||||
tess.indexes[ i + tess.numIndexes + 2 ] = i + backEnd.dsStreamVert + 2;
|
||||
tess.numIndexes += 3;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
addTriangle
|
||||
===============
|
||||
*/
|
||||
static void addTriangle(void) {
|
||||
tess.texCoords[tess.numVertexes][0] = cntSt[0];
|
||||
tess.texCoords[tess.numVertexes][1] = cntSt[1];
|
||||
tess.color[tess.numVertexes][0] = cntColor[0];
|
||||
tess.color[tess.numVertexes][1] = cntColor[1];
|
||||
tess.color[tess.numVertexes][2] = cntColor[2];
|
||||
tess.color[tess.numVertexes][3] = cntColor[3];
|
||||
tess.numVertexes++;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_Vertex3fv
|
||||
===============
|
||||
*/
|
||||
void RB_Vertex3fv( vec3_t v ) {
|
||||
VectorCopy( v, tess.xyz[ tess.numVertexes ] );
|
||||
addTriangle();
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_Vertex3f
|
||||
===============
|
||||
*/
|
||||
void RB_Vertex3f( vec_t x, vec_t y, vec_t z ) {
|
||||
tess.xyz[ tess.numVertexes ][ 0 ] = x;
|
||||
tess.xyz[ tess.numVertexes ][ 1 ] = y;
|
||||
tess.xyz[ tess.numVertexes ][ 2 ] = z;
|
||||
addTriangle();
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_Vertex2f
|
||||
===============
|
||||
*/
|
||||
void RB_Vertex2f( vec_t x, vec_t y ) {
|
||||
RB_Vertex3f( x, y, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_Color4f
|
||||
===============
|
||||
*/
|
||||
void RB_Color4f( vec_t r, vec_t g, vec_t b, vec_t a ) {
|
||||
cntColor[ 0 ] = r * tr.identityLightByte;
|
||||
cntColor[ 1 ] = g * tr.identityLightByte;
|
||||
cntColor[ 2 ] = b * tr.identityLightByte;
|
||||
cntColor[ 3 ] = a * 255.0;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_Color3f
|
||||
===============
|
||||
*/
|
||||
void RB_Color3f( vec_t r, vec_t g, vec_t b ) {
|
||||
RB_Color4f( r, g, b, 1.0 );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_Color3fv
|
||||
===============
|
||||
*/
|
||||
void RB_Color3fv( vec3_t col ) {
|
||||
RB_Color3f( col[ 0 ], col[ 1 ], col[ 2 ] );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_Color4bv
|
||||
===============
|
||||
*/
|
||||
void RB_Color4bv( unsigned char *colors ) {
|
||||
cntColor[ 0 ] = colors[ 0 ];
|
||||
cntColor[ 1 ] = colors[ 1 ];
|
||||
cntColor[ 2 ] = colors[ 2 ];
|
||||
cntColor[ 3 ] = colors[ 3 ];
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_Texcoord2f
|
||||
===============
|
||||
*/
|
||||
void RB_Texcoord2f( float s, float t ) {
|
||||
cntSt[ 0 ] = s;
|
||||
cntSt[ 1 ] = t;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RB_Texcoord2fv
|
||||
===============
|
||||
*/
|
||||
void RB_Texcoord2fv( vec2_t st ) {
|
||||
cntSt[ 0 ] = st[ 0 ];
|
||||
cntSt[ 1 ] = st[ 1 ];
|
||||
}
|
||||
|
||||
static int Numbers[ 12 ][ 8 ];
|
||||
static float Lines[ 13 ][ 4 ];
|
||||
|
||||
/*
|
||||
===============
|
||||
R_DrawDebugNumber
|
||||
===============
|
||||
*/
|
||||
void R_DrawDebugNumber( const vec3_t org, float number, float scale, float r, float g, float b, int precision ) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_DebugRotatedBBox
|
||||
===============
|
||||
*/
|
||||
void R_DebugRotatedBBox( const vec3_t org, vec3_t ang, vec3_t mins, vec3_t maxs, float r, float g, float b, float alpha ) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RE_GetShaderWidth
|
||||
===============
|
||||
*/
|
||||
int RE_GetShaderWidth( qhandle_t hShader ) {
|
||||
shader_t *shader;
|
||||
|
||||
if( hShader ) {
|
||||
shader = R_GetShaderByHandle( hShader );
|
||||
} else {
|
||||
shader = tr.defaultShader;
|
||||
}
|
||||
|
||||
return shader->stages[ 0 ]->bundle[ 0 ].image[ 0 ]->uploadWidth;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
RE_GetShaderHeight
|
||||
===============
|
||||
*/
|
||||
int RE_GetShaderHeight( qhandle_t hShader ) {
|
||||
shader_t *shader;
|
||||
|
||||
if( hShader ) {
|
||||
shader = R_GetShaderByHandle( hShader );
|
||||
}
|
||||
else {
|
||||
shader = tr.defaultShader;
|
||||
}
|
||||
|
||||
return shader->stages[ 0 ]->bundle[ 0 ].image[ 0 ]->uploadHeight;
|
||||
}
|
28
code/renderergl2/new/tr_world.c
Normal file
28
code/renderergl2/new/tr_world.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code 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.
|
||||
|
||||
OpenMoHAA source code 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 OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../tr_local.h"
|
||||
|
||||
void R_GetInlineModelBounds(int iIndex, vec3_t vMins, vec3_t vMaxs)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
|
@ -1644,5 +1644,7 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
|
|||
|
||||
re.TakeVideoFrame = RE_TakeVideoFrame;
|
||||
|
||||
GetRefAPI_new(rimp, &re);
|
||||
|
||||
return &re;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include "../renderercommon/iqm.h"
|
||||
#include "../renderercommon/qgl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define GLE(ret, name, ...) extern "C" name##proc * qgl##name;
|
||||
#else
|
||||
#define GLE(ret, name, ...) extern name##proc * qgl##name;
|
||||
#endif
|
||||
QGL_1_1_PROCS;
|
||||
QGL_DESKTOP_1_1_PROCS;
|
||||
QGL_1_3_PROCS;
|
||||
|
@ -47,6 +51,12 @@ QGL_ARB_occlusion_query_PROCS;
|
|||
QGL_ARB_framebuffer_object_PROCS;
|
||||
QGL_ARB_vertex_array_object_PROCS;
|
||||
QGL_EXT_direct_state_access_PROCS;
|
||||
|
||||
//
|
||||
// non-ioq3
|
||||
//
|
||||
//QGL_DESKTOP_1_1_FIXED_FUNCTION_PROCS;
|
||||
//QGL_1_1_FIXED_FUNCTION_PROCS;
|
||||
#undef GLE
|
||||
|
||||
#define GL_INDEX_TYPE GL_UNSIGNED_INT
|
||||
|
@ -68,6 +78,13 @@ typedef unsigned int glIndex_t;
|
|||
#define MAX_DRAWN_PSHADOWS 16 // do not increase past 32, because bit flags are used on surfaces
|
||||
#define PSHADOW_MAP_SIZE 512
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "new/tr_local_begin.h"
|
||||
|
||||
typedef struct cubemap_s {
|
||||
char name[MAX_QPATH];
|
||||
vec3_t origin;
|
||||
|
@ -241,7 +258,20 @@ typedef enum {
|
|||
AGEN_LIGHTING_SPECULAR,
|
||||
AGEN_WAVEFORM,
|
||||
AGEN_PORTAL,
|
||||
AGEN_CONST,
|
||||
AGEN_CONST,
|
||||
|
||||
//
|
||||
// non-ioq3
|
||||
//
|
||||
AGEN_GLOBAL_ALPHA,
|
||||
AGEN_SKYALPHA,
|
||||
AGEN_ONE_MINUS_SKYALPHA,
|
||||
AGEN_SCOORD,
|
||||
AGEN_TCOORD,
|
||||
AGEN_DIST_FADE,
|
||||
AGEN_ONE_MINUS_DIST_FADE,
|
||||
AGEN_DOT_VIEW,
|
||||
AGEN_ONE_MINUS_DOT_VIEW,
|
||||
} alphaGen_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -258,7 +288,21 @@ typedef enum {
|
|||
CGEN_WAVEFORM, // programmatically generated
|
||||
CGEN_LIGHTING_DIFFUSE,
|
||||
CGEN_FOG, // standard fog
|
||||
CGEN_CONST // fixed color
|
||||
CGEN_CONST, // fixed color
|
||||
//
|
||||
// non-ioq3 values
|
||||
//
|
||||
CGEN_CONSTANT = CGEN_CONST,
|
||||
CGEN_MULTIPLY_BY_WAVEFORM,
|
||||
CGEN_LIGHTING_GRID,
|
||||
CGEN_LIGHTING_SPHERICAL,
|
||||
CGEN_NOISE,
|
||||
CGEN_GLOBAL_COLOR,
|
||||
CGEN_STATIC,
|
||||
CGEN_SCOORD,
|
||||
CGEN_TCOORD,
|
||||
CGEN_DOT,
|
||||
CGEN_ONE_MINUS_DOT
|
||||
} colorGen_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -490,6 +534,11 @@ typedef struct shader_s {
|
|||
struct shader_s *remappedShader; // current shader this one is remapped too
|
||||
|
||||
struct shader_s *next;
|
||||
|
||||
//
|
||||
// non-ioq3
|
||||
//
|
||||
spriteParms_t sprite;
|
||||
} shader_t;
|
||||
|
||||
enum
|
||||
|
@ -865,6 +914,20 @@ typedef enum {
|
|||
SF_VAO_MDVMESH,
|
||||
SF_VAO_IQM,
|
||||
|
||||
//
|
||||
// non-ioq3 stuff
|
||||
//
|
||||
SF_MARK_FRAG,
|
||||
SF_DISPLAY_LIST,
|
||||
SF_TIKI_SKEL,
|
||||
SF_TIKI_STATIC,
|
||||
SF_SWIPE,
|
||||
SF_SPRITE,
|
||||
SF_TERRAIN_PATCH,
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
SF_NUM_SURFACE_TYPES,
|
||||
SF_MAX = 0x7fffffff // ensures that sizeof( surfaceType_t ) == sizeof( int )
|
||||
} surfaceType_t;
|
||||
|
@ -1270,7 +1333,12 @@ typedef enum {
|
|||
MOD_BRUSH,
|
||||
MOD_MESH,
|
||||
MOD_MDR,
|
||||
MOD_IQM
|
||||
MOD_IQM,
|
||||
//
|
||||
// non-ioq3
|
||||
//
|
||||
MOD_TIKI,
|
||||
MOD_SPRITE
|
||||
} modtype_t;
|
||||
|
||||
typedef struct model_s {
|
||||
|
@ -1283,7 +1351,17 @@ typedef struct model_s {
|
|||
mdvModel_t *mdv[MD3_MAX_LODS]; // only if type == MOD_MESH
|
||||
void *modelData; // only if type == (MOD_MDR | MOD_IQM)
|
||||
|
||||
int numLods;
|
||||
int numLods;
|
||||
|
||||
//
|
||||
// non-ioq3
|
||||
//
|
||||
qboolean serveronly;
|
||||
union {
|
||||
bmodel_t* bmodel;
|
||||
dtiki_t* tiki;
|
||||
sprite_t* sprite;
|
||||
} d;
|
||||
} model_t;
|
||||
|
||||
|
||||
|
@ -1474,6 +1552,11 @@ typedef struct {
|
|||
qboolean colorMask[4];
|
||||
qboolean framePostProcessed;
|
||||
qboolean depthFill;
|
||||
|
||||
//
|
||||
// non-ioq3
|
||||
//
|
||||
int dsStreamVert;
|
||||
} backEndState_t;
|
||||
|
||||
/*
|
||||
|
@ -1656,7 +1739,16 @@ typedef struct {
|
|||
float triangleTable[FUNCTABLE_SIZE];
|
||||
float sawToothTable[FUNCTABLE_SIZE];
|
||||
float inverseSawToothTable[FUNCTABLE_SIZE];
|
||||
float fogTable[FOG_TABLE_SIZE];
|
||||
float fogTable[FOG_TABLE_SIZE];
|
||||
|
||||
spherel_t sSunLight;
|
||||
spherel_t sLights[1532];
|
||||
int numSLights;
|
||||
int rendererhandle;
|
||||
qboolean shadersParsed;
|
||||
int frame_skel_index;
|
||||
int skel_index[1024];
|
||||
fontheader_t *pFontDebugStrings;
|
||||
} trGlobals_t;
|
||||
|
||||
extern backEndState_t backEnd;
|
||||
|
@ -2496,5 +2588,10 @@ size_t RE_SaveJPGToBuffer(byte *buffer, size_t bufSize, int quality,
|
|||
void RE_TakeVideoFrame( int width, int height,
|
||||
byte *captureBuffer, byte *encodeBuffer, qboolean motionJpeg );
|
||||
|
||||
#include "new/tr_local.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //TR_LOCAL_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue