Skip to content

Commit

Permalink
added svg support and moved the image loader lists to the common rend…
Browse files Browse the repository at this point in the history
…erer sources
  • Loading branch information
Jere Sjöroos committed Oct 20, 2019
1 parent d6674f3 commit b696205
Show file tree
Hide file tree
Showing 16 changed files with 4,709 additions and 138 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ win_resource.aps
/cmake-build-*

# Visual Studio 2017
/.vs/
CMakeSettings.json
# CMakeSettings.json
/.vs/*
!/.vs/launch.vs.json

# Visual Studio Code
/.vscode/
Expand Down
20 changes: 20 additions & 0 deletions .vs/launch.vs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "etl.exe",
"name": "etl.exe",
"args": [
"+set",
"developer",
"1",
"+set",
"omnibot_path",
"./legacy/omni-bot"
]
}
]
}
30 changes: 30 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"configurations": [
{
"buildCommandArgs": "-v",
"buildRoot": "${workspaceRoot}\\build\\${name}",
"cmakeCommandArgs": "",
"configurationType": "Debug",
"ctestCommandArgs": "",
"generator": "Ninja",
"inheritEnvironments": [
"msvc_x86"
],
"installRoot": "${workspaceRoot}\\build\\${name}\\install",
"name": "x86-Debug"
},
{
"buildCommandArgs": "-v",
"buildRoot": "${workspaceRoot}\\build\\${name}",
"cmakeCommandArgs": "",
"configurationType": "Release",
"ctestCommandArgs": "",
"generator": "Ninja",
"inheritEnvironments": [
"msvc_x86"
],
"installRoot": "${workspaceRoot}\\build\\${name}\\install",
"name": "x86-Release"
}
]
}
20 changes: 17 additions & 3 deletions cmake/ETLCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,25 @@ else(buildtype_upper MATCHES DEBUG)
SET(DEBUG_BUILD 0)
endif(buildtype_upper MATCHES DEBUG)

if(MSVC AND NOT NMAKE_BUILD)
if(WIN32 AND buildgen_upper MATCHES "NINJA")
SET(NINJA_BUILD 1)
else()
SET(NINJA_BUILD 0)
endif()

# message(FATAL_ERROR "Using buildgen: ${buildgen_upper} ${NINJA_BUILD}")

if(MSVC AND NOT NMAKE_BUILD AND NOT NINJA_BUILD)
SET(VSTUDIO 1)
else(MSVC AND NOT NMAKE_BUILD)
else()
SET(VSTUDIO 0)
endif(MSVC AND NOT NMAKE_BUILD)
endif()

if(NMAKE_BUILD OR NINJA_BUILD)
set(VS_BUILD 1)
else()
set(VS_BUILD 0)
endif()

if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
SET(XCODE 1)
Expand Down
14 changes: 7 additions & 7 deletions src/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ static void CL_Clientinfo_f(void)
* @note Unused
void CL_EatMe_f(void)
{
// do nothing kthxbye
// do nothing kthxbye
}
*/

Expand Down Expand Up @@ -1806,7 +1806,7 @@ void CL_ConnectionlessPacket(netadr_t from, msg_t *msg)
{
Com_Printf("connectResponse from a different address. Ignored.\n");
Com_Printf("%s should have been %s\n", NET_AdrToString(from),
NET_AdrToString(clc.serverAddress));
NET_AdrToString(clc.serverAddress));
return;
}

Expand Down Expand Up @@ -1976,9 +1976,9 @@ void CL_CheckTimeout(void)
{
// check timeout
if ((!cl_paused->integer || !sv_paused->integer)
&& cls.state >= CA_CONNECTED && cls.state != CA_CINEMATIC
&& cls.realtime - clc.lastPacketTime > cl_timeout->value * 1000
&& !(clc.demoplaying && cl_freezeDemo->integer))
&& cls.state >= CA_CONNECTED && cls.state != CA_CINEMATIC
&& cls.realtime - clc.lastPacketTime > cl_timeout->value * 1000
&& !(clc.demoplaying && cl_freezeDemo->integer))
{
if (++cl.timeoutcount > 5) // timeoutcount saves debugger
{
Expand Down Expand Up @@ -2158,7 +2158,7 @@ void CL_Frame(int msec)
}

if (cls.state == CA_DISCONNECTED && !(cls.keyCatchers & KEYCATCH_UI)
&& !com_sv_running->integer)
&& !com_sv_running->integer)
{
// if disconnected, bring up the menu
S_StopAllSounds();
Expand Down Expand Up @@ -2187,7 +2187,7 @@ void CL_Frame(int msec)
//clc.aviVideoFrameRemainder = frameDuration + msec;
}
else if ((!cl_avidemo->integer && CL_VideoRecording())
|| (cl_avidemo->integer && (cls.state != CA_ACTIVE || !cl_forceavidemo->integer)))
|| (cl_avidemo->integer && (cls.state != CA_ACTIVE || !cl_forceavidemo->integer)))
{
CL_StopVideo_f();
}
Expand Down
23 changes: 0 additions & 23 deletions src/renderer/tr_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,29 +987,6 @@ image_t *R_CreateImage(const char *name, const byte *pic, int width, int height,

//===================================================================

typedef struct
{
char *ext;
void (*ImageLoader)(const char *, unsigned char **, int *, int *, byte);
} imageExtToLoaderMap_t;

/**
* @var imageLoaders
* @brief Note that the ordering indicates the order of preference used
* when there are multiple images of different formats available
*/
static imageExtToLoaderMap_t imageLoaders[] =
{
{ "tga", R_LoadTGA },
{ "jpg", R_LoadJPG },
{ "jpeg", R_LoadJPG },
{ "png", R_LoadPNG },
{ "pcx", R_LoadPCX },
{ "bmp", R_LoadBMP }
};

static int numImageLoaders = sizeof(imageLoaders) / sizeof(imageLoaders[0]);

/**
* @brief Loads any of the supported image types into a cannonical 32 bit format.
*
Expand Down
12 changes: 0 additions & 12 deletions src/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1822,18 +1822,6 @@ void R_MDM_AddAnimSurfaces(trRefEntity_t *ent);
void RB_MDM_SurfaceAnim(mdmSurface_t *surface);
int R_MDM_GetBoneTag(orientation_t *outTag, mdmHeader_t *mdm, int startTagIndex, const refEntity_t *refent, const char *tagName);

/*
=============================================================
IMAGE LOADERS
=============================================================
*/

void R_LoadBMP(const char *name, byte **pic, int *width, int *height, byte alphaByte);
void R_LoadJPG(const char *name, byte **pic, int *width, int *height, byte alphaByte);
void R_LoadPCX(const char *name, byte **pic, int *width, int *height, byte alphaByte);
void R_LoadPNG(const char *name, byte **pic, int *width, int *height, byte alphaByte);
void R_LoadTGA(const char *name, byte **pic, int *width, int *height, byte alphaByte);

/*
=============================================================
=============================================================
Expand Down
27 changes: 0 additions & 27 deletions src/renderer2/tr_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -1924,33 +1924,6 @@ static qboolean ParseMakeAlpha(char **text, byte **pic, int *width, int *height,
return qtrue;
}

/**
* @struct imageExtToLoaderMap_s
* @brief
*/
typedef struct
{
char *ext;
void (*ImageLoader)(const char *, unsigned char **, int *, int *, byte);
} imageExtToLoaderMap_t;

/**
* @var imageLoaders
* @brief Note that the ordering indicates the order of preference used
* when there are multiple images of different formats available
*/
static imageExtToLoaderMap_t imageLoaders[] =
{
{ "png", R_LoadPNG },
{ "tga", R_LoadTGA },
{ "jpg", R_LoadJPG },
{ "jpeg", R_LoadJPG },
{ "pcx", R_LoadPCX },
{ "bmp", R_LoadBMP }
};

static int numImageLoaders = sizeof(imageLoaders) / sizeof(imageLoaders[0]);

/**
* @brief This is a hack to get the common imageloaders working properly
* @param[in] size
Expand Down
6 changes: 0 additions & 6 deletions src/renderer2/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -4566,15 +4566,9 @@ void RB_CalcTexMatrix(const textureBundle_t *bundle, mat4_t matrix);
RENDERER IMAGE FUNCTIONS
=============================================================
*/

void R_LoadJPG(const char *filename, unsigned char **pic, int *width, int *height, byte alphaByte);
size_t RE_SaveJPGToBuffer(byte *buffer, size_t bufSize, int quality, int image_width, int image_height, byte *image_buffer, int padding);
void RE_SaveJPG(const char *filename, int quality, int image_width, int image_height, byte *image_buffer, int padding);

void R_LoadPNG(const char *name, byte **pic, int *width, int *height, byte alphaByte);
void R_LoadBMP(const char *name, byte **pic, int *width, int *height, byte alphaByte);
void R_LoadTGA(const char *name, byte **pic, int *width, int *height, byte alphaByte);
void R_LoadPCX(const char *filename, byte **pic, int *width, int *height, byte alphaByte);

/*
=============================================================
Expand Down
23 changes: 0 additions & 23 deletions src/rendererGLES/tr_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,29 +1039,6 @@ image_t *R_CreateImage(const char *name, const byte *pic, int width, int height,

//===================================================================

typedef struct
{
char *ext;
void (*ImageLoader)(const char *, unsigned char **, int *, int *, byte);
} imageExtToLoaderMap_t;

/**
* @var imageLoaders
* @brief Note that the ordering indicates the order of preference used
* when there are multiple images of different formats available
*/
static imageExtToLoaderMap_t imageLoaders[] =
{
{ "tga", R_LoadTGA },
{ "jpg", R_LoadJPG },
{ "jpeg", R_LoadJPG },
{ "png", R_LoadPNG },
{ "pcx", R_LoadPCX },
{ "bmp", R_LoadBMP }
};

static int numImageLoaders = sizeof(imageLoaders) / sizeof(imageLoaders[0]);

/**
* @brief Loads any of the supported image types into a cannonical 32 bit format.
*
Expand Down
Loading

0 comments on commit b696205

Please sign in to comment.