rename
This commit is contained in:
parent
472e21e389
commit
2d6ed53abc
56 changed files with 746 additions and 746 deletions
|
|
@ -3,6 +3,6 @@ project(af_client)
|
|||
file(GLOB af_client_SRC *.c)
|
||||
|
||||
add_executable(af_client ${af_client_SRC})
|
||||
target_link_libraries(af_client PRIVATE GearBox Mw)
|
||||
target_link_libraries(af_client PRIVATE GearSrc Mw)
|
||||
|
||||
install_target(af_client)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#define MW_OPENGL_NO_INCLUDE
|
||||
#define _MILSKO
|
||||
|
||||
#include <GearBox/Foundation.h>
|
||||
#include <GearSrc/Foundation.h>
|
||||
|
||||
#include <Mw/Milsko.h>
|
||||
#include <Mw/Widget/OpenGL.h>
|
||||
|
|
@ -38,20 +38,20 @@ static void tick(void){
|
|||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
GBEngineParam param;
|
||||
GBEngine engine;
|
||||
GSEngineParam param;
|
||||
GSEngine engine;
|
||||
|
||||
GBEngineParamInit(¶m);
|
||||
GSEngineParamInit(¶m);
|
||||
param.ready = ready;
|
||||
param.tick = tick;
|
||||
param.get_tick = MwTimeGetTick;
|
||||
param.sleep = MwTimeSleep;
|
||||
param.gl_swapbuffer = gl_swapbuffer;
|
||||
|
||||
GBInit();
|
||||
GSInit();
|
||||
|
||||
if((engine = GBEngineCreate(¶m)) != NULL){
|
||||
GBEngineLoop(engine);
|
||||
GBEngineDestroy(engine);
|
||||
if((engine = GSEngineCreate(¶m)) != NULL){
|
||||
GSEngineLoop(engine);
|
||||
GSEngineDestroy(engine);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,18 +16,18 @@ endmacro()
|
|||
|
||||
add_subdirectory(net)
|
||||
|
||||
file(GLOB GearBox_SRC src/*.c lz4/*.c)
|
||||
file(GLOB GearSrc_SRC src/*.c lz4/*.c)
|
||||
|
||||
add_library(GearBox SHARED ${GearBox_SRC})
|
||||
target_include_directories(GearBox PUBLIC include)
|
||||
target_include_directories(GearBox PRIVATE lz4)
|
||||
target_compile_definitions(GearBox PRIVATE _GEARBOX)
|
||||
target_link_libraries(GearBox PRIVATE gbnet)
|
||||
add_library(GearSrc SHARED ${GearSrc_SRC})
|
||||
target_include_directories(GearSrc PUBLIC include)
|
||||
target_include_directories(GearSrc PRIVATE lz4)
|
||||
target_compile_definitions(GearSrc PRIVATE _GEARBOX)
|
||||
target_link_libraries(GearSrc PRIVATE gbnet)
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(GearBox PRIVATE m)
|
||||
target_link_libraries(GearSrc PRIVATE m)
|
||||
endif()
|
||||
|
||||
install_target(GearBox)
|
||||
install_target(GearSrc)
|
||||
install(
|
||||
DIRECTORY include/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
|
|
@ -38,5 +38,5 @@ add_subdirectory(tools)
|
|||
|
||||
install(
|
||||
DIRECTORY resource/
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/GearBox
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/GearSrc
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
GearBox game engine source code
|
||||
GearSrc game engine source code
|
||||
|
||||
Licensed under 3-clause BSD
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef __GEARBOX_CLIENT_H__
|
||||
#define __GEARBOX_CLIENT_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GBDECL GBClient GBClientCreate(GBEngine engine);
|
||||
GBDECL void GBClientDestroy(GBClient client);
|
||||
GBDECL void GBClientStep(GBClient client);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef __GEARBOX_CORE_H__
|
||||
#define __GEARBOX_CORE_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GBDECL void GBInit(void);
|
||||
|
||||
GBDECL GBEngine GBEngineCreate(GBEngineParam* param);
|
||||
GBDECL void GBEngineDestroy(GBEngine engine);
|
||||
GBDECL void GBEngineParamInit(GBEngineParam* param);
|
||||
GBDECL void GBEngineLoop(GBEngine engine);
|
||||
GBDECL GBClient GBEngineGetClient(GBEngine engine);
|
||||
GBDECL GBServer GBEngineGetServer(GBEngine engine);
|
||||
GBDECL int GBEngineRegisterResource(GBEngine engine, const char* name, const char* path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
#ifndef __GEARBOX_ENDIAN_H__
|
||||
#define __GEARBOX_ENDIAN_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)
|
||||
#define GBEndianHostLittle
|
||||
#else
|
||||
#define GBEndianHostBig
|
||||
#endif
|
||||
|
||||
#ifdef GBEndianHostLittle
|
||||
GBDECL GBI16 GBEndianSwapI16BE(GBI16 in);
|
||||
GBDECL GBI32 GBEndianSwapI32BE(GBI32 in);
|
||||
GBDECL GBI64 GBEndianSwapI64BE(GBI64 in);
|
||||
|
||||
GBDECL GBU16 GBEndianSwapU16BE(GBU16 in);
|
||||
GBDECL GBU32 GBEndianSwapU32BE(GBU32 in);
|
||||
GBDECL GBU64 GBEndianSwapU64BE(GBU64 in);
|
||||
#else
|
||||
#define GBEndianSwapI16BE(in) (in)
|
||||
#define GBEndianSwapI32BE(in) (in)
|
||||
#define GBEndianSwapI64BE(in) (in)
|
||||
|
||||
#define GBEndianSwapU16BE(in) (in)
|
||||
#define GBEndianSwapU32BE(in) (in)
|
||||
#define GBEndianSwapU64BE(in) (in)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef __GEARBOX_FILE_H__
|
||||
#define __GEARBOX_FILE_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GBDECL GBFile GBFileOpen(GBEngine engine, const char* path);
|
||||
GBDECL int GBFileRead(GBFile file, void* out, int size);
|
||||
GBDECL void GBFileSeek(GBFile file, int pos);
|
||||
GBDECL unsigned int GBFileSize(GBFile file);
|
||||
GBDECL void GBFileClose(GBFile file);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef __GEARBOX_FOUNDATION_H__
|
||||
#define __GEARBOX_FOUNDATION_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#include <GearBox/Core.h>
|
||||
#include <GearBox/Version.h>
|
||||
#include <GearBox/Log.h>
|
||||
#include <GearBox/Client.h>
|
||||
#include <GearBox/Server.h>
|
||||
#include <GearBox/Math.h>
|
||||
#include <GearBox/GL.h>
|
||||
#include <GearBox/File.h>
|
||||
#include <GearBox/Resource.h>
|
||||
#include <GearBox/Endian.h>
|
||||
#include <GearBox/SkyBox.h>
|
||||
|
||||
#endif
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
#ifndef __GEARBOX_GL_H__
|
||||
#define __GEARBOX_GL_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#include <GearBox/GL/GL.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GBGLMaxDistance 100.0
|
||||
|
||||
/* gl_shader.c */
|
||||
GBDECL int GBGLShaderPrepare(GBGL gl, GLuint* shader, const char* vs, const char* fs);
|
||||
|
||||
/* gl_texture.c */
|
||||
GBDECL void GBGLTexturePrepare(GBGL gl, GLuint* texture, unsigned char* rgba, int width, int height);
|
||||
GBDECL void GBGLTextureSet(GBGL gl, GLuint texture);
|
||||
GBDECL int GBGLTextureLoadFile(GBGL gl, GLuint* texture, int* width, int* height, const char* filename);
|
||||
GBDECL void GBGLTextureDelete(GBGL gl, GLuint texture);
|
||||
|
||||
/* gl_shadow.c */
|
||||
GBDECL void GBGLShadowInit(GBGL gl);
|
||||
GBDECL int GBGLShadowBeforeMapping(GBGL gl);
|
||||
GBDECL void GBGLShadowAfterMapping(GBGL gl);
|
||||
GBDECL void GBGLShadowEnd(GBGL gl);
|
||||
GBDECL void GBGLShadowDeinit(GBGL gl);
|
||||
GBDECL void GBGLShadowDisable(GBGL gl);
|
||||
GBDECL void GBGLShadowEnable(GBGL gl);
|
||||
|
||||
/* gl.c */
|
||||
GBDECL GBGL GBGLCreate(GBClient client);
|
||||
GBDECL void GBGLDestroy(GBGL gl);
|
||||
GBDECL void GBGLClear(GBGL gl);
|
||||
GBDECL void GBGLIgnoreDepth(GBGL gl);
|
||||
GBDECL void GBGLCareDepth(GBGL gl);
|
||||
GBDECL void GBGLSetLight(GBGL gl);
|
||||
GBDECL void GBGLPolygon(GBGL gl, int pairs, GBVector3* vert, GBVector2* tex);
|
||||
|
||||
/* gl_camera.c */
|
||||
GBDECL void GBGLCameraPerspective(GBGL gl, GBNumber width, GBNumber height);
|
||||
GBDECL void GBGLCameraSet(GBGL gl);
|
||||
GBDECL void GBGLCameraLookAt(GBGL gl, GBVector3 camera, GBVector3 look_at);
|
||||
GBDECL void GBGLCameraSetup(GBGL gl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef __GEARBOX_LOG_H__
|
||||
#define __GEARBOX_LOG_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum GBLogLevel {
|
||||
GBLogInfo = 0,
|
||||
GBLogWarn,
|
||||
GBLogError
|
||||
};
|
||||
|
||||
GBDECL void GBLog(int level, const char* fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#ifndef __GEARBOX_MATH_H__
|
||||
#define __GEARBOX_MATH_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GBMathPi 3.14159265358979323846
|
||||
|
||||
GBDECL void GBMathCross3(GBVector3 r, GBVector3 v0, GBVector3 v1);
|
||||
GBDECL void GBMathNormalize3(GBVector3 vec);
|
||||
GBDECL void GBMathSubtract3(GBVector3 r, GBVector3 v0, GBVector3 v1);
|
||||
GBDECL void GBMathAdd3(GBVector3 r, GBVector3 v0, GBVector3 v1);
|
||||
GBDECL void GBMathNormal3x3(GBVector3 r, GBVector3 v0, GBVector3 v1, GBVector3 v2);
|
||||
GBDECL void GBMathNormal3x4(GBVector3 r, GBVector3 v0, GBVector3 v1, GBVector3 v2, GBVector3 v3);
|
||||
GBDECL void GBMathInvert4x4(GBMatrix4x4 out, GBMatrix4x4 in);
|
||||
GBDECL GBNumber GBMathCot(GBNumber x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef __GEARBOX_RESOURCE_H__
|
||||
#define __GEARBOX_RESOURCE_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GBDECL GBResource GBResourceOpen(GBEngine engine, const char* path);
|
||||
GBDECL void* GBResourceGet(GBResource resource, const char* name, unsigned int* size);
|
||||
GBDECL void GBResourceClose(GBResource resource);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef __GEARBOX_SERVER_H__
|
||||
#define __GEARBOX_SERVER_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GBDECL GBServer GBServerCreate(GBEngine engine);
|
||||
GBDECL void GBServerDestroy(GBServer server);
|
||||
GBDECL void GBServerStep(GBServer server);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef __GEARBOX_SKYBOX_H__
|
||||
#define __GEARBOX_SKYBOX_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GBDECL GBSkyBox GBSkyBoxOpen(GBClient client, const char* base);
|
||||
GBDECL void GBSkyBoxDraw(GBSkyBox skybox);
|
||||
GBDECL void GBSkyBoxClose(GBSkyBox skybox);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef __GEARBOX_STRING_H__
|
||||
#define __GEARBOX_STRING_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GBDECL char* GBStringDuplicate(const char* str);
|
||||
GBDECL char* GBStringConcat(const char* str1, const char* str2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,155 +0,0 @@
|
|||
#ifndef __GEARBOX_TYPEDEFS_H__
|
||||
#define __GEARBOX_TYPEDEFS_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
||||
typedef __int8_t GBI8;
|
||||
typedef __int16_t GBI16;
|
||||
typedef __int32_t GBI32;
|
||||
typedef __int64_t GBI64;
|
||||
|
||||
typedef unsigned __int8_t GBU8;
|
||||
typedef unsigned __int16_t GBU16;
|
||||
typedef unsigned __int32_t GBU32;
|
||||
typedef unsigned __int64_t GBU64;
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int8_t GBI8;
|
||||
typedef int16_t GBI16;
|
||||
typedef int32_t GBI32;
|
||||
typedef int64_t GBI64;
|
||||
|
||||
typedef uint8_t GBU8;
|
||||
typedef uint16_t GBU16;
|
||||
typedef uint32_t GBU32;
|
||||
typedef uint64_t GBU64;
|
||||
#else
|
||||
typedef signed char GBI8;
|
||||
typedef short GBI16;
|
||||
typedef int GBI32;
|
||||
typedef long GBI64;
|
||||
|
||||
typedef unsigned char GBU8;
|
||||
typedef unsigned short GBU16;
|
||||
typedef unsigned int GBU32;
|
||||
typedef unsigned long GBU64;
|
||||
#endif
|
||||
|
||||
typedef struct _GBVersion GBVersion;
|
||||
typedef struct _GBEngineParam GBEngineParam;
|
||||
typedef struct _GBResourceKV GBResourceKV;
|
||||
#ifdef _GEARBOX
|
||||
typedef struct _GBClient* GBClient;
|
||||
typedef struct _GBServer* GBServer;
|
||||
typedef struct _GBEngine* GBEngine;
|
||||
typedef struct _GBFile* GBFile;
|
||||
typedef struct _GBResource* GBResource;
|
||||
typedef struct _GBGL* GBGL;
|
||||
typedef struct _GBSkyBox* GBSkyBox;
|
||||
#else
|
||||
typedef void* GBClient;
|
||||
typedef void* GBServer;
|
||||
typedef void* GBEngine;
|
||||
typedef void* GBFile;
|
||||
typedef void* GBResource;
|
||||
typedef void* GBGL;
|
||||
typedef void* GBSkyBox;
|
||||
#endif
|
||||
typedef float GBNumber;
|
||||
typedef GBNumber GBVector2[2];
|
||||
typedef GBNumber GBVector3[3];
|
||||
typedef GBNumber GBVector4[4];
|
||||
typedef GBNumber GBMatrix4x4[16];
|
||||
|
||||
typedef void (*GBGLSwapBufferCallback)(void);
|
||||
typedef void (*GBReadyCallback)(int width, int height);
|
||||
typedef void (*GBTickCallback)(void);
|
||||
typedef long (*GBGetTickCallback)(void);
|
||||
typedef void (*GBSleepCallback)(int ms);
|
||||
|
||||
struct _GBResourceKV {
|
||||
char* key;
|
||||
GBResource value;
|
||||
};
|
||||
|
||||
#ifdef _GEARBOX
|
||||
#include <GearBox/GL/GL.h>
|
||||
|
||||
struct _GBGL {
|
||||
GBEngine engine;
|
||||
|
||||
int shadow_use_shader;
|
||||
GLuint shadow_texture;
|
||||
GLuint shadow_shader;
|
||||
GLdouble shadow_modelview[16];
|
||||
GLdouble shadow_projection[16];
|
||||
GLdouble shadow_old_projection[16];
|
||||
GLdouble shadow_old_modelview[16];
|
||||
};
|
||||
|
||||
struct _GBClient {
|
||||
GBEngine engine;
|
||||
|
||||
GBGL gl;
|
||||
GBVector3 look_at;
|
||||
GBVector3 camera;
|
||||
GBVector4 light0;
|
||||
GBSkyBox skybox;
|
||||
};
|
||||
|
||||
struct _GBSkyBox {
|
||||
GBEngine engine;
|
||||
|
||||
GLuint left;
|
||||
GLuint right;
|
||||
GLuint front;
|
||||
GLuint back;
|
||||
GLuint up;
|
||||
GLuint down;
|
||||
};
|
||||
|
||||
struct _GBServer {
|
||||
GBEngine engine;
|
||||
};
|
||||
|
||||
struct _GBEngine {
|
||||
GBEngineParam* param;
|
||||
GBClient client;
|
||||
GBServer server;
|
||||
GBResourceKV* resource;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
struct _GBFile {
|
||||
FILE* fp;
|
||||
unsigned char* data;
|
||||
unsigned int size;
|
||||
unsigned int seek;
|
||||
};
|
||||
|
||||
struct _GBResource {
|
||||
GBFile file;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct _GBVersion {
|
||||
char string[64];
|
||||
int majorlevel;
|
||||
int minorlevel;
|
||||
int patchlevel;
|
||||
};
|
||||
|
||||
struct _GBEngineParam {
|
||||
int client;
|
||||
int server;
|
||||
GBGLSwapBufferCallback gl_swapbuffer;
|
||||
GBReadyCallback ready;
|
||||
GBTickCallback tick;
|
||||
GBGetTickCallback get_tick;
|
||||
GBSleepCallback sleep;
|
||||
};
|
||||
|
||||
#endif
|
||||
19
engine/include/GearSrc/Client.h
Normal file
19
engine/include/GearSrc/Client.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __GEARBOX_CLIENT_H__
|
||||
#define __GEARBOX_CLIENT_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GSDECL GSClient GSClientCreate(GSEngine engine);
|
||||
GSDECL void GSClientDestroy(GSClient client);
|
||||
GSDECL void GSClientStep(GSClient client);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
25
engine/include/GearSrc/Core.h
Normal file
25
engine/include/GearSrc/Core.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef __GEARBOX_CORE_H__
|
||||
#define __GEARBOX_CORE_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GSDECL void GSInit(void);
|
||||
|
||||
GSDECL GSEngine GSEngineCreate(GSEngineParam* param);
|
||||
GSDECL void GSEngineDestroy(GSEngine engine);
|
||||
GSDECL void GSEngineParamInit(GSEngineParam* param);
|
||||
GSDECL void GSEngineLoop(GSEngine engine);
|
||||
GSDECL GSClient GSEngineGetClient(GSEngine engine);
|
||||
GSDECL GSServer GSEngineGetServer(GSEngine engine);
|
||||
GSDECL int GSEngineRegisterResource(GSEngine engine, const char* name, const char* path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
39
engine/include/GearSrc/Endian.h
Normal file
39
engine/include/GearSrc/Endian.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef __GEARBOX_ENDIAN_H__
|
||||
#define __GEARBOX_ENDIAN_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)
|
||||
#define GSEndianHostLittle
|
||||
#else
|
||||
#define GSEndianHostBig
|
||||
#endif
|
||||
|
||||
#ifdef GSEndianHostLittle
|
||||
GSDECL GSI16 GSEndianSwapI16BE(GSI16 in);
|
||||
GSDECL GSI32 GSEndianSwapI32BE(GSI32 in);
|
||||
GSDECL GSI64 GSEndianSwapI64BE(GSI64 in);
|
||||
|
||||
GSDECL GSU16 GSEndianSwapU16BE(GSU16 in);
|
||||
GSDECL GSU32 GSEndianSwapU32BE(GSU32 in);
|
||||
GSDECL GSU64 GSEndianSwapU64BE(GSU64 in);
|
||||
#else
|
||||
#define GSEndianSwapI16BE(in) (in)
|
||||
#define GSEndianSwapI32BE(in) (in)
|
||||
#define GSEndianSwapI64BE(in) (in)
|
||||
|
||||
#define GSEndianSwapU16BE(in) (in)
|
||||
#define GSEndianSwapU32BE(in) (in)
|
||||
#define GSEndianSwapU64BE(in) (in)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
21
engine/include/GearSrc/File.h
Normal file
21
engine/include/GearSrc/File.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef __GEARBOX_FILE_H__
|
||||
#define __GEARBOX_FILE_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GSDECL GSFile GSFileOpen(GSEngine engine, const char* path);
|
||||
GSDECL int GSFileRead(GSFile file, void* out, int size);
|
||||
GSDECL void GSFileSeek(GSFile file, int pos);
|
||||
GSDECL unsigned int GSFileSize(GSFile file);
|
||||
GSDECL void GSFileClose(GSFile file);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
19
engine/include/GearSrc/Foundation.h
Normal file
19
engine/include/GearSrc/Foundation.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __GEARBOX_FOUNDATION_H__
|
||||
#define __GEARBOX_FOUNDATION_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#include <GearSrc/Core.h>
|
||||
#include <GearSrc/Version.h>
|
||||
#include <GearSrc/Log.h>
|
||||
#include <GearSrc/Client.h>
|
||||
#include <GearSrc/Server.h>
|
||||
#include <GearSrc/Math.h>
|
||||
#include <GearSrc/GL.h>
|
||||
#include <GearSrc/File.h>
|
||||
#include <GearSrc/Resource.h>
|
||||
#include <GearSrc/Endian.h>
|
||||
#include <GearSrc/SkyBox.h>
|
||||
|
||||
#endif
|
||||
52
engine/include/GearSrc/GL.h
Normal file
52
engine/include/GearSrc/GL.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef __GEARBOX_GL_H__
|
||||
#define __GEARBOX_GL_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#include <GearSrc/GL/GL.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GSGLMaxDistance 100.0
|
||||
|
||||
/* gl_shader.c */
|
||||
GSDECL int GSGLShaderPrepare(GSGL gl, GLuint* shader, const char* vs, const char* fs);
|
||||
|
||||
/* gl_texture.c */
|
||||
GSDECL void GSGLTexturePrepare(GSGL gl, GLuint* texture, unsigned char* rgba, int width, int height);
|
||||
GSDECL void GSGLTextureSet(GSGL gl, GLuint texture);
|
||||
GSDECL int GSGLTextureLoadFile(GSGL gl, GLuint* texture, int* width, int* height, const char* filename);
|
||||
GSDECL void GSGLTextureDelete(GSGL gl, GLuint texture);
|
||||
|
||||
/* gl_shadow.c */
|
||||
GSDECL void GSGLShadowInit(GSGL gl);
|
||||
GSDECL int GSGLShadowBeforeMapping(GSGL gl);
|
||||
GSDECL void GSGLShadowAfterMapping(GSGL gl);
|
||||
GSDECL void GSGLShadowEnd(GSGL gl);
|
||||
GSDECL void GSGLShadowDeinit(GSGL gl);
|
||||
GSDECL void GSGLShadowDisable(GSGL gl);
|
||||
GSDECL void GSGLShadowEnable(GSGL gl);
|
||||
|
||||
/* gl.c */
|
||||
GSDECL GSGL GSGLCreate(GSClient client);
|
||||
GSDECL void GSGLDestroy(GSGL gl);
|
||||
GSDECL void GSGLClear(GSGL gl);
|
||||
GSDECL void GSGLIgnoreDepth(GSGL gl);
|
||||
GSDECL void GSGLCareDepth(GSGL gl);
|
||||
GSDECL void GSGLSetLight(GSGL gl);
|
||||
GSDECL void GSGLPolygon(GSGL gl, int pairs, GSVector3* vert, GSVector2* tex);
|
||||
|
||||
/* gl_camera.c */
|
||||
GSDECL void GSGLCameraPerspective(GSGL gl, GSNumber width, GSNumber height);
|
||||
GSDECL void GSGLCameraSet(GSGL gl);
|
||||
GSDECL void GSGLCameraLookAt(GSGL gl, GSVector3 camera, GSVector3 look_at);
|
||||
GSDECL void GSGLCameraSetup(GSGL gl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
23
engine/include/GearSrc/Log.h
Normal file
23
engine/include/GearSrc/Log.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef __GEARBOX_LOG_H__
|
||||
#define __GEARBOX_LOG_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum GSLogLevel {
|
||||
GSLogInfo = 0,
|
||||
GSLogWarn,
|
||||
GSLogError
|
||||
};
|
||||
|
||||
GSDECL void GSLog(int level, const char* fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -12,11 +12,11 @@
|
|||
#endif
|
||||
|
||||
#if defined(_GEARBOX) && defined(_WIN32)
|
||||
#define GBDECL extern __declspec(dllexport)
|
||||
#define GSDECL extern __declspec(dllexport)
|
||||
#elif defined(_WIN32)
|
||||
#define GBDECL extern __declspec(dllimport)
|
||||
#define GSDECL extern __declspec(dllimport)
|
||||
#else
|
||||
#define GBDECL extern
|
||||
#define GSDECL extern
|
||||
#endif
|
||||
|
||||
#endif
|
||||
26
engine/include/GearSrc/Math.h
Normal file
26
engine/include/GearSrc/Math.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef __GEARBOX_MATH_H__
|
||||
#define __GEARBOX_MATH_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GSMathPi 3.14159265358979323846
|
||||
|
||||
GSDECL void GSMathCross3(GSVector3 r, GSVector3 v0, GSVector3 v1);
|
||||
GSDECL void GSMathNormalize3(GSVector3 vec);
|
||||
GSDECL void GSMathSubtract3(GSVector3 r, GSVector3 v0, GSVector3 v1);
|
||||
GSDECL void GSMathAdd3(GSVector3 r, GSVector3 v0, GSVector3 v1);
|
||||
GSDECL void GSMathNormal3x3(GSVector3 r, GSVector3 v0, GSVector3 v1, GSVector3 v2);
|
||||
GSDECL void GSMathNormal3x4(GSVector3 r, GSVector3 v0, GSVector3 v1, GSVector3 v2, GSVector3 v3);
|
||||
GSDECL void GSMathInvert4x4(GSMatrix4x4 out, GSMatrix4x4 in);
|
||||
GSDECL GSNumber GSMathCot(GSNumber x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
19
engine/include/GearSrc/Resource.h
Normal file
19
engine/include/GearSrc/Resource.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __GEARBOX_RESOURCE_H__
|
||||
#define __GEARBOX_RESOURCE_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GSDECL GSResource GSResourceOpen(GSEngine engine, const char* path);
|
||||
GSDECL void* GSResourceGet(GSResource resource, const char* name, unsigned int* size);
|
||||
GSDECL void GSResourceClose(GSResource resource);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
19
engine/include/GearSrc/Server.h
Normal file
19
engine/include/GearSrc/Server.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __GEARBOX_SERVER_H__
|
||||
#define __GEARBOX_SERVER_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GSDECL GSServer GSServerCreate(GSEngine engine);
|
||||
GSDECL void GSServerDestroy(GSServer server);
|
||||
GSDECL void GSServerStep(GSServer server);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
19
engine/include/GearSrc/SkyBox.h
Normal file
19
engine/include/GearSrc/SkyBox.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __GEARBOX_SKYBOX_H__
|
||||
#define __GEARBOX_SKYBOX_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GSDECL GSSkyBox GSSkyBoxOpen(GSClient client, const char* base);
|
||||
GSDECL void GSSkyBoxDraw(GSSkyBox skybox);
|
||||
GSDECL void GSSkyBoxClose(GSSkyBox skybox);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
18
engine/include/GearSrc/String.h
Normal file
18
engine/include/GearSrc/String.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef __GEARBOX_STRING_H__
|
||||
#define __GEARBOX_STRING_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GSDECL char* GSStringDuplicate(const char* str);
|
||||
GSDECL char* GSStringConcat(const char* str1, const char* str2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
155
engine/include/GearSrc/TypeDefs.h
Normal file
155
engine/include/GearSrc/TypeDefs.h
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
#ifndef __GEARBOX_TYPEDEFS_H__
|
||||
#define __GEARBOX_TYPEDEFS_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
||||
typedef __int8_t GSI8;
|
||||
typedef __int16_t GSI16;
|
||||
typedef __int32_t GSI32;
|
||||
typedef __int64_t GSI64;
|
||||
|
||||
typedef unsigned __int8_t GSU8;
|
||||
typedef unsigned __int16_t GSU16;
|
||||
typedef unsigned __int32_t GSU32;
|
||||
typedef unsigned __int64_t GSU64;
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int8_t GSI8;
|
||||
typedef int16_t GSI16;
|
||||
typedef int32_t GSI32;
|
||||
typedef int64_t GSI64;
|
||||
|
||||
typedef uint8_t GSU8;
|
||||
typedef uint16_t GSU16;
|
||||
typedef uint32_t GSU32;
|
||||
typedef uint64_t GSU64;
|
||||
#else
|
||||
typedef signed char GSI8;
|
||||
typedef short GSI16;
|
||||
typedef int GSI32;
|
||||
typedef long GSI64;
|
||||
|
||||
typedef unsigned char GSU8;
|
||||
typedef unsigned short GSU16;
|
||||
typedef unsigned int GSU32;
|
||||
typedef unsigned long GSU64;
|
||||
#endif
|
||||
|
||||
typedef struct _GSVersion GSVersion;
|
||||
typedef struct _GSEngineParam GSEngineParam;
|
||||
typedef struct _GSResourceKV GSResourceKV;
|
||||
#ifdef _GEARBOX
|
||||
typedef struct _GSClient* GSClient;
|
||||
typedef struct _GSServer* GSServer;
|
||||
typedef struct _GSEngine* GSEngine;
|
||||
typedef struct _GSFile* GSFile;
|
||||
typedef struct _GSResource* GSResource;
|
||||
typedef struct _GSGL* GSGL;
|
||||
typedef struct _GSSkyBox* GSSkyBox;
|
||||
#else
|
||||
typedef void* GSClient;
|
||||
typedef void* GSServer;
|
||||
typedef void* GSEngine;
|
||||
typedef void* GSFile;
|
||||
typedef void* GSResource;
|
||||
typedef void* GSGL;
|
||||
typedef void* GSSkyBox;
|
||||
#endif
|
||||
typedef float GSNumber;
|
||||
typedef GSNumber GSVector2[2];
|
||||
typedef GSNumber GSVector3[3];
|
||||
typedef GSNumber GSVector4[4];
|
||||
typedef GSNumber GSMatrix4x4[16];
|
||||
|
||||
typedef void (*GSGLSwapBufferCallback)(void);
|
||||
typedef void (*GSReadyCallback)(int width, int height);
|
||||
typedef void (*GSTickCallback)(void);
|
||||
typedef long (*GSGetTickCallback)(void);
|
||||
typedef void (*GSSleepCallback)(int ms);
|
||||
|
||||
struct _GSResourceKV {
|
||||
char* key;
|
||||
GSResource value;
|
||||
};
|
||||
|
||||
#ifdef _GEARBOX
|
||||
#include <GearSrc/GL/GL.h>
|
||||
|
||||
struct _GSGL {
|
||||
GSEngine engine;
|
||||
|
||||
int shadow_use_shader;
|
||||
GLuint shadow_texture;
|
||||
GLuint shadow_shader;
|
||||
GLdouble shadow_modelview[16];
|
||||
GLdouble shadow_projection[16];
|
||||
GLdouble shadow_old_projection[16];
|
||||
GLdouble shadow_old_modelview[16];
|
||||
};
|
||||
|
||||
struct _GSClient {
|
||||
GSEngine engine;
|
||||
|
||||
GSGL gl;
|
||||
GSVector3 look_at;
|
||||
GSVector3 camera;
|
||||
GSVector4 light0;
|
||||
GSSkyBox skybox;
|
||||
};
|
||||
|
||||
struct _GSSkyBox {
|
||||
GSEngine engine;
|
||||
|
||||
GLuint left;
|
||||
GLuint right;
|
||||
GLuint front;
|
||||
GLuint back;
|
||||
GLuint up;
|
||||
GLuint down;
|
||||
};
|
||||
|
||||
struct _GSServer {
|
||||
GSEngine engine;
|
||||
};
|
||||
|
||||
struct _GSEngine {
|
||||
GSEngineParam* param;
|
||||
GSClient client;
|
||||
GSServer server;
|
||||
GSResourceKV* resource;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
struct _GSFile {
|
||||
FILE* fp;
|
||||
unsigned char* data;
|
||||
unsigned int size;
|
||||
unsigned int seek;
|
||||
};
|
||||
|
||||
struct _GSResource {
|
||||
GSFile file;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct _GSVersion {
|
||||
char string[64];
|
||||
int majorlevel;
|
||||
int minorlevel;
|
||||
int patchlevel;
|
||||
};
|
||||
|
||||
struct _GSEngineParam {
|
||||
int client;
|
||||
int server;
|
||||
GSGLSwapBufferCallback gl_swapbuffer;
|
||||
GSReadyCallback ready;
|
||||
GSTickCallback tick;
|
||||
GSGetTickCallback get_tick;
|
||||
GSSleepCallback sleep;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef __GEARBOX_VERSION_H__
|
||||
#define __GEARBOX_VERSION_H__
|
||||
|
||||
#include <GearBox/MachDep.h>
|
||||
#include <GearBox/TypeDefs.h>
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GBDECL void GBVersionGet(GBVersion* version);
|
||||
GSDECL void GSVersionGet(GSVersion* version);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
#include <GearBox/Client.h>
|
||||
#include <GearSrc/Client.h>
|
||||
|
||||
#include <GearBox/Log.h>
|
||||
#include <GearBox/GL.h>
|
||||
#include <GearBox/SkyBox.h>
|
||||
#include <GearBox/Math.h>
|
||||
#include <GearSrc/Log.h>
|
||||
#include <GearSrc/GL.h>
|
||||
#include <GearSrc/SkyBox.h>
|
||||
#include <GearSrc/Math.h>
|
||||
|
||||
GBClient GBClientCreate(GBEngine engine) {
|
||||
GBClient client = malloc(sizeof(*client));
|
||||
GSClient GSClientCreate(GSEngine engine) {
|
||||
GSClient client = malloc(sizeof(*client));
|
||||
|
||||
memset(client, 0, sizeof(*client));
|
||||
|
||||
|
|
@ -25,39 +25,39 @@ GBClient GBClientCreate(GBEngine engine) {
|
|||
client->light0[2] = 5;
|
||||
client->light0[3] = 1;
|
||||
|
||||
client->gl = GBGLCreate(client);
|
||||
client->gl = GSGLCreate(client);
|
||||
|
||||
client->skybox = GBSkyBoxOpen(client, "base:/skybox");
|
||||
client->skybox = GSSkyBoxOpen(client, "base:/skybox");
|
||||
|
||||
GBLog(GBLogInfo, "Created client");
|
||||
GSLog(GSLogInfo, "Created client");
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
void GBClientDestroy(GBClient client) {
|
||||
GBGLDestroy(client->gl);
|
||||
void GSClientDestroy(GSClient client) {
|
||||
GSGLDestroy(client->gl);
|
||||
|
||||
free(client);
|
||||
|
||||
GBLog(GBLogInfo, "Destroyed client");
|
||||
GSLog(GSLogInfo, "Destroyed client");
|
||||
}
|
||||
|
||||
static void scene(GBClient client) {
|
||||
static void scene(GSClient client) {
|
||||
}
|
||||
|
||||
void GBClientStep(GBClient client) {
|
||||
GBGLClear(client->gl);
|
||||
GBGLCameraSetup(client->gl);
|
||||
GBGLSetLight(client->gl);
|
||||
void GSClientStep(GSClient client) {
|
||||
GSGLClear(client->gl);
|
||||
GSGLCameraSetup(client->gl);
|
||||
GSGLSetLight(client->gl);
|
||||
|
||||
if(GBGLShadowBeforeMapping(client->gl)) {
|
||||
if(GSGLShadowBeforeMapping(client->gl)) {
|
||||
scene(client);
|
||||
GBGLShadowAfterMapping(client->gl);
|
||||
GSGLShadowAfterMapping(client->gl);
|
||||
}
|
||||
|
||||
if(client->skybox != NULL) GBSkyBoxDraw(client->skybox);
|
||||
if(client->skybox != NULL) GSSkyBoxDraw(client->skybox);
|
||||
scene(client);
|
||||
GBGLShadowEnd(client->gl);
|
||||
GSGLShadowEnd(client->gl);
|
||||
|
||||
client->engine->param->gl_swapbuffer();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
#include <GearBox/Core.h>
|
||||
#include <GearSrc/Core.h>
|
||||
|
||||
#include <GearBox/Version.h>
|
||||
#include <GearBox/Log.h>
|
||||
#include <GearBox/Client.h>
|
||||
#include <GearBox/Server.h>
|
||||
#include <GearBox/GL.h>
|
||||
#include <GearBox/Resource.h>
|
||||
#include <GearSrc/Version.h>
|
||||
#include <GearSrc/Log.h>
|
||||
#include <GearSrc/Client.h>
|
||||
#include <GearSrc/Server.h>
|
||||
#include <GearSrc/GL.h>
|
||||
#include <GearSrc/Resource.h>
|
||||
|
||||
#include <stb_ds.h>
|
||||
|
||||
void GBInit(void) {
|
||||
GBVersion version;
|
||||
void GSInit(void) {
|
||||
GSVersion version;
|
||||
|
||||
GBVersionGet(&version);
|
||||
GSVersionGet(&version);
|
||||
|
||||
GBLog(GBLogInfo, "GearBox Engine %s", version.string);
|
||||
GSLog(GSLogInfo, "GearSrc Engine %s", version.string);
|
||||
|
||||
gload_init();
|
||||
}
|
||||
|
||||
int GBEngineRegisterResource(GBEngine engine, const char* name, const char* path) {
|
||||
GBResource resource;
|
||||
if((resource = GBResourceOpen(engine, path)) != NULL) {
|
||||
int GSEngineRegisterResource(GSEngine engine, const char* name, const char* path) {
|
||||
GSResource resource;
|
||||
if((resource = GSResourceOpen(engine, path)) != NULL) {
|
||||
shput(engine->resource, name, resource);
|
||||
|
||||
return 1;
|
||||
|
|
@ -30,8 +30,8 @@ int GBEngineRegisterResource(GBEngine engine, const char* name, const char* path
|
|||
return 0;
|
||||
}
|
||||
|
||||
GBEngine GBEngineCreate(GBEngineParam* param) {
|
||||
GBEngine engine = malloc(sizeof(*engine));
|
||||
GSEngine GSEngineCreate(GSEngineParam* param) {
|
||||
GSEngine engine = malloc(sizeof(*engine));
|
||||
|
||||
memset(engine, 0, sizeof(*engine));
|
||||
|
||||
|
|
@ -47,47 +47,47 @@ GBEngine GBEngineCreate(GBEngineParam* param) {
|
|||
|
||||
sh_new_strdup(engine->resource);
|
||||
|
||||
GBEngineRegisterResource(engine, "base", "base.pak");
|
||||
GBEngineRegisterResource(engine, "game", "game.pak");
|
||||
GSEngineRegisterResource(engine, "base", "base.pak");
|
||||
GSEngineRegisterResource(engine, "game", "game.pak");
|
||||
|
||||
if(engine != NULL && param->client && (engine->client = GBClientCreate(engine)) == NULL) {
|
||||
GBLog(GBLogError, "Failed to create client");
|
||||
if(engine != NULL && param->client && (engine->client = GSClientCreate(engine)) == NULL) {
|
||||
GSLog(GSLogError, "Failed to create client");
|
||||
|
||||
GBEngineDestroy(engine);
|
||||
GSEngineDestroy(engine);
|
||||
|
||||
engine = NULL;
|
||||
}
|
||||
|
||||
if(engine != NULL && param->server && (engine->server = GBServerCreate(engine)) == NULL) {
|
||||
GBLog(GBLogError, "Failed to create server");
|
||||
if(engine != NULL && param->server && (engine->server = GSServerCreate(engine)) == NULL) {
|
||||
GSLog(GSLogError, "Failed to create server");
|
||||
|
||||
GBEngineDestroy(engine);
|
||||
GSEngineDestroy(engine);
|
||||
|
||||
engine = NULL;
|
||||
}
|
||||
|
||||
if(engine == NULL) {
|
||||
GBLog(GBLogError, "Failed to create engine");
|
||||
GSLog(GSLogError, "Failed to create engine");
|
||||
}
|
||||
|
||||
return engine;
|
||||
}
|
||||
|
||||
void GBEngineDestroy(GBEngine engine) {
|
||||
void GSEngineDestroy(GSEngine engine) {
|
||||
int i;
|
||||
for(i = 0; i < shlen(engine->resource); i++) {
|
||||
GBResourceClose(engine->resource[i].value);
|
||||
GSResourceClose(engine->resource[i].value);
|
||||
}
|
||||
shfree(engine->resource);
|
||||
|
||||
if(engine->server != NULL) GBServerDestroy(engine->server);
|
||||
if(engine->client != NULL) GBClientDestroy(engine->client);
|
||||
if(engine->server != NULL) GSServerDestroy(engine->server);
|
||||
if(engine->client != NULL) GSClientDestroy(engine->client);
|
||||
if(engine->param != NULL) free(engine->param);
|
||||
|
||||
free(engine);
|
||||
}
|
||||
|
||||
void GBEngineParamInit(GBEngineParam* param) {
|
||||
void GSEngineParamInit(GSEngineParam* param) {
|
||||
memset(param, 0, sizeof(*param));
|
||||
|
||||
param->server = 0;
|
||||
|
|
@ -98,15 +98,15 @@ void GBEngineParamInit(GBEngineParam* param) {
|
|||
param->get_tick = NULL;
|
||||
}
|
||||
|
||||
void GBEngineLoop(GBEngine engine) {
|
||||
void GSEngineLoop(GSEngine engine) {
|
||||
long t = 0;
|
||||
int wait_actually = 0;
|
||||
int more = 0;
|
||||
long wait = 1000 / 50.0;
|
||||
|
||||
if(engine->param->sleep == NULL || engine->param->get_tick == NULL) {
|
||||
GBLog(GBLogWarn, "sleep and/or get_tick parameter are missing!");
|
||||
GBLog(GBLogWarn, "This will result game to be crazy fast!!!");
|
||||
GSLog(GSLogWarn, "sleep and/or get_tick parameter are missing!");
|
||||
GSLog(GSLogWarn, "This will result game to be crazy fast!!!");
|
||||
} else {
|
||||
t = engine->param->get_tick();
|
||||
|
||||
|
|
@ -114,8 +114,8 @@ void GBEngineLoop(GBEngine engine) {
|
|||
}
|
||||
|
||||
while(1) {
|
||||
if(engine->client != NULL) GBClientStep(engine->client);
|
||||
if(engine->server != NULL) GBServerStep(engine->server);
|
||||
if(engine->client != NULL) GSClientStep(engine->client);
|
||||
if(engine->server != NULL) GSServerStep(engine->server);
|
||||
|
||||
if(engine->param->tick != NULL) engine->param->tick();
|
||||
|
||||
|
|
@ -134,10 +134,10 @@ void GBEngineLoop(GBEngine engine) {
|
|||
}
|
||||
}
|
||||
|
||||
GBClient GBEngineGetClient(GBEngine engine) {
|
||||
GSClient GSEngineGetClient(GSEngine engine) {
|
||||
return engine->client;
|
||||
}
|
||||
|
||||
GBServer GBEngineGetServer(GBEngine engine) {
|
||||
GSServer GSEngineGetServer(GSEngine engine) {
|
||||
return engine->server;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include <GearBox/Endian.h>
|
||||
#include <GearSrc/Endian.h>
|
||||
|
||||
#ifdef GBEndianHostLittle
|
||||
#ifdef GSEndianHostLittle
|
||||
static void swap(void* from, void* to, int size) {
|
||||
unsigned char* f = from;
|
||||
unsigned char* t = to;
|
||||
|
|
@ -14,48 +14,48 @@ static void swap(void* from, void* to, int size) {
|
|||
|
||||
#define SWAP(in, out) swap(&in, &out, sizeof(in))
|
||||
|
||||
GBI16 GBEndianSwapI16BE(GBI16 in) {
|
||||
GBI16 out;
|
||||
GSI16 GSEndianSwapI16BE(GSI16 in) {
|
||||
GSI16 out;
|
||||
|
||||
SWAP(in, out);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
GBI32 GBEndianSwapI32BE(GBI32 in) {
|
||||
GBI32 out;
|
||||
GSI32 GSEndianSwapI32BE(GSI32 in) {
|
||||
GSI32 out;
|
||||
|
||||
SWAP(in, out);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
GBI64 GBEndianSwapI64BE(GBI64 in) {
|
||||
GBI64 out;
|
||||
GSI64 GSEndianSwapI64BE(GSI64 in) {
|
||||
GSI64 out;
|
||||
|
||||
SWAP(in, out);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
GBU16 GBEndianSwapU16BE(GBU16 in) {
|
||||
GBU16 out;
|
||||
GSU16 GSEndianSwapU16BE(GSU16 in) {
|
||||
GSU16 out;
|
||||
|
||||
SWAP(in, out);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
GBU32 GBEndianSwapU32BE(GBU32 in) {
|
||||
GBU32 out;
|
||||
GSU32 GSEndianSwapU32BE(GSU32 in) {
|
||||
GSU32 out;
|
||||
|
||||
SWAP(in, out);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
GBU64 GBEndianSwapU64BE(GBU64 in) {
|
||||
GBU64 out;
|
||||
GSU64 GSEndianSwapU64BE(GSU64 in) {
|
||||
GSU64 out;
|
||||
|
||||
SWAP(in, out);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include <GearBox/File.h>
|
||||
#include <GearSrc/File.h>
|
||||
|
||||
#include <GearBox/String.h>
|
||||
#include <GearBox/Log.h>
|
||||
#include <GearBox/Resource.h>
|
||||
#include <GearSrc/String.h>
|
||||
#include <GearSrc/Log.h>
|
||||
#include <GearSrc/Resource.h>
|
||||
|
||||
#include <stb_ds.h>
|
||||
|
||||
GBFile GBFileOpen(GBEngine engine, const char* path) {
|
||||
GBFile file = malloc(sizeof(*file));
|
||||
GSFile GSFileOpen(GSEngine engine, const char* path) {
|
||||
GSFile file = malloc(sizeof(*file));
|
||||
char* s;
|
||||
char* nam;
|
||||
|
||||
|
|
@ -20,12 +20,12 @@ GBFile GBFileOpen(GBEngine engine, const char* path) {
|
|||
file->size = ftell(file->fp);
|
||||
fseek(file->fp, 0, SEEK_SET);
|
||||
|
||||
GBLog(GBLogInfo, "Opened %s", path);
|
||||
GSLog(GSLogInfo, "Opened %s", path);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
s = GBStringDuplicate(path);
|
||||
s = GSStringDuplicate(path);
|
||||
if(engine != NULL && ((nam = strstr(s, ":/")) != NULL || (nam = strstr(s, ":\\")) != NULL)) {
|
||||
int i;
|
||||
|
||||
|
|
@ -35,10 +35,10 @@ GBFile GBFileOpen(GBEngine engine, const char* path) {
|
|||
|
||||
for(i = 0; i < shlen(engine->resource); i++) {
|
||||
if(strcmp(engine->resource[i].key, s) == 0) {
|
||||
if((file->data = GBResourceGet(engine->resource[i].value, nam, &file->size)) != NULL) {
|
||||
if((file->data = GSResourceGet(engine->resource[i].value, nam, &file->size)) != NULL) {
|
||||
free(s);
|
||||
|
||||
GBLog(GBLogInfo, "Opened %s", path);
|
||||
GSLog(GSLogInfo, "Opened %s", path);
|
||||
return file;
|
||||
}
|
||||
break;
|
||||
|
|
@ -47,12 +47,12 @@ GBFile GBFileOpen(GBEngine engine, const char* path) {
|
|||
}
|
||||
free(s);
|
||||
|
||||
GBLog(GBLogError, "Could not open %s", path);
|
||||
GBFileClose(file);
|
||||
GSLog(GSLogError, "Could not open %s", path);
|
||||
GSFileClose(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int GBFileRead(GBFile file, void* out, int size) {
|
||||
int GSFileRead(GSFile file, void* out, int size) {
|
||||
if(file->fp != NULL) return fread(out, 1, size, file->fp);
|
||||
if(file->data != NULL) {
|
||||
int len = 0;
|
||||
|
|
@ -69,16 +69,16 @@ int GBFileRead(GBFile file, void* out, int size) {
|
|||
}
|
||||
}
|
||||
|
||||
void GBFileSeek(GBFile file, int pos) {
|
||||
void GSFileSeek(GSFile file, int pos) {
|
||||
if(file->fp != NULL) fseek(file->fp, pos, SEEK_SET);
|
||||
file->seek = pos;
|
||||
}
|
||||
|
||||
unsigned int GBFileSize(GBFile file) {
|
||||
unsigned int GSFileSize(GSFile file) {
|
||||
return file->size;
|
||||
}
|
||||
|
||||
void GBFileClose(GBFile file) {
|
||||
void GSFileClose(GSFile file) {
|
||||
if(file->fp != NULL) fclose(file->fp);
|
||||
if(file->data != NULL) free(file->data);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#include <GearBox/GL.h>
|
||||
#include <GearSrc/GL.h>
|
||||
|
||||
GBGL GBGLCreate(GBClient client) {
|
||||
GSGL GSGLCreate(GSClient client) {
|
||||
GLfloat lightamb[] = {0.5, 0.5, 0.5, 1.0};
|
||||
GLfloat lightcol[] = {1.0, 1.0, 1.0, 1.0};
|
||||
GBGL gl;
|
||||
GSGL gl;
|
||||
|
||||
gl = malloc(sizeof(*client->gl));
|
||||
|
||||
|
|
@ -29,30 +29,30 @@ GBGL GBGLCreate(GBClient client) {
|
|||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GBGLShadowInit(gl);
|
||||
GSGLShadowInit(gl);
|
||||
|
||||
return gl;
|
||||
}
|
||||
|
||||
void GBGLDestroy(GBGL gl) {
|
||||
GBGLShadowDeinit(gl);
|
||||
void GSGLDestroy(GSGL gl) {
|
||||
GSGLShadowDeinit(gl);
|
||||
|
||||
free(gl);
|
||||
}
|
||||
|
||||
void GBGLClear(GBGL gl) {
|
||||
void GSGLClear(GSGL gl) {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void GBGLIgnoreDepth(GBGL gl) {
|
||||
void GSGLIgnoreDepth(GSGL gl) {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
void GBGLCareDepth(GBGL gl) {
|
||||
void GSGLCareDepth(GSGL gl) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
void GBGLSetLight(GBGL gl) {
|
||||
void GSGLSetLight(GSGL gl) {
|
||||
GLfloat f[4];
|
||||
int i;
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ void GBGLSetLight(GBGL gl) {
|
|||
glLightfv(GL_LIGHT0, GL_POSITION, f);
|
||||
}
|
||||
|
||||
void GBGLPolygon(GBGL gl, int pairs, GBVector3* vert, GBVector2* tex) {
|
||||
void GSGLPolygon(GSGL gl, int pairs, GSVector3* vert, GSVector2* tex) {
|
||||
int i;
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
#include <GearBox/GL.h>
|
||||
#include <GearSrc/GL.h>
|
||||
|
||||
#include <GearBox/Math.h>
|
||||
#include <GearSrc/Math.h>
|
||||
|
||||
void GBGLCameraPerspective(GBGL gl, GBNumber width, GBNumber height) {
|
||||
GBNumber aspect;
|
||||
GBNumber f;
|
||||
void GSGLCameraPerspective(GSGL gl, GSNumber width, GSNumber height) {
|
||||
GSNumber aspect;
|
||||
GSNumber f;
|
||||
GLdouble matrix[16];
|
||||
int i;
|
||||
GBNumber fovy = 60.0;
|
||||
GBNumber znear = 0.01;
|
||||
GBNumber zfar = GBGLMaxDistance;
|
||||
GSNumber fovy = 60.0;
|
||||
GSNumber znear = 0.01;
|
||||
GSNumber zfar = GSGLMaxDistance;
|
||||
|
||||
aspect = width / height;
|
||||
f = GBMathCot(fovy / 180 * GBMathPi / 2);
|
||||
f = GSMathCot(fovy / 180 * GSMathPi / 2);
|
||||
|
||||
for(i = 0; i < 16; i++) matrix[i] = 0;
|
||||
matrix[4 * 0 + 0] = f / aspect;
|
||||
|
|
@ -24,30 +24,30 @@ void GBGLCameraPerspective(GBGL gl, GBNumber width, GBNumber height) {
|
|||
glMultMatrixd(matrix);
|
||||
}
|
||||
|
||||
void GBGLCameraSet(GBGL gl) {
|
||||
GBGLCameraLookAt(gl, gl->engine->client->camera, gl->engine->client->look_at);
|
||||
void GSGLCameraSet(GSGL gl) {
|
||||
GSGLCameraLookAt(gl, gl->engine->client->camera, gl->engine->client->look_at);
|
||||
}
|
||||
|
||||
void GBGLCameraLookAt(GBGL gl, GBVector3 camera, GBVector3 look_at) {
|
||||
void GSGLCameraLookAt(GSGL gl, GSVector3 camera, GSVector3 look_at) {
|
||||
GLdouble matrix[16];
|
||||
GBVector3 f;
|
||||
GBVector3 up;
|
||||
GBVector3 s;
|
||||
GBVector3 u;
|
||||
GSVector3 f;
|
||||
GSVector3 up;
|
||||
GSVector3 s;
|
||||
GSVector3 u;
|
||||
int i;
|
||||
|
||||
GBMathSubtract3(f, look_at, camera);
|
||||
GBMathNormalize3(f);
|
||||
GSMathSubtract3(f, look_at, camera);
|
||||
GSMathNormalize3(f);
|
||||
|
||||
up[0] = 0;
|
||||
up[1] = 1;
|
||||
up[2] = 0;
|
||||
GBMathNormalize3(up);
|
||||
GSMathNormalize3(up);
|
||||
|
||||
GBMathCross3(s, f, up);
|
||||
GBMathNormalize3(s);
|
||||
GSMathCross3(s, f, up);
|
||||
GSMathNormalize3(s);
|
||||
|
||||
GBMathCross3(u, s, f);
|
||||
GSMathCross3(u, s, f);
|
||||
|
||||
for(i = 0; i < 16; i++) matrix[i] = 0;
|
||||
matrix[4 * 0 + 0] = s[0];
|
||||
|
|
@ -65,12 +65,12 @@ void GBGLCameraLookAt(GBGL gl, GBVector3 camera, GBVector3 look_at) {
|
|||
glTranslated(-camera[0], -camera[1], -camera[2]);
|
||||
}
|
||||
|
||||
void GBGLCameraSetup(GBGL gl) {
|
||||
void GSGLCameraSetup(GSGL gl) {
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
GBGLCameraPerspective(gl, gl->engine->width, gl->engine->height);
|
||||
GSGLCameraPerspective(gl, gl->engine->width, gl->engine->height);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
GBGLCameraSet(gl);
|
||||
GSGLCameraSet(gl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <GearBox/GL.h>
|
||||
#include <GearSrc/GL.h>
|
||||
|
||||
#include <GearBox/File.h>
|
||||
#include <GearBox/Log.h>
|
||||
#include <GearSrc/File.h>
|
||||
#include <GearSrc/Log.h>
|
||||
|
||||
static void err(const char* path, GLuint shader) {
|
||||
GLint len, ret;
|
||||
|
|
@ -14,41 +14,41 @@ static void err(const char* path, GLuint shader) {
|
|||
|
||||
glGetShaderInfoLog(shader, len, &ret, e);
|
||||
|
||||
GBLog(GBLogError, "%s: %s\n", path, e);
|
||||
GSLog(GSLogError, "%s: %s\n", path, e);
|
||||
|
||||
free(e);
|
||||
}
|
||||
|
||||
int GBGLShaderPrepare(GBGL gl, GLuint* shader, const char* vs, const char* fs) {
|
||||
int GSGLShaderPrepare(GSGL gl, GLuint* shader, const char* vs, const char* fs) {
|
||||
GLuint vsi;
|
||||
GLuint fsi;
|
||||
GBFile f;
|
||||
GSFile f;
|
||||
int vsl = 0;
|
||||
int fsl = 0;
|
||||
char* vss;
|
||||
char* fss;
|
||||
GLint st;
|
||||
|
||||
if((f = GBFileOpen(gl->engine, vs)) != NULL) {
|
||||
int sz = GBFileSize(f);
|
||||
if((f = GSFileOpen(gl->engine, vs)) != NULL) {
|
||||
int sz = GSFileSize(f);
|
||||
|
||||
vss = malloc(sz + 1);
|
||||
GBFileRead(f, vss, sz);
|
||||
GSFileRead(f, vss, sz);
|
||||
vss[sz] = 0;
|
||||
|
||||
GBFileClose(f);
|
||||
GSFileClose(f);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((f = GBFileOpen(gl->engine, fs)) != NULL) {
|
||||
int sz = GBFileSize(f);
|
||||
if((f = GSFileOpen(gl->engine, fs)) != NULL) {
|
||||
int sz = GSFileSize(f);
|
||||
|
||||
fss = malloc(sz + 1);
|
||||
GBFileRead(f, fss, sz);
|
||||
GSFileRead(f, fss, sz);
|
||||
fss[sz] = 0;
|
||||
|
||||
GBFileClose(f);
|
||||
GSFileClose(f);
|
||||
} else {
|
||||
free(vss);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#include <GearBox/GL.h>
|
||||
#include <GearSrc/GL.h>
|
||||
|
||||
#include <GearBox/Math.h>
|
||||
#include <GearSrc/Math.h>
|
||||
|
||||
#define SHADOW_WIDTH 512
|
||||
#define SHADOW_HEIGHT 512
|
||||
#define SHADOW_CULL
|
||||
|
||||
void GBGLShadowInit(GBGL gl) {
|
||||
void GSGLShadowInit(GSGL gl) {
|
||||
glGenTextures(1, &gl->shadow_texture);
|
||||
glBindTexture(GL_TEXTURE_2D, gl->shadow_texture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);
|
||||
|
|
@ -25,7 +25,7 @@ void GBGLShadowInit(GBGL gl) {
|
|||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
if(GBGLShaderPrepare(gl, &gl->shadow_shader, "base:/shader/shadow.vs", "base:/shader/shadow.fs")) {
|
||||
if(GSGLShaderPrepare(gl, &gl->shadow_shader, "base:/shader/shadow.vs", "base:/shader/shadow.fs")) {
|
||||
glUseProgram(gl->shadow_shader);
|
||||
glUniform1i(glGetUniformLocation(gl->shadow_shader, "depth_texture"), 7);
|
||||
glUniform1i(glGetUniformLocation(gl->shadow_shader, "current_texture"), 0);
|
||||
|
|
@ -40,26 +40,26 @@ void GBGLShadowInit(GBGL gl) {
|
|||
}
|
||||
}
|
||||
|
||||
int GBGLShadowBeforeMapping(GBGL gl) {
|
||||
GBVector3 zero = {0, 0, 0};
|
||||
int GSGLShadowBeforeMapping(GSGL gl) {
|
||||
GSVector3 zero = {0, 0, 0};
|
||||
|
||||
if(!gl->shadow_use_shader) return 0;
|
||||
|
||||
GBGLClear(gl);
|
||||
GSGLClear(gl);
|
||||
|
||||
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glGetDoublev(GL_PROJECTION_MATRIX, gl->shadow_old_projection);
|
||||
glLoadIdentity();
|
||||
GBGLCameraPerspective(gl, SHADOW_WIDTH, SHADOW_HEIGHT);
|
||||
GSGLCameraPerspective(gl, SHADOW_WIDTH, SHADOW_HEIGHT);
|
||||
|
||||
glGetDoublev(GL_PROJECTION_MATRIX, gl->shadow_projection);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glGetDoublev(GL_MODELVIEW_MATRIX, gl->shadow_old_modelview);
|
||||
glLoadIdentity();
|
||||
GBGLCameraLookAt(gl, gl->engine->client->light0, zero);
|
||||
GSGLCameraLookAt(gl, gl->engine->client->light0, zero);
|
||||
|
||||
glGetDoublev(GL_MODELVIEW_MATRIX, gl->shadow_modelview);
|
||||
|
||||
|
|
@ -79,8 +79,8 @@ int GBGLShadowBeforeMapping(GBGL gl) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
void GBGLShadowAfterMapping(GBGL gl) {
|
||||
GBMatrix4x4 in, out;
|
||||
void GSGLShadowAfterMapping(GSGL gl) {
|
||||
GSMatrix4x4 in, out;
|
||||
GLdouble mat[16];
|
||||
int i;
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ void GBGLShadowAfterMapping(GBGL gl) {
|
|||
glLoadIdentity();
|
||||
|
||||
for(i = 0; i < 16; i++) in[i] = gl->shadow_old_modelview[i];
|
||||
GBMathInvert4x4(out, in);
|
||||
GSMathInvert4x4(out, in);
|
||||
for(i = 0; i < 16; i++) mat[i] = out[i];
|
||||
|
||||
glTranslated(0.5, 0.5, 0.5);
|
||||
|
|
@ -126,12 +126,12 @@ void GBGLShadowAfterMapping(GBGL gl) {
|
|||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
GBGLClear(gl);
|
||||
GSGLClear(gl);
|
||||
|
||||
GBGLShadowEnable(gl);
|
||||
GSGLShadowEnable(gl);
|
||||
}
|
||||
|
||||
void GBGLShadowDisable(GBGL gl) {
|
||||
void GSGLShadowDisable(GSGL gl) {
|
||||
glDisable(GL_LIGHTING);
|
||||
if(gl->shadow_use_shader) {
|
||||
glUseProgram(0);
|
||||
|
|
@ -143,7 +143,7 @@ void GBGLShadowDisable(GBGL gl) {
|
|||
}
|
||||
}
|
||||
|
||||
void GBGLShadowEnable(GBGL gl) {
|
||||
void GSGLShadowEnable(GSGL gl) {
|
||||
glEnable(GL_LIGHTING);
|
||||
if(gl->shadow_use_shader) {
|
||||
glUseProgram(gl->shadow_shader);
|
||||
|
|
@ -155,10 +155,10 @@ void GBGLShadowEnable(GBGL gl) {
|
|||
}
|
||||
}
|
||||
|
||||
void GBGLShadowEnd(GBGL gl) {
|
||||
void GSGLShadowEnd(GSGL gl) {
|
||||
if(!gl->shadow_use_shader) return;
|
||||
|
||||
GBGLShadowDisable(gl);
|
||||
GSGLShadowDisable(gl);
|
||||
|
||||
glActiveTexture(GL_TEXTURE7);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
|
@ -173,7 +173,7 @@ void GBGLShadowEnd(GBGL gl) {
|
|||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
void GBGLShadowDeinit(GBGL gl) {
|
||||
void GSGLShadowDeinit(GSGL gl) {
|
||||
if(gl->shadow_use_shader) {
|
||||
glDeleteTextures(1, &gl->shadow_texture);
|
||||
glDeleteProgram(gl->shadow_shader);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#include <GearBox/GL.h>
|
||||
#include <GearSrc/GL.h>
|
||||
|
||||
#include <GearBox/File.h>
|
||||
#include <GearSrc/File.h>
|
||||
|
||||
#include <stb_image.h>
|
||||
|
||||
void GBGLTexturePrepare(GBGL gl, GLuint* texture, unsigned char* rgba, int width, int height) {
|
||||
void GSGLTexturePrepare(GSGL gl, GLuint* texture, unsigned char* rgba, int width, int height) {
|
||||
glGenTextures(1, texture);
|
||||
glBindTexture(GL_TEXTURE_2D, *texture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgba);
|
||||
|
|
@ -13,18 +13,18 @@ void GBGLTexturePrepare(GBGL gl, GLuint* texture, unsigned char* rgba, int width
|
|||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
void GBGLTextureEnable(GBGL gl, GLuint texture) {
|
||||
void GSGLTextureEnable(GSGL gl, GLuint texture) {
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void GBGLTextureDisable(GBGL gl, GLuint texture) {
|
||||
void GSGLTextureDisable(GSGL gl, GLuint texture) {
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
int GBGLTextureLoadFile(GBGL gl, GLuint* texture, int* width, int* height, const char* filename) {
|
||||
GBFile f = GBFileOpen(gl->engine, filename);
|
||||
int GSGLTextureLoadFile(GSGL gl, GLuint* texture, int* width, int* height, const char* filename) {
|
||||
GSFile f = GSFileOpen(gl->engine, filename);
|
||||
unsigned char* data;
|
||||
unsigned char* rgba;
|
||||
unsigned long sz;
|
||||
|
|
@ -33,16 +33,16 @@ int GBGLTextureLoadFile(GBGL gl, GLuint* texture, int* width, int* height, const
|
|||
int w, h;
|
||||
if(f == NULL) return 0;
|
||||
|
||||
sz = GBFileSize(f);
|
||||
sz = GSFileSize(f);
|
||||
|
||||
data = malloc(sz);
|
||||
GBFileRead(f, data, sz);
|
||||
GBFileClose(f);
|
||||
GSFileRead(f, data, sz);
|
||||
GSFileClose(f);
|
||||
|
||||
if((rgba = stbi_load_from_memory(data, sz, &w, &h, &ch, 4)) == NULL) {
|
||||
st = 0;
|
||||
} else {
|
||||
GBGLTexturePrepare(gl, texture, rgba, w, h);
|
||||
GSGLTexturePrepare(gl, texture, rgba, w, h);
|
||||
|
||||
free(rgba);
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ int GBGLTextureLoadFile(GBGL gl, GLuint* texture, int* width, int* height, const
|
|||
return st;
|
||||
}
|
||||
|
||||
void GBGLTextureSet(GBGL gl, GLuint texture) {
|
||||
void GSGLTextureSet(GSGL gl, GLuint texture) {
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
if(texture == 0) {
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
|
@ -64,6 +64,6 @@ void GBGLTextureSet(GBGL gl, GLuint texture) {
|
|||
}
|
||||
}
|
||||
|
||||
void GBGLTextureDelete(GBGL gl, GLuint texture) {
|
||||
void GSGLTextureDelete(GSGL gl, GLuint texture) {
|
||||
glDeleteTextures(1, &texture);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
#define GLOAD_IMPLEMENTATION
|
||||
#include <GearBox/GL/GL.h>
|
||||
#include <GearSrc/GL/GL.h>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
#include <GearBox/Log.h>
|
||||
#include <GearSrc/Log.h>
|
||||
|
||||
void GBLog(int level, const char* fmt, ...) {
|
||||
void GSLog(int level, const char* fmt, ...) {
|
||||
va_list va;
|
||||
FILE* out = stdout;
|
||||
|
||||
#ifdef _WIN32
|
||||
#else
|
||||
fprintf(out, "[\x1b[mGearBox\x1b[m|");
|
||||
fprintf(out, "[\x1b[mGearSrc\x1b[m|");
|
||||
|
||||
if(level == GBLogInfo) {
|
||||
if(level == GSLogInfo) {
|
||||
fprintf(out, "\x1b[1mINFO\x1b[m ");
|
||||
} else if(level == GBLogWarn) {
|
||||
} else if(level == GSLogWarn) {
|
||||
fprintf(out, "\x1b[1m\x1b[33mWARN\x1b[m ");
|
||||
} else if(level == GBLogError) {
|
||||
} else if(level == GSLogError) {
|
||||
fprintf(out, "\x1b[1m\x1b[31mERROR\x1b[m");
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include <GearBox/Math.h>
|
||||
#include <GearSrc/Math.h>
|
||||
|
||||
void GBMathCross3(GBVector3 r, GBVector3 v0, GBVector3 v1) {
|
||||
void GSMathCross3(GSVector3 r, GSVector3 v0, GSVector3 v1) {
|
||||
r[0] = v0[1] * v1[2] - v0[2] * v1[1];
|
||||
r[1] = v0[2] * v1[0] - v0[0] * v1[2];
|
||||
r[2] = v0[0] * v1[1] - v0[1] * v1[0];
|
||||
}
|
||||
|
||||
void GBMathNormalize3(GBVector3 vec) {
|
||||
GBNumber l = 0;
|
||||
void GSMathNormalize3(GSVector3 vec) {
|
||||
GSNumber l = 0;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 3; i++) l += vec[i] * vec[i];
|
||||
|
|
@ -15,7 +15,7 @@ void GBMathNormalize3(GBVector3 vec) {
|
|||
l = sqrt(l);
|
||||
|
||||
if(l > 0) {
|
||||
l = (GBNumber)1 / l;
|
||||
l = (GSNumber)1 / l;
|
||||
} else {
|
||||
l = 0;
|
||||
}
|
||||
|
|
@ -25,13 +25,13 @@ void GBMathNormalize3(GBVector3 vec) {
|
|||
vec[2] *= l;
|
||||
}
|
||||
|
||||
void GBMathSubtract3(GBVector3 r, GBVector3 v0, GBVector3 v1) {
|
||||
void GSMathSubtract3(GSVector3 r, GSVector3 v0, GSVector3 v1) {
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 3; i++) r[i] = v0[i] - v1[i];
|
||||
}
|
||||
|
||||
void GBMathAdd3(GBVector3 r, GBVector3 v0, GBVector3 v1) {
|
||||
void GSMathAdd3(GSVector3 r, GSVector3 v0, GSVector3 v1) {
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 3; i++) r[i] = v0[i] + v1[i];
|
||||
|
|
@ -42,15 +42,15 @@ void GBMathAdd3(GBVector3 r, GBVector3 v0, GBVector3 v1) {
|
|||
* | /
|
||||
* v1/
|
||||
*/
|
||||
void GBMathNormal3x3(GBVector3 r, GBVector3 v0, GBVector3 v1, GBVector3 v2) {
|
||||
GBVector3 t0, t1;
|
||||
void GSMathNormal3x3(GSVector3 r, GSVector3 v0, GSVector3 v1, GSVector3 v2) {
|
||||
GSVector3 t0, t1;
|
||||
|
||||
GBMathSubtract3(t0, v1, v0);
|
||||
GBMathSubtract3(t1, v2, v0);
|
||||
GSMathSubtract3(t0, v1, v0);
|
||||
GSMathSubtract3(t1, v2, v0);
|
||||
|
||||
GBMathCross3(r, t0, t1);
|
||||
GSMathCross3(r, t0, t1);
|
||||
|
||||
GBMathNormalize3(r);
|
||||
GSMathNormalize3(r);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -58,23 +58,23 @@ void GBMathNormal3x3(GBVector3 r, GBVector3 v0, GBVector3 v1, GBVector3 v2) {
|
|||
* | |
|
||||
* v1-v2
|
||||
*/
|
||||
void GBMathNormal3x4(GBVector3 r, GBVector3 v0, GBVector3 v1, GBVector3 v2, GBVector3 v3) {
|
||||
GBVector3 t0, t1;
|
||||
void GSMathNormal3x4(GSVector3 r, GSVector3 v0, GSVector3 v1, GSVector3 v2, GSVector3 v3) {
|
||||
GSVector3 t0, t1;
|
||||
|
||||
GBMathNormal3x3(t0, v0, v1, v3);
|
||||
GBMathNormal3x3(t1, v1, v2, v3);
|
||||
GSMathNormal3x3(t0, v0, v1, v3);
|
||||
GSMathNormal3x3(t1, v1, v2, v3);
|
||||
|
||||
GBMathAdd3(r, t0, t1);
|
||||
GSMathAdd3(r, t0, t1);
|
||||
|
||||
GBMathNormalize3(r);
|
||||
GSMathNormalize3(r);
|
||||
}
|
||||
|
||||
GBNumber GBMathCot(GBNumber x) {
|
||||
return (GBNumber)1 / tan(x);
|
||||
GSNumber GSMathCot(GSNumber x) {
|
||||
return (GSNumber)1 / tan(x);
|
||||
}
|
||||
|
||||
void GBMathInvert4x4(GBMatrix4x4 out, GBMatrix4x4 in) {
|
||||
GBNumber inv[16], det;
|
||||
void GSMathInvert4x4(GSMatrix4x4 out, GSMatrix4x4 in) {
|
||||
GSNumber inv[16], det;
|
||||
int i;
|
||||
|
||||
inv[0] = in[5] * in[10] * in[15] - in[5] * in[11] * in[14] - in[9] * in[6] * in[15] + in[9] * in[7] * in[14] + in[13] * in[6] * in[11] - in[13] * in[7] * in[10];
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#include <GearBox/Resource.h>
|
||||
#include <GearSrc/Resource.h>
|
||||
|
||||
#include <GearBox/File.h>
|
||||
#include <GearBox/Log.h>
|
||||
#include <GearBox/Endian.h>
|
||||
#include <GearSrc/File.h>
|
||||
#include <GearSrc/Log.h>
|
||||
#include <GearSrc/Endian.h>
|
||||
|
||||
#include <lz4.h>
|
||||
|
||||
|
|
@ -12,54 +12,54 @@ static unsigned char res_sig[4] = {
|
|||
'A',
|
||||
'K'};
|
||||
|
||||
GBResource GBResourceOpen(GBEngine engine, const char* path) {
|
||||
GBResource resource = malloc(sizeof(*resource));
|
||||
GSResource GSResourceOpen(GSEngine engine, const char* path) {
|
||||
GSResource resource = malloc(sizeof(*resource));
|
||||
unsigned char sig[4];
|
||||
|
||||
memset(resource, 0, sizeof(*resource));
|
||||
|
||||
if((resource->file = GBFileOpen(engine, path)) == NULL) {
|
||||
GBResourceClose(resource);
|
||||
if((resource->file = GSFileOpen(engine, path)) == NULL) {
|
||||
GSResourceClose(resource);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(GBFileRead(resource->file, sig, 4) < 4) {
|
||||
GBResourceClose(resource);
|
||||
if(GSFileRead(resource->file, sig, 4) < 4) {
|
||||
GSResourceClose(resource);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(memcmp(sig, res_sig, 4) != 0) {
|
||||
GBLog(GBLogError, "%s: Resource has wrong signature", path);
|
||||
GBResourceClose(resource);
|
||||
GSLog(GSLogError, "%s: Resource has wrong signature", path);
|
||||
GSResourceClose(resource);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void* GBResourceGet(GBResource resource, const char* name, unsigned int* size) {
|
||||
void* GSResourceGet(GSResource resource, const char* name, unsigned int* size) {
|
||||
char fn[129];
|
||||
|
||||
fn[128] = 0;
|
||||
|
||||
GBFileSeek(resource->file, 4);
|
||||
GSFileSeek(resource->file, 4);
|
||||
|
||||
while(!(GBFileRead(resource->file, fn, 128) < 128 || fn[0] == 0)) {
|
||||
GBU32 actsz = 0;
|
||||
GBU32 cmpsz = 0;
|
||||
while(!(GSFileRead(resource->file, fn, 128) < 128 || fn[0] == 0)) {
|
||||
GSU32 actsz = 0;
|
||||
GSU32 cmpsz = 0;
|
||||
int i;
|
||||
void* d;
|
||||
|
||||
if(GBFileRead(resource->file, &actsz, 4) < 4) return NULL;
|
||||
if(GBFileRead(resource->file, &cmpsz, 4) < 4) return NULL;
|
||||
if(GSFileRead(resource->file, &actsz, 4) < 4) return NULL;
|
||||
if(GSFileRead(resource->file, &cmpsz, 4) < 4) return NULL;
|
||||
|
||||
actsz = GBEndianSwapU32BE(actsz);
|
||||
cmpsz = GBEndianSwapU32BE(cmpsz);
|
||||
actsz = GSEndianSwapU32BE(actsz);
|
||||
cmpsz = GSEndianSwapU32BE(cmpsz);
|
||||
|
||||
*size = actsz;
|
||||
|
||||
d = malloc(cmpsz);
|
||||
if(GBFileRead(resource->file, d, cmpsz) < cmpsz) {
|
||||
if(GSFileRead(resource->file, d, cmpsz) < cmpsz) {
|
||||
free(d);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -78,8 +78,8 @@ void* GBResourceGet(GBResource resource, const char* name, unsigned int* size) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void GBResourceClose(GBResource resource) {
|
||||
if(resource->file != NULL) GBFileClose(resource->file);
|
||||
void GSResourceClose(GSResource resource) {
|
||||
if(resource->file != NULL) GSFileClose(resource->file);
|
||||
|
||||
free(resource);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
#include <GearBox/Server.h>
|
||||
#include <GearSrc/Server.h>
|
||||
|
||||
#include <GearBox/Log.h>
|
||||
#include <GearSrc/Log.h>
|
||||
|
||||
GBServer GBServerCreate(GBEngine engine) {
|
||||
GBServer server = malloc(sizeof(*server));
|
||||
GSServer GSServerCreate(GSEngine engine) {
|
||||
GSServer server = malloc(sizeof(*server));
|
||||
|
||||
memset(server, 0, sizeof(*server));
|
||||
|
||||
server->engine = engine;
|
||||
|
||||
GBLog(GBLogInfo, "Created server");
|
||||
GSLog(GSLogInfo, "Created server");
|
||||
|
||||
return server;
|
||||
}
|
||||
|
||||
void GBServerDestroy(GBServer server) {
|
||||
void GSServerDestroy(GSServer server) {
|
||||
free(server);
|
||||
|
||||
GBLog(GBLogInfo, "Destroyed server");
|
||||
GSLog(GSLogInfo, "Destroyed server");
|
||||
}
|
||||
|
||||
void GBServerStep(GBServer server) {
|
||||
void GSServerStep(GSServer server) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#include <GearBox/SkyBox.h>
|
||||
#include <GearSrc/SkyBox.h>
|
||||
|
||||
#include <GearBox/GL.h>
|
||||
#include <GearBox/String.h>
|
||||
#include <GearSrc/GL.h>
|
||||
#include <GearSrc/String.h>
|
||||
|
||||
GBSkyBox GBSkyBoxOpen(GBClient client, const char* base) {
|
||||
GBSkyBox skybox = malloc(sizeof(*skybox));
|
||||
GSSkyBox GSSkyBoxOpen(GSClient client, const char* base) {
|
||||
GSSkyBox skybox = malloc(sizeof(*skybox));
|
||||
char* p;
|
||||
void* ptr[12];
|
||||
int i;
|
||||
|
|
@ -27,10 +27,10 @@ GBSkyBox GBSkyBoxOpen(GBClient client, const char* base) {
|
|||
ptr[11] = "/down.png";
|
||||
|
||||
for(i = 0; i < 12; i += 2) {
|
||||
p = GBStringConcat(base, ptr[i + 1]);
|
||||
if(!GBGLTextureLoadFile(client->gl, ptr[i], NULL, NULL, p)) {
|
||||
p = GSStringConcat(base, ptr[i + 1]);
|
||||
if(!GSGLTextureLoadFile(client->gl, ptr[i], NULL, NULL, p)) {
|
||||
free(p);
|
||||
GBSkyBoxClose(skybox);
|
||||
GSSkyBoxClose(skybox);
|
||||
return NULL;
|
||||
}
|
||||
free(p);
|
||||
|
|
@ -39,12 +39,12 @@ GBSkyBox GBSkyBoxOpen(GBClient client, const char* base) {
|
|||
return skybox;
|
||||
}
|
||||
|
||||
void GBSkyBoxDraw(GBSkyBox skybox) {
|
||||
GBGL gl = skybox->engine->client->gl;
|
||||
void GSSkyBoxDraw(GSSkyBox skybox) {
|
||||
GSGL gl = skybox->engine->client->gl;
|
||||
int i;
|
||||
GBVector3 v[4];
|
||||
GBVector2 t[4];
|
||||
GBNumber s = 0.0001;
|
||||
GSVector3 v[4];
|
||||
GSVector2 t[4];
|
||||
GSNumber s = 0.0001;
|
||||
|
||||
t[0][0] = 0, t[0][1] = 0;
|
||||
|
||||
|
|
@ -54,8 +54,8 @@ void GBSkyBoxDraw(GBSkyBox skybox) {
|
|||
|
||||
t[3][0] = 1, t[3][1] = 0;
|
||||
|
||||
GBGLIgnoreDepth(gl);
|
||||
GBGLShadowDisable(gl);
|
||||
GSGLIgnoreDepth(gl);
|
||||
GSGLShadowDisable(gl);
|
||||
|
||||
for(i = 0; i < 6; i++) {
|
||||
GLuint tex;
|
||||
|
|
@ -107,23 +107,23 @@ void GBSkyBoxDraw(GBSkyBox skybox) {
|
|||
|
||||
for(j = 0; j < 4; j++) {
|
||||
for(k = 0; k < 3; k++) {
|
||||
v[j][k] *= GBGLMaxDistance / 2;
|
||||
v[j][k] *= GSGLMaxDistance / 2;
|
||||
v[j][k] += gl->engine->client->camera[k];
|
||||
}
|
||||
}
|
||||
|
||||
GBGLTextureSet(gl, tex);
|
||||
GSGLTextureSet(gl, tex);
|
||||
|
||||
GBGLPolygon(gl, 4, v, t);
|
||||
GSGLPolygon(gl, 4, v, t);
|
||||
}
|
||||
|
||||
GBGLTextureSet(gl, 0);
|
||||
GSGLTextureSet(gl, 0);
|
||||
|
||||
GBGLShadowEnable(gl);
|
||||
GBGLCareDepth(gl);
|
||||
GSGLShadowEnable(gl);
|
||||
GSGLCareDepth(gl);
|
||||
}
|
||||
|
||||
void GBSkyBoxClose(GBSkyBox skybox) {
|
||||
if(skybox->left > 0) GBGLTextureDelete(skybox->engine->client->gl, skybox->left);
|
||||
void GSSkyBoxClose(GSSkyBox skybox) {
|
||||
if(skybox->left > 0) GSGLTextureDelete(skybox->engine->client->gl, skybox->left);
|
||||
free(skybox);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include <GearBox/String.h>
|
||||
#include <GearSrc/String.h>
|
||||
|
||||
char* GBStringDuplicate(const char* str) {
|
||||
char* GSStringDuplicate(const char* str) {
|
||||
char* s = malloc(strlen(str) + 1);
|
||||
|
||||
strcpy(s, str);
|
||||
|
|
@ -8,7 +8,7 @@ char* GBStringDuplicate(const char* str) {
|
|||
return s;
|
||||
}
|
||||
|
||||
char* GBStringConcat(const char* str1, const char* str2) {
|
||||
char* GSStringConcat(const char* str1, const char* str2) {
|
||||
char* r = malloc(strlen(str1) + strlen(str2) + 1);
|
||||
|
||||
strcpy(r, str1);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include <GearBox/Version.h>
|
||||
#include <GearSrc/Version.h>
|
||||
|
||||
void GBVersionGet(GBVersion* version) {
|
||||
void GSVersionGet(GSVersion* version) {
|
||||
version->majorlevel = 0;
|
||||
version->minorlevel = 0;
|
||||
version->patchlevel = 0;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ endmacro()
|
|||
|
||||
file(GLOB lz4_SRC ../lz4/*.c)
|
||||
|
||||
compile_tool(gb_dumpfont)
|
||||
compile_tool(gb_makepak)
|
||||
compile_tool(gs_dumpfont)
|
||||
compile_tool(gs_makepak)
|
||||
|
||||
target_include_directories(gb_makepak PRIVATE ../lz4)
|
||||
target_sources(gb_makepak PRIVATE ${lz4_SRC})
|
||||
target_include_directories(gs_makepak PRIVATE ../lz4)
|
||||
target_sources(gs_makepak PRIVATE ${lz4_SRC})
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ static void scan(const char* path, const char* pre) {
|
|||
int main(int argc, char** argv) {
|
||||
unsigned char dat[128];
|
||||
|
||||
printf("GearBox Engine resource packer\n");
|
||||
printf("GearSrc Engine resource packer\n");
|
||||
if(argc >= 2) {
|
||||
out = fopen(argv[1], "wb");
|
||||
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
clang-format --verbose -i `find engine/src engine/include engine/net engine/tools '(' -name "*.c" -or -name "*.h" ')' -and -not -name "stb_*.h" | sed 's%engine/include/GearBox/GL/GL.h%%g'`
|
||||
clang-format --verbose -i `find engine/src engine/include engine/net engine/tools '(' -name "*.c" -or -name "*.h" ')' -and -not -name "stb_*.h" | sed 's%engine/include/GearSrc/GL/GL.h%%g'`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue