rename
This commit is contained in:
parent
472e21e389
commit
2d6ed53abc
56 changed files with 746 additions and 746 deletions
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
|
||||
4793
engine/include/GearSrc/GL/GL.h
Normal file
4793
engine/include/GearSrc/GL/GL.h
Normal file
File diff suppressed because it is too large
Load diff
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
|
||||
22
engine/include/GearSrc/MachDep.h
Normal file
22
engine/include/GearSrc/MachDep.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef __GEARBOX_MACHDEP_H__
|
||||
#define __GEARBOX_MACHDEP_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _GEARBOX
|
||||
#include <gbnet.h>
|
||||
#endif
|
||||
|
||||
#if defined(_GEARBOX) && defined(_WIN32)
|
||||
#define GSDECL extern __declspec(dllexport)
|
||||
#elif defined(_WIN32)
|
||||
#define GSDECL extern __declspec(dllimport)
|
||||
#else
|
||||
#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
|
||||
17
engine/include/GearSrc/Version.h
Normal file
17
engine/include/GearSrc/Version.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef __GEARBOX_VERSION_H__
|
||||
#define __GEARBOX_VERSION_H__
|
||||
|
||||
#include <GearSrc/MachDep.h>
|
||||
#include <GearSrc/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GSDECL void GSVersionGet(GSVersion* version);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue