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)
|
file(GLOB af_client_SRC *.c)
|
||||||
|
|
||||||
add_executable(af_client ${af_client_SRC})
|
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)
|
install_target(af_client)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#define MW_OPENGL_NO_INCLUDE
|
#define MW_OPENGL_NO_INCLUDE
|
||||||
#define _MILSKO
|
#define _MILSKO
|
||||||
|
|
||||||
#include <GearBox/Foundation.h>
|
#include <GearSrc/Foundation.h>
|
||||||
|
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
#include <Mw/Widget/OpenGL.h>
|
#include <Mw/Widget/OpenGL.h>
|
||||||
|
|
@ -38,20 +38,20 @@ static void tick(void){
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv){
|
int main(int argc, char** argv){
|
||||||
GBEngineParam param;
|
GSEngineParam param;
|
||||||
GBEngine engine;
|
GSEngine engine;
|
||||||
|
|
||||||
GBEngineParamInit(¶m);
|
GSEngineParamInit(¶m);
|
||||||
param.ready = ready;
|
param.ready = ready;
|
||||||
param.tick = tick;
|
param.tick = tick;
|
||||||
param.get_tick = MwTimeGetTick;
|
param.get_tick = MwTimeGetTick;
|
||||||
param.sleep = MwTimeSleep;
|
param.sleep = MwTimeSleep;
|
||||||
param.gl_swapbuffer = gl_swapbuffer;
|
param.gl_swapbuffer = gl_swapbuffer;
|
||||||
|
|
||||||
GBInit();
|
GSInit();
|
||||||
|
|
||||||
if((engine = GBEngineCreate(¶m)) != NULL){
|
if((engine = GSEngineCreate(¶m)) != NULL){
|
||||||
GBEngineLoop(engine);
|
GSEngineLoop(engine);
|
||||||
GBEngineDestroy(engine);
|
GSEngineDestroy(engine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,18 @@ endmacro()
|
||||||
|
|
||||||
add_subdirectory(net)
|
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})
|
add_library(GearSrc SHARED ${GearSrc_SRC})
|
||||||
target_include_directories(GearBox PUBLIC include)
|
target_include_directories(GearSrc PUBLIC include)
|
||||||
target_include_directories(GearBox PRIVATE lz4)
|
target_include_directories(GearSrc PRIVATE lz4)
|
||||||
target_compile_definitions(GearBox PRIVATE _GEARBOX)
|
target_compile_definitions(GearSrc PRIVATE _GEARBOX)
|
||||||
target_link_libraries(GearBox PRIVATE gbnet)
|
target_link_libraries(GearSrc PRIVATE gbnet)
|
||||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
target_link_libraries(GearBox PRIVATE m)
|
target_link_libraries(GearSrc PRIVATE m)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install_target(GearBox)
|
install_target(GearSrc)
|
||||||
install(
|
install(
|
||||||
DIRECTORY include/
|
DIRECTORY include/
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
|
@ -38,5 +38,5 @@ add_subdirectory(tools)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
DIRECTORY resource/
|
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
|
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
|
#endif
|
||||||
|
|
||||||
#if defined(_GEARBOX) && defined(_WIN32)
|
#if defined(_GEARBOX) && defined(_WIN32)
|
||||||
#define GBDECL extern __declspec(dllexport)
|
#define GSDECL extern __declspec(dllexport)
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
#define GBDECL extern __declspec(dllimport)
|
#define GSDECL extern __declspec(dllimport)
|
||||||
#else
|
#else
|
||||||
#define GBDECL extern
|
#define GSDECL extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#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__
|
#ifndef __GEARBOX_VERSION_H__
|
||||||
#define __GEARBOX_VERSION_H__
|
#define __GEARBOX_VERSION_H__
|
||||||
|
|
||||||
#include <GearBox/MachDep.h>
|
#include <GearSrc/MachDep.h>
|
||||||
#include <GearBox/TypeDefs.h>
|
#include <GearSrc/TypeDefs.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GBDECL void GBVersionGet(GBVersion* version);
|
GSDECL void GSVersionGet(GSVersion* version);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
#include <GearBox/Client.h>
|
#include <GearSrc/Client.h>
|
||||||
|
|
||||||
#include <GearBox/Log.h>
|
#include <GearSrc/Log.h>
|
||||||
#include <GearBox/GL.h>
|
#include <GearSrc/GL.h>
|
||||||
#include <GearBox/SkyBox.h>
|
#include <GearSrc/SkyBox.h>
|
||||||
#include <GearBox/Math.h>
|
#include <GearSrc/Math.h>
|
||||||
|
|
||||||
GBClient GBClientCreate(GBEngine engine) {
|
GSClient GSClientCreate(GSEngine engine) {
|
||||||
GBClient client = malloc(sizeof(*client));
|
GSClient client = malloc(sizeof(*client));
|
||||||
|
|
||||||
memset(client, 0, sizeof(*client));
|
memset(client, 0, sizeof(*client));
|
||||||
|
|
||||||
|
|
@ -25,39 +25,39 @@ GBClient GBClientCreate(GBEngine engine) {
|
||||||
client->light0[2] = 5;
|
client->light0[2] = 5;
|
||||||
client->light0[3] = 1;
|
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;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBClientDestroy(GBClient client) {
|
void GSClientDestroy(GSClient client) {
|
||||||
GBGLDestroy(client->gl);
|
GSGLDestroy(client->gl);
|
||||||
|
|
||||||
free(client);
|
free(client);
|
||||||
|
|
||||||
GBLog(GBLogInfo, "Destroyed client");
|
GSLog(GSLogInfo, "Destroyed client");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scene(GBClient client) {
|
static void scene(GSClient client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBClientStep(GBClient client) {
|
void GSClientStep(GSClient client) {
|
||||||
GBGLClear(client->gl);
|
GSGLClear(client->gl);
|
||||||
GBGLCameraSetup(client->gl);
|
GSGLCameraSetup(client->gl);
|
||||||
GBGLSetLight(client->gl);
|
GSGLSetLight(client->gl);
|
||||||
|
|
||||||
if(GBGLShadowBeforeMapping(client->gl)) {
|
if(GSGLShadowBeforeMapping(client->gl)) {
|
||||||
scene(client);
|
scene(client);
|
||||||
GBGLShadowAfterMapping(client->gl);
|
GSGLShadowAfterMapping(client->gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(client->skybox != NULL) GBSkyBoxDraw(client->skybox);
|
if(client->skybox != NULL) GSSkyBoxDraw(client->skybox);
|
||||||
scene(client);
|
scene(client);
|
||||||
GBGLShadowEnd(client->gl);
|
GSGLShadowEnd(client->gl);
|
||||||
|
|
||||||
client->engine->param->gl_swapbuffer();
|
client->engine->param->gl_swapbuffer();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
#include <GearBox/Core.h>
|
#include <GearSrc/Core.h>
|
||||||
|
|
||||||
#include <GearBox/Version.h>
|
#include <GearSrc/Version.h>
|
||||||
#include <GearBox/Log.h>
|
#include <GearSrc/Log.h>
|
||||||
#include <GearBox/Client.h>
|
#include <GearSrc/Client.h>
|
||||||
#include <GearBox/Server.h>
|
#include <GearSrc/Server.h>
|
||||||
#include <GearBox/GL.h>
|
#include <GearSrc/GL.h>
|
||||||
#include <GearBox/Resource.h>
|
#include <GearSrc/Resource.h>
|
||||||
|
|
||||||
#include <stb_ds.h>
|
#include <stb_ds.h>
|
||||||
|
|
||||||
void GBInit(void) {
|
void GSInit(void) {
|
||||||
GBVersion version;
|
GSVersion version;
|
||||||
|
|
||||||
GBVersionGet(&version);
|
GSVersionGet(&version);
|
||||||
|
|
||||||
GBLog(GBLogInfo, "GearBox Engine %s", version.string);
|
GSLog(GSLogInfo, "GearSrc Engine %s", version.string);
|
||||||
|
|
||||||
gload_init();
|
gload_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GBEngineRegisterResource(GBEngine engine, const char* name, const char* path) {
|
int GSEngineRegisterResource(GSEngine engine, const char* name, const char* path) {
|
||||||
GBResource resource;
|
GSResource resource;
|
||||||
if((resource = GBResourceOpen(engine, path)) != NULL) {
|
if((resource = GSResourceOpen(engine, path)) != NULL) {
|
||||||
shput(engine->resource, name, resource);
|
shput(engine->resource, name, resource);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -30,8 +30,8 @@ int GBEngineRegisterResource(GBEngine engine, const char* name, const char* path
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GBEngine GBEngineCreate(GBEngineParam* param) {
|
GSEngine GSEngineCreate(GSEngineParam* param) {
|
||||||
GBEngine engine = malloc(sizeof(*engine));
|
GSEngine engine = malloc(sizeof(*engine));
|
||||||
|
|
||||||
memset(engine, 0, sizeof(*engine));
|
memset(engine, 0, sizeof(*engine));
|
||||||
|
|
||||||
|
|
@ -47,47 +47,47 @@ GBEngine GBEngineCreate(GBEngineParam* param) {
|
||||||
|
|
||||||
sh_new_strdup(engine->resource);
|
sh_new_strdup(engine->resource);
|
||||||
|
|
||||||
GBEngineRegisterResource(engine, "base", "base.pak");
|
GSEngineRegisterResource(engine, "base", "base.pak");
|
||||||
GBEngineRegisterResource(engine, "game", "game.pak");
|
GSEngineRegisterResource(engine, "game", "game.pak");
|
||||||
|
|
||||||
if(engine != NULL && param->client && (engine->client = GBClientCreate(engine)) == NULL) {
|
if(engine != NULL && param->client && (engine->client = GSClientCreate(engine)) == NULL) {
|
||||||
GBLog(GBLogError, "Failed to create client");
|
GSLog(GSLogError, "Failed to create client");
|
||||||
|
|
||||||
GBEngineDestroy(engine);
|
GSEngineDestroy(engine);
|
||||||
|
|
||||||
engine = NULL;
|
engine = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(engine != NULL && param->server && (engine->server = GBServerCreate(engine)) == NULL) {
|
if(engine != NULL && param->server && (engine->server = GSServerCreate(engine)) == NULL) {
|
||||||
GBLog(GBLogError, "Failed to create server");
|
GSLog(GSLogError, "Failed to create server");
|
||||||
|
|
||||||
GBEngineDestroy(engine);
|
GSEngineDestroy(engine);
|
||||||
|
|
||||||
engine = NULL;
|
engine = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(engine == NULL) {
|
if(engine == NULL) {
|
||||||
GBLog(GBLogError, "Failed to create engine");
|
GSLog(GSLogError, "Failed to create engine");
|
||||||
}
|
}
|
||||||
|
|
||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBEngineDestroy(GBEngine engine) {
|
void GSEngineDestroy(GSEngine engine) {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < shlen(engine->resource); i++) {
|
for(i = 0; i < shlen(engine->resource); i++) {
|
||||||
GBResourceClose(engine->resource[i].value);
|
GSResourceClose(engine->resource[i].value);
|
||||||
}
|
}
|
||||||
shfree(engine->resource);
|
shfree(engine->resource);
|
||||||
|
|
||||||
if(engine->server != NULL) GBServerDestroy(engine->server);
|
if(engine->server != NULL) GSServerDestroy(engine->server);
|
||||||
if(engine->client != NULL) GBClientDestroy(engine->client);
|
if(engine->client != NULL) GSClientDestroy(engine->client);
|
||||||
if(engine->param != NULL) free(engine->param);
|
if(engine->param != NULL) free(engine->param);
|
||||||
|
|
||||||
free(engine);
|
free(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBEngineParamInit(GBEngineParam* param) {
|
void GSEngineParamInit(GSEngineParam* param) {
|
||||||
memset(param, 0, sizeof(*param));
|
memset(param, 0, sizeof(*param));
|
||||||
|
|
||||||
param->server = 0;
|
param->server = 0;
|
||||||
|
|
@ -98,15 +98,15 @@ void GBEngineParamInit(GBEngineParam* param) {
|
||||||
param->get_tick = NULL;
|
param->get_tick = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBEngineLoop(GBEngine engine) {
|
void GSEngineLoop(GSEngine engine) {
|
||||||
long t = 0;
|
long t = 0;
|
||||||
int wait_actually = 0;
|
int wait_actually = 0;
|
||||||
int more = 0;
|
int more = 0;
|
||||||
long wait = 1000 / 50.0;
|
long wait = 1000 / 50.0;
|
||||||
|
|
||||||
if(engine->param->sleep == NULL || engine->param->get_tick == NULL) {
|
if(engine->param->sleep == NULL || engine->param->get_tick == NULL) {
|
||||||
GBLog(GBLogWarn, "sleep and/or get_tick parameter are missing!");
|
GSLog(GSLogWarn, "sleep and/or get_tick parameter are missing!");
|
||||||
GBLog(GBLogWarn, "This will result game to be crazy fast!!!");
|
GSLog(GSLogWarn, "This will result game to be crazy fast!!!");
|
||||||
} else {
|
} else {
|
||||||
t = engine->param->get_tick();
|
t = engine->param->get_tick();
|
||||||
|
|
||||||
|
|
@ -114,8 +114,8 @@ void GBEngineLoop(GBEngine engine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
if(engine->client != NULL) GBClientStep(engine->client);
|
if(engine->client != NULL) GSClientStep(engine->client);
|
||||||
if(engine->server != NULL) GBServerStep(engine->server);
|
if(engine->server != NULL) GSServerStep(engine->server);
|
||||||
|
|
||||||
if(engine->param->tick != NULL) engine->param->tick();
|
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;
|
return engine->client;
|
||||||
}
|
}
|
||||||
|
|
||||||
GBServer GBEngineGetServer(GBEngine engine) {
|
GSServer GSEngineGetServer(GSEngine engine) {
|
||||||
return engine->server;
|
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) {
|
static void swap(void* from, void* to, int size) {
|
||||||
unsigned char* f = from;
|
unsigned char* f = from;
|
||||||
unsigned char* t = to;
|
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))
|
#define SWAP(in, out) swap(&in, &out, sizeof(in))
|
||||||
|
|
||||||
GBI16 GBEndianSwapI16BE(GBI16 in) {
|
GSI16 GSEndianSwapI16BE(GSI16 in) {
|
||||||
GBI16 out;
|
GSI16 out;
|
||||||
|
|
||||||
SWAP(in, out);
|
SWAP(in, out);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GBI32 GBEndianSwapI32BE(GBI32 in) {
|
GSI32 GSEndianSwapI32BE(GSI32 in) {
|
||||||
GBI32 out;
|
GSI32 out;
|
||||||
|
|
||||||
SWAP(in, out);
|
SWAP(in, out);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GBI64 GBEndianSwapI64BE(GBI64 in) {
|
GSI64 GSEndianSwapI64BE(GSI64 in) {
|
||||||
GBI64 out;
|
GSI64 out;
|
||||||
|
|
||||||
SWAP(in, out);
|
SWAP(in, out);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GBU16 GBEndianSwapU16BE(GBU16 in) {
|
GSU16 GSEndianSwapU16BE(GSU16 in) {
|
||||||
GBU16 out;
|
GSU16 out;
|
||||||
|
|
||||||
SWAP(in, out);
|
SWAP(in, out);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GBU32 GBEndianSwapU32BE(GBU32 in) {
|
GSU32 GSEndianSwapU32BE(GSU32 in) {
|
||||||
GBU32 out;
|
GSU32 out;
|
||||||
|
|
||||||
SWAP(in, out);
|
SWAP(in, out);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GBU64 GBEndianSwapU64BE(GBU64 in) {
|
GSU64 GSEndianSwapU64BE(GSU64 in) {
|
||||||
GBU64 out;
|
GSU64 out;
|
||||||
|
|
||||||
SWAP(in, out);
|
SWAP(in, out);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
#include <GearBox/File.h>
|
#include <GearSrc/File.h>
|
||||||
|
|
||||||
#include <GearBox/String.h>
|
#include <GearSrc/String.h>
|
||||||
#include <GearBox/Log.h>
|
#include <GearSrc/Log.h>
|
||||||
#include <GearBox/Resource.h>
|
#include <GearSrc/Resource.h>
|
||||||
|
|
||||||
#include <stb_ds.h>
|
#include <stb_ds.h>
|
||||||
|
|
||||||
GBFile GBFileOpen(GBEngine engine, const char* path) {
|
GSFile GSFileOpen(GSEngine engine, const char* path) {
|
||||||
GBFile file = malloc(sizeof(*file));
|
GSFile file = malloc(sizeof(*file));
|
||||||
char* s;
|
char* s;
|
||||||
char* nam;
|
char* nam;
|
||||||
|
|
||||||
|
|
@ -20,12 +20,12 @@ GBFile GBFileOpen(GBEngine engine, const char* path) {
|
||||||
file->size = ftell(file->fp);
|
file->size = ftell(file->fp);
|
||||||
fseek(file->fp, 0, SEEK_SET);
|
fseek(file->fp, 0, SEEK_SET);
|
||||||
|
|
||||||
GBLog(GBLogInfo, "Opened %s", path);
|
GSLog(GSLogInfo, "Opened %s", path);
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = GBStringDuplicate(path);
|
s = GSStringDuplicate(path);
|
||||||
if(engine != NULL && ((nam = strstr(s, ":/")) != NULL || (nam = strstr(s, ":\\")) != NULL)) {
|
if(engine != NULL && ((nam = strstr(s, ":/")) != NULL || (nam = strstr(s, ":\\")) != NULL)) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -35,10 +35,10 @@ GBFile GBFileOpen(GBEngine engine, const char* path) {
|
||||||
|
|
||||||
for(i = 0; i < shlen(engine->resource); i++) {
|
for(i = 0; i < shlen(engine->resource); i++) {
|
||||||
if(strcmp(engine->resource[i].key, s) == 0) {
|
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);
|
free(s);
|
||||||
|
|
||||||
GBLog(GBLogInfo, "Opened %s", path);
|
GSLog(GSLogInfo, "Opened %s", path);
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -47,12 +47,12 @@ GBFile GBFileOpen(GBEngine engine, const char* path) {
|
||||||
}
|
}
|
||||||
free(s);
|
free(s);
|
||||||
|
|
||||||
GBLog(GBLogError, "Could not open %s", path);
|
GSLog(GSLogError, "Could not open %s", path);
|
||||||
GBFileClose(file);
|
GSFileClose(file);
|
||||||
return NULL;
|
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->fp != NULL) return fread(out, 1, size, file->fp);
|
||||||
if(file->data != NULL) {
|
if(file->data != NULL) {
|
||||||
int len = 0;
|
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);
|
if(file->fp != NULL) fseek(file->fp, pos, SEEK_SET);
|
||||||
file->seek = pos;
|
file->seek = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int GBFileSize(GBFile file) {
|
unsigned int GSFileSize(GSFile file) {
|
||||||
return file->size;
|
return file->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBFileClose(GBFile file) {
|
void GSFileClose(GSFile file) {
|
||||||
if(file->fp != NULL) fclose(file->fp);
|
if(file->fp != NULL) fclose(file->fp);
|
||||||
if(file->data != NULL) free(file->data);
|
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 lightamb[] = {0.5, 0.5, 0.5, 1.0};
|
||||||
GLfloat lightcol[] = {1.0, 1.0, 1.0, 1.0};
|
GLfloat lightcol[] = {1.0, 1.0, 1.0, 1.0};
|
||||||
GBGL gl;
|
GSGL gl;
|
||||||
|
|
||||||
gl = malloc(sizeof(*client->gl));
|
gl = malloc(sizeof(*client->gl));
|
||||||
|
|
||||||
|
|
@ -29,30 +29,30 @@ GBGL GBGLCreate(GBClient client) {
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
GBGLShadowInit(gl);
|
GSGLShadowInit(gl);
|
||||||
|
|
||||||
return gl;
|
return gl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLDestroy(GBGL gl) {
|
void GSGLDestroy(GSGL gl) {
|
||||||
GBGLShadowDeinit(gl);
|
GSGLShadowDeinit(gl);
|
||||||
|
|
||||||
free(gl);
|
free(gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLClear(GBGL gl) {
|
void GSGLClear(GSGL gl) {
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLIgnoreDepth(GBGL gl) {
|
void GSGLIgnoreDepth(GSGL gl) {
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLCareDepth(GBGL gl) {
|
void GSGLCareDepth(GSGL gl) {
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLSetLight(GBGL gl) {
|
void GSGLSetLight(GSGL gl) {
|
||||||
GLfloat f[4];
|
GLfloat f[4];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ void GBGLSetLight(GBGL gl) {
|
||||||
glLightfv(GL_LIGHT0, GL_POSITION, f);
|
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;
|
int i;
|
||||||
|
|
||||||
glBegin(GL_POLYGON);
|
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) {
|
void GSGLCameraPerspective(GSGL gl, GSNumber width, GSNumber height) {
|
||||||
GBNumber aspect;
|
GSNumber aspect;
|
||||||
GBNumber f;
|
GSNumber f;
|
||||||
GLdouble matrix[16];
|
GLdouble matrix[16];
|
||||||
int i;
|
int i;
|
||||||
GBNumber fovy = 60.0;
|
GSNumber fovy = 60.0;
|
||||||
GBNumber znear = 0.01;
|
GSNumber znear = 0.01;
|
||||||
GBNumber zfar = GBGLMaxDistance;
|
GSNumber zfar = GSGLMaxDistance;
|
||||||
|
|
||||||
aspect = width / height;
|
aspect = width / height;
|
||||||
f = GBMathCot(fovy / 180 * GBMathPi / 2);
|
f = GSMathCot(fovy / 180 * GSMathPi / 2);
|
||||||
|
|
||||||
for(i = 0; i < 16; i++) matrix[i] = 0;
|
for(i = 0; i < 16; i++) matrix[i] = 0;
|
||||||
matrix[4 * 0 + 0] = f / aspect;
|
matrix[4 * 0 + 0] = f / aspect;
|
||||||
|
|
@ -24,30 +24,30 @@ void GBGLCameraPerspective(GBGL gl, GBNumber width, GBNumber height) {
|
||||||
glMultMatrixd(matrix);
|
glMultMatrixd(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLCameraSet(GBGL gl) {
|
void GSGLCameraSet(GSGL gl) {
|
||||||
GBGLCameraLookAt(gl, gl->engine->client->camera, gl->engine->client->look_at);
|
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];
|
GLdouble matrix[16];
|
||||||
GBVector3 f;
|
GSVector3 f;
|
||||||
GBVector3 up;
|
GSVector3 up;
|
||||||
GBVector3 s;
|
GSVector3 s;
|
||||||
GBVector3 u;
|
GSVector3 u;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
GBMathSubtract3(f, look_at, camera);
|
GSMathSubtract3(f, look_at, camera);
|
||||||
GBMathNormalize3(f);
|
GSMathNormalize3(f);
|
||||||
|
|
||||||
up[0] = 0;
|
up[0] = 0;
|
||||||
up[1] = 1;
|
up[1] = 1;
|
||||||
up[2] = 0;
|
up[2] = 0;
|
||||||
GBMathNormalize3(up);
|
GSMathNormalize3(up);
|
||||||
|
|
||||||
GBMathCross3(s, f, up);
|
GSMathCross3(s, f, up);
|
||||||
GBMathNormalize3(s);
|
GSMathNormalize3(s);
|
||||||
|
|
||||||
GBMathCross3(u, s, f);
|
GSMathCross3(u, s, f);
|
||||||
|
|
||||||
for(i = 0; i < 16; i++) matrix[i] = 0;
|
for(i = 0; i < 16; i++) matrix[i] = 0;
|
||||||
matrix[4 * 0 + 0] = s[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]);
|
glTranslated(-camera[0], -camera[1], -camera[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLCameraSetup(GBGL gl) {
|
void GSGLCameraSetup(GSGL gl) {
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
GBGLCameraPerspective(gl, gl->engine->width, gl->engine->height);
|
GSGLCameraPerspective(gl, gl->engine->width, gl->engine->height);
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
GBGLCameraSet(gl);
|
GSGLCameraSet(gl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <GearBox/GL.h>
|
#include <GearSrc/GL.h>
|
||||||
|
|
||||||
#include <GearBox/File.h>
|
#include <GearSrc/File.h>
|
||||||
#include <GearBox/Log.h>
|
#include <GearSrc/Log.h>
|
||||||
|
|
||||||
static void err(const char* path, GLuint shader) {
|
static void err(const char* path, GLuint shader) {
|
||||||
GLint len, ret;
|
GLint len, ret;
|
||||||
|
|
@ -14,41 +14,41 @@ static void err(const char* path, GLuint shader) {
|
||||||
|
|
||||||
glGetShaderInfoLog(shader, len, &ret, e);
|
glGetShaderInfoLog(shader, len, &ret, e);
|
||||||
|
|
||||||
GBLog(GBLogError, "%s: %s\n", path, e);
|
GSLog(GSLogError, "%s: %s\n", path, e);
|
||||||
|
|
||||||
free(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 vsi;
|
||||||
GLuint fsi;
|
GLuint fsi;
|
||||||
GBFile f;
|
GSFile f;
|
||||||
int vsl = 0;
|
int vsl = 0;
|
||||||
int fsl = 0;
|
int fsl = 0;
|
||||||
char* vss;
|
char* vss;
|
||||||
char* fss;
|
char* fss;
|
||||||
GLint st;
|
GLint st;
|
||||||
|
|
||||||
if((f = GBFileOpen(gl->engine, vs)) != NULL) {
|
if((f = GSFileOpen(gl->engine, vs)) != NULL) {
|
||||||
int sz = GBFileSize(f);
|
int sz = GSFileSize(f);
|
||||||
|
|
||||||
vss = malloc(sz + 1);
|
vss = malloc(sz + 1);
|
||||||
GBFileRead(f, vss, sz);
|
GSFileRead(f, vss, sz);
|
||||||
vss[sz] = 0;
|
vss[sz] = 0;
|
||||||
|
|
||||||
GBFileClose(f);
|
GSFileClose(f);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((f = GBFileOpen(gl->engine, fs)) != NULL) {
|
if((f = GSFileOpen(gl->engine, fs)) != NULL) {
|
||||||
int sz = GBFileSize(f);
|
int sz = GSFileSize(f);
|
||||||
|
|
||||||
fss = malloc(sz + 1);
|
fss = malloc(sz + 1);
|
||||||
GBFileRead(f, fss, sz);
|
GSFileRead(f, fss, sz);
|
||||||
fss[sz] = 0;
|
fss[sz] = 0;
|
||||||
|
|
||||||
GBFileClose(f);
|
GSFileClose(f);
|
||||||
} else {
|
} else {
|
||||||
free(vss);
|
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_WIDTH 512
|
||||||
#define SHADOW_HEIGHT 512
|
#define SHADOW_HEIGHT 512
|
||||||
#define SHADOW_CULL
|
#define SHADOW_CULL
|
||||||
|
|
||||||
void GBGLShadowInit(GBGL gl) {
|
void GSGLShadowInit(GSGL gl) {
|
||||||
glGenTextures(1, &gl->shadow_texture);
|
glGenTextures(1, &gl->shadow_texture);
|
||||||
glBindTexture(GL_TEXTURE_2D, 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);
|
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);
|
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);
|
glUseProgram(gl->shadow_shader);
|
||||||
glUniform1i(glGetUniformLocation(gl->shadow_shader, "depth_texture"), 7);
|
glUniform1i(glGetUniformLocation(gl->shadow_shader, "depth_texture"), 7);
|
||||||
glUniform1i(glGetUniformLocation(gl->shadow_shader, "current_texture"), 0);
|
glUniform1i(glGetUniformLocation(gl->shadow_shader, "current_texture"), 0);
|
||||||
|
|
@ -40,26 +40,26 @@ void GBGLShadowInit(GBGL gl) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int GBGLShadowBeforeMapping(GBGL gl) {
|
int GSGLShadowBeforeMapping(GSGL gl) {
|
||||||
GBVector3 zero = {0, 0, 0};
|
GSVector3 zero = {0, 0, 0};
|
||||||
|
|
||||||
if(!gl->shadow_use_shader) return 0;
|
if(!gl->shadow_use_shader) return 0;
|
||||||
|
|
||||||
GBGLClear(gl);
|
GSGLClear(gl);
|
||||||
|
|
||||||
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
|
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glGetDoublev(GL_PROJECTION_MATRIX, gl->shadow_old_projection);
|
glGetDoublev(GL_PROJECTION_MATRIX, gl->shadow_old_projection);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
GBGLCameraPerspective(gl, SHADOW_WIDTH, SHADOW_HEIGHT);
|
GSGLCameraPerspective(gl, SHADOW_WIDTH, SHADOW_HEIGHT);
|
||||||
|
|
||||||
glGetDoublev(GL_PROJECTION_MATRIX, gl->shadow_projection);
|
glGetDoublev(GL_PROJECTION_MATRIX, gl->shadow_projection);
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glGetDoublev(GL_MODELVIEW_MATRIX, gl->shadow_old_modelview);
|
glGetDoublev(GL_MODELVIEW_MATRIX, gl->shadow_old_modelview);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
GBGLCameraLookAt(gl, gl->engine->client->light0, zero);
|
GSGLCameraLookAt(gl, gl->engine->client->light0, zero);
|
||||||
|
|
||||||
glGetDoublev(GL_MODELVIEW_MATRIX, gl->shadow_modelview);
|
glGetDoublev(GL_MODELVIEW_MATRIX, gl->shadow_modelview);
|
||||||
|
|
||||||
|
|
@ -79,8 +79,8 @@ int GBGLShadowBeforeMapping(GBGL gl) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLShadowAfterMapping(GBGL gl) {
|
void GSGLShadowAfterMapping(GSGL gl) {
|
||||||
GBMatrix4x4 in, out;
|
GSMatrix4x4 in, out;
|
||||||
GLdouble mat[16];
|
GLdouble mat[16];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ void GBGLShadowAfterMapping(GBGL gl) {
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
for(i = 0; i < 16; i++) in[i] = gl->shadow_old_modelview[i];
|
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];
|
for(i = 0; i < 16; i++) mat[i] = out[i];
|
||||||
|
|
||||||
glTranslated(0.5, 0.5, 0.5);
|
glTranslated(0.5, 0.5, 0.5);
|
||||||
|
|
@ -126,12 +126,12 @@ void GBGLShadowAfterMapping(GBGL gl) {
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
GBGLClear(gl);
|
GSGLClear(gl);
|
||||||
|
|
||||||
GBGLShadowEnable(gl);
|
GSGLShadowEnable(gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLShadowDisable(GBGL gl) {
|
void GSGLShadowDisable(GSGL gl) {
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
if(gl->shadow_use_shader) {
|
if(gl->shadow_use_shader) {
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
@ -143,7 +143,7 @@ void GBGLShadowDisable(GBGL gl) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLShadowEnable(GBGL gl) {
|
void GSGLShadowEnable(GSGL gl) {
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
if(gl->shadow_use_shader) {
|
if(gl->shadow_use_shader) {
|
||||||
glUseProgram(gl->shadow_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;
|
if(!gl->shadow_use_shader) return;
|
||||||
|
|
||||||
GBGLShadowDisable(gl);
|
GSGLShadowDisable(gl);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE7);
|
glActiveTexture(GL_TEXTURE7);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
@ -173,7 +173,7 @@ void GBGLShadowEnd(GBGL gl) {
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLShadowDeinit(GBGL gl) {
|
void GSGLShadowDeinit(GSGL gl) {
|
||||||
if(gl->shadow_use_shader) {
|
if(gl->shadow_use_shader) {
|
||||||
glDeleteTextures(1, &gl->shadow_texture);
|
glDeleteTextures(1, &gl->shadow_texture);
|
||||||
glDeleteProgram(gl->shadow_shader);
|
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>
|
#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);
|
glGenTextures(1, texture);
|
||||||
glBindTexture(GL_TEXTURE_2D, *texture);
|
glBindTexture(GL_TEXTURE_2D, *texture);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgba);
|
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);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLTextureEnable(GBGL gl, GLuint texture) {
|
void GSGLTextureEnable(GSGL gl, GLuint texture) {
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLTextureDisable(GBGL gl, GLuint texture) {
|
void GSGLTextureDisable(GSGL gl, GLuint texture) {
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GBGLTextureLoadFile(GBGL gl, GLuint* texture, int* width, int* height, const char* filename) {
|
int GSGLTextureLoadFile(GSGL gl, GLuint* texture, int* width, int* height, const char* filename) {
|
||||||
GBFile f = GBFileOpen(gl->engine, filename);
|
GSFile f = GSFileOpen(gl->engine, filename);
|
||||||
unsigned char* data;
|
unsigned char* data;
|
||||||
unsigned char* rgba;
|
unsigned char* rgba;
|
||||||
unsigned long sz;
|
unsigned long sz;
|
||||||
|
|
@ -33,16 +33,16 @@ int GBGLTextureLoadFile(GBGL gl, GLuint* texture, int* width, int* height, const
|
||||||
int w, h;
|
int w, h;
|
||||||
if(f == NULL) return 0;
|
if(f == NULL) return 0;
|
||||||
|
|
||||||
sz = GBFileSize(f);
|
sz = GSFileSize(f);
|
||||||
|
|
||||||
data = malloc(sz);
|
data = malloc(sz);
|
||||||
GBFileRead(f, data, sz);
|
GSFileRead(f, data, sz);
|
||||||
GBFileClose(f);
|
GSFileClose(f);
|
||||||
|
|
||||||
if((rgba = stbi_load_from_memory(data, sz, &w, &h, &ch, 4)) == NULL) {
|
if((rgba = stbi_load_from_memory(data, sz, &w, &h, &ch, 4)) == NULL) {
|
||||||
st = 0;
|
st = 0;
|
||||||
} else {
|
} else {
|
||||||
GBGLTexturePrepare(gl, texture, rgba, w, h);
|
GSGLTexturePrepare(gl, texture, rgba, w, h);
|
||||||
|
|
||||||
free(rgba);
|
free(rgba);
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +55,7 @@ int GBGLTextureLoadFile(GBGL gl, GLuint* texture, int* width, int* height, const
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBGLTextureSet(GBGL gl, GLuint texture) {
|
void GSGLTextureSet(GSGL gl, GLuint texture) {
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
if(texture == 0) {
|
if(texture == 0) {
|
||||||
glDisable(GL_TEXTURE_2D);
|
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);
|
glDeleteTextures(1, &texture);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
#define GLOAD_IMPLEMENTATION
|
#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;
|
va_list va;
|
||||||
FILE* out = stdout;
|
FILE* out = stdout;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#else
|
#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 ");
|
fprintf(out, "\x1b[1mINFO\x1b[m ");
|
||||||
} else if(level == GBLogWarn) {
|
} else if(level == GSLogWarn) {
|
||||||
fprintf(out, "\x1b[1m\x1b[33mWARN\x1b[m ");
|
fprintf(out, "\x1b[1m\x1b[33mWARN\x1b[m ");
|
||||||
} else if(level == GBLogError) {
|
} else if(level == GSLogError) {
|
||||||
fprintf(out, "\x1b[1m\x1b[31mERROR\x1b[m");
|
fprintf(out, "\x1b[1m\x1b[31mERROR\x1b[m");
|
||||||
}
|
}
|
||||||
#endif
|
#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[0] = v0[1] * v1[2] - v0[2] * v1[1];
|
||||||
r[1] = v0[2] * v1[0] - v0[0] * v1[2];
|
r[1] = v0[2] * v1[0] - v0[0] * v1[2];
|
||||||
r[2] = v0[0] * v1[1] - v0[1] * v1[0];
|
r[2] = v0[0] * v1[1] - v0[1] * v1[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBMathNormalize3(GBVector3 vec) {
|
void GSMathNormalize3(GSVector3 vec) {
|
||||||
GBNumber l = 0;
|
GSNumber l = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < 3; i++) l += vec[i] * vec[i];
|
for(i = 0; i < 3; i++) l += vec[i] * vec[i];
|
||||||
|
|
@ -15,7 +15,7 @@ void GBMathNormalize3(GBVector3 vec) {
|
||||||
l = sqrt(l);
|
l = sqrt(l);
|
||||||
|
|
||||||
if(l > 0) {
|
if(l > 0) {
|
||||||
l = (GBNumber)1 / l;
|
l = (GSNumber)1 / l;
|
||||||
} else {
|
} else {
|
||||||
l = 0;
|
l = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -25,13 +25,13 @@ void GBMathNormalize3(GBVector3 vec) {
|
||||||
vec[2] *= l;
|
vec[2] *= l;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBMathSubtract3(GBVector3 r, GBVector3 v0, GBVector3 v1) {
|
void GSMathSubtract3(GSVector3 r, GSVector3 v0, GSVector3 v1) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < 3; i++) r[i] = v0[i] - v1[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;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < 3; i++) r[i] = v0[i] + v1[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/
|
* v1/
|
||||||
*/
|
*/
|
||||||
void GBMathNormal3x3(GBVector3 r, GBVector3 v0, GBVector3 v1, GBVector3 v2) {
|
void GSMathNormal3x3(GSVector3 r, GSVector3 v0, GSVector3 v1, GSVector3 v2) {
|
||||||
GBVector3 t0, t1;
|
GSVector3 t0, t1;
|
||||||
|
|
||||||
GBMathSubtract3(t0, v1, v0);
|
GSMathSubtract3(t0, v1, v0);
|
||||||
GBMathSubtract3(t1, v2, 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
|
* v1-v2
|
||||||
*/
|
*/
|
||||||
void GBMathNormal3x4(GBVector3 r, GBVector3 v0, GBVector3 v1, GBVector3 v2, GBVector3 v3) {
|
void GSMathNormal3x4(GSVector3 r, GSVector3 v0, GSVector3 v1, GSVector3 v2, GSVector3 v3) {
|
||||||
GBVector3 t0, t1;
|
GSVector3 t0, t1;
|
||||||
|
|
||||||
GBMathNormal3x3(t0, v0, v1, v3);
|
GSMathNormal3x3(t0, v0, v1, v3);
|
||||||
GBMathNormal3x3(t1, v1, v2, v3);
|
GSMathNormal3x3(t1, v1, v2, v3);
|
||||||
|
|
||||||
GBMathAdd3(r, t0, t1);
|
GSMathAdd3(r, t0, t1);
|
||||||
|
|
||||||
GBMathNormalize3(r);
|
GSMathNormalize3(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
GBNumber GBMathCot(GBNumber x) {
|
GSNumber GSMathCot(GSNumber x) {
|
||||||
return (GBNumber)1 / tan(x);
|
return (GSNumber)1 / tan(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBMathInvert4x4(GBMatrix4x4 out, GBMatrix4x4 in) {
|
void GSMathInvert4x4(GSMatrix4x4 out, GSMatrix4x4 in) {
|
||||||
GBNumber inv[16], det;
|
GSNumber inv[16], det;
|
||||||
int i;
|
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];
|
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 <GearSrc/File.h>
|
||||||
#include <GearBox/Log.h>
|
#include <GearSrc/Log.h>
|
||||||
#include <GearBox/Endian.h>
|
#include <GearSrc/Endian.h>
|
||||||
|
|
||||||
#include <lz4.h>
|
#include <lz4.h>
|
||||||
|
|
||||||
|
|
@ -12,54 +12,54 @@ static unsigned char res_sig[4] = {
|
||||||
'A',
|
'A',
|
||||||
'K'};
|
'K'};
|
||||||
|
|
||||||
GBResource GBResourceOpen(GBEngine engine, const char* path) {
|
GSResource GSResourceOpen(GSEngine engine, const char* path) {
|
||||||
GBResource resource = malloc(sizeof(*resource));
|
GSResource resource = malloc(sizeof(*resource));
|
||||||
unsigned char sig[4];
|
unsigned char sig[4];
|
||||||
|
|
||||||
memset(resource, 0, sizeof(*resource));
|
memset(resource, 0, sizeof(*resource));
|
||||||
|
|
||||||
if((resource->file = GBFileOpen(engine, path)) == NULL) {
|
if((resource->file = GSFileOpen(engine, path)) == NULL) {
|
||||||
GBResourceClose(resource);
|
GSResourceClose(resource);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GBFileRead(resource->file, sig, 4) < 4) {
|
if(GSFileRead(resource->file, sig, 4) < 4) {
|
||||||
GBResourceClose(resource);
|
GSResourceClose(resource);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(memcmp(sig, res_sig, 4) != 0) {
|
if(memcmp(sig, res_sig, 4) != 0) {
|
||||||
GBLog(GBLogError, "%s: Resource has wrong signature", path);
|
GSLog(GSLogError, "%s: Resource has wrong signature", path);
|
||||||
GBResourceClose(resource);
|
GSResourceClose(resource);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return resource;
|
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];
|
char fn[129];
|
||||||
|
|
||||||
fn[128] = 0;
|
fn[128] = 0;
|
||||||
|
|
||||||
GBFileSeek(resource->file, 4);
|
GSFileSeek(resource->file, 4);
|
||||||
|
|
||||||
while(!(GBFileRead(resource->file, fn, 128) < 128 || fn[0] == 0)) {
|
while(!(GSFileRead(resource->file, fn, 128) < 128 || fn[0] == 0)) {
|
||||||
GBU32 actsz = 0;
|
GSU32 actsz = 0;
|
||||||
GBU32 cmpsz = 0;
|
GSU32 cmpsz = 0;
|
||||||
int i;
|
int i;
|
||||||
void* d;
|
void* d;
|
||||||
|
|
||||||
if(GBFileRead(resource->file, &actsz, 4) < 4) return NULL;
|
if(GSFileRead(resource->file, &actsz, 4) < 4) return NULL;
|
||||||
if(GBFileRead(resource->file, &cmpsz, 4) < 4) return NULL;
|
if(GSFileRead(resource->file, &cmpsz, 4) < 4) return NULL;
|
||||||
|
|
||||||
actsz = GBEndianSwapU32BE(actsz);
|
actsz = GSEndianSwapU32BE(actsz);
|
||||||
cmpsz = GBEndianSwapU32BE(cmpsz);
|
cmpsz = GSEndianSwapU32BE(cmpsz);
|
||||||
|
|
||||||
*size = actsz;
|
*size = actsz;
|
||||||
|
|
||||||
d = malloc(cmpsz);
|
d = malloc(cmpsz);
|
||||||
if(GBFileRead(resource->file, d, cmpsz) < cmpsz) {
|
if(GSFileRead(resource->file, d, cmpsz) < cmpsz) {
|
||||||
free(d);
|
free(d);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -78,8 +78,8 @@ void* GBResourceGet(GBResource resource, const char* name, unsigned int* size) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBResourceClose(GBResource resource) {
|
void GSResourceClose(GSResource resource) {
|
||||||
if(resource->file != NULL) GBFileClose(resource->file);
|
if(resource->file != NULL) GSFileClose(resource->file);
|
||||||
|
|
||||||
free(resource);
|
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) {
|
GSServer GSServerCreate(GSEngine engine) {
|
||||||
GBServer server = malloc(sizeof(*server));
|
GSServer server = malloc(sizeof(*server));
|
||||||
|
|
||||||
memset(server, 0, sizeof(*server));
|
memset(server, 0, sizeof(*server));
|
||||||
|
|
||||||
server->engine = engine;
|
server->engine = engine;
|
||||||
|
|
||||||
GBLog(GBLogInfo, "Created server");
|
GSLog(GSLogInfo, "Created server");
|
||||||
|
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBServerDestroy(GBServer server) {
|
void GSServerDestroy(GSServer server) {
|
||||||
free(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 <GearSrc/GL.h>
|
||||||
#include <GearBox/String.h>
|
#include <GearSrc/String.h>
|
||||||
|
|
||||||
GBSkyBox GBSkyBoxOpen(GBClient client, const char* base) {
|
GSSkyBox GSSkyBoxOpen(GSClient client, const char* base) {
|
||||||
GBSkyBox skybox = malloc(sizeof(*skybox));
|
GSSkyBox skybox = malloc(sizeof(*skybox));
|
||||||
char* p;
|
char* p;
|
||||||
void* ptr[12];
|
void* ptr[12];
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -27,10 +27,10 @@ GBSkyBox GBSkyBoxOpen(GBClient client, const char* base) {
|
||||||
ptr[11] = "/down.png";
|
ptr[11] = "/down.png";
|
||||||
|
|
||||||
for(i = 0; i < 12; i += 2) {
|
for(i = 0; i < 12; i += 2) {
|
||||||
p = GBStringConcat(base, ptr[i + 1]);
|
p = GSStringConcat(base, ptr[i + 1]);
|
||||||
if(!GBGLTextureLoadFile(client->gl, ptr[i], NULL, NULL, p)) {
|
if(!GSGLTextureLoadFile(client->gl, ptr[i], NULL, NULL, p)) {
|
||||||
free(p);
|
free(p);
|
||||||
GBSkyBoxClose(skybox);
|
GSSkyBoxClose(skybox);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
free(p);
|
free(p);
|
||||||
|
|
@ -39,12 +39,12 @@ GBSkyBox GBSkyBoxOpen(GBClient client, const char* base) {
|
||||||
return skybox;
|
return skybox;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBSkyBoxDraw(GBSkyBox skybox) {
|
void GSSkyBoxDraw(GSSkyBox skybox) {
|
||||||
GBGL gl = skybox->engine->client->gl;
|
GSGL gl = skybox->engine->client->gl;
|
||||||
int i;
|
int i;
|
||||||
GBVector3 v[4];
|
GSVector3 v[4];
|
||||||
GBVector2 t[4];
|
GSVector2 t[4];
|
||||||
GBNumber s = 0.0001;
|
GSNumber s = 0.0001;
|
||||||
|
|
||||||
t[0][0] = 0, t[0][1] = 0;
|
t[0][0] = 0, t[0][1] = 0;
|
||||||
|
|
||||||
|
|
@ -54,8 +54,8 @@ void GBSkyBoxDraw(GBSkyBox skybox) {
|
||||||
|
|
||||||
t[3][0] = 1, t[3][1] = 0;
|
t[3][0] = 1, t[3][1] = 0;
|
||||||
|
|
||||||
GBGLIgnoreDepth(gl);
|
GSGLIgnoreDepth(gl);
|
||||||
GBGLShadowDisable(gl);
|
GSGLShadowDisable(gl);
|
||||||
|
|
||||||
for(i = 0; i < 6; i++) {
|
for(i = 0; i < 6; i++) {
|
||||||
GLuint tex;
|
GLuint tex;
|
||||||
|
|
@ -107,23 +107,23 @@ void GBSkyBoxDraw(GBSkyBox skybox) {
|
||||||
|
|
||||||
for(j = 0; j < 4; j++) {
|
for(j = 0; j < 4; j++) {
|
||||||
for(k = 0; k < 3; k++) {
|
for(k = 0; k < 3; k++) {
|
||||||
v[j][k] *= GBGLMaxDistance / 2;
|
v[j][k] *= GSGLMaxDistance / 2;
|
||||||
v[j][k] += gl->engine->client->camera[k];
|
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);
|
GSGLShadowEnable(gl);
|
||||||
GBGLCareDepth(gl);
|
GSGLCareDepth(gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBSkyBoxClose(GBSkyBox skybox) {
|
void GSSkyBoxClose(GSSkyBox skybox) {
|
||||||
if(skybox->left > 0) GBGLTextureDelete(skybox->engine->client->gl, skybox->left);
|
if(skybox->left > 0) GSGLTextureDelete(skybox->engine->client->gl, skybox->left);
|
||||||
free(skybox);
|
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);
|
char* s = malloc(strlen(str) + 1);
|
||||||
|
|
||||||
strcpy(s, str);
|
strcpy(s, str);
|
||||||
|
|
@ -8,7 +8,7 @@ char* GBStringDuplicate(const char* str) {
|
||||||
return s;
|
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);
|
char* r = malloc(strlen(str1) + strlen(str2) + 1);
|
||||||
|
|
||||||
strcpy(r, str1);
|
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->majorlevel = 0;
|
||||||
version->minorlevel = 0;
|
version->minorlevel = 0;
|
||||||
version->patchlevel = 0;
|
version->patchlevel = 0;
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ endmacro()
|
||||||
|
|
||||||
file(GLOB lz4_SRC ../lz4/*.c)
|
file(GLOB lz4_SRC ../lz4/*.c)
|
||||||
|
|
||||||
compile_tool(gb_dumpfont)
|
compile_tool(gs_dumpfont)
|
||||||
compile_tool(gb_makepak)
|
compile_tool(gs_makepak)
|
||||||
|
|
||||||
target_include_directories(gb_makepak PRIVATE ../lz4)
|
target_include_directories(gs_makepak PRIVATE ../lz4)
|
||||||
target_sources(gb_makepak PRIVATE ${lz4_SRC})
|
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) {
|
int main(int argc, char** argv) {
|
||||||
unsigned char dat[128];
|
unsigned char dat[128];
|
||||||
|
|
||||||
printf("GearBox Engine resource packer\n");
|
printf("GearSrc Engine resource packer\n");
|
||||||
if(argc >= 2) {
|
if(argc >= 2) {
|
||||||
out = fopen(argv[1], "wb");
|
out = fopen(argv[1], "wb");
|
||||||
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/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