/
noire-dev
/
SourceTech
Обзор
Документация
Войти
/
noire-dev
/
SourceTech
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
sourcetech
code/qcommon/qfiles.h
301 строка
7 KB
Noire.dev
Update qfiles.h
26 окт 2025, 00:33
Не верифицирован
26 окт 2025, 00:33
a1e0a67
Код
Авторство
О чём код?
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Quake III Arena source code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Quake III Arena source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ #ifndef __QFILES_H__ #define __QFILES_H__ // // qfiles.h: quake file formats // This file must be identical in the quake and utils directories // // surface geometry should not exceed these limits #define SHADER_MAX_VERTEXES 65535 #define SHADER_MAX_INDEXES (6*SHADER_MAX_VERTEXES) /* ======================================================================== QVM files ======================================================================== */ #define VM_MAGIC_VER3 0x12721446 typedef struct { int32_t vmMagic; int32_t instructionCount; int32_t codeOffset; int32_t codeLength; int32_t dataOffset; int32_t dataLength; int32_t litLength; // ( dataLength - litLength ) should be byteswapped on load int32_t bssLength; // zero filled memory appended to datalength //!!! below here is VM_MAGIC_VER2 !!! int32_t jtrgLength; // number of jump table targets } vmHeader_t; /* ======================================================================== .MD3 triangle model file format ======================================================================== */ #define MD3_IDENT (('3'<<24)+('P'<<16)+('D'<<8)+'I') #define MD3_VERSION 15 // limits #define MD3_MAX_LODS 3 #define MD3_MAX_TRIANGLES 65535*3 // per surface for embedded importer #define MD3_MAX_VERTS 32768*6 // per surface for embedded importer #define MD3_MAX_SHADERS 256 // per surface for embedded importer #define MD3_MAX_FRAMES 1024 // per model #define MD3_MAX_SURFACES 128 // per model for embedded importer #define MD3_MAX_TAGS 64 // per frame // vertex scales #define MD3_XYZ_SCALE (1.0/64) typedef struct md3Frame_s { vec3_t bounds[2]; vec3_t localOrigin; float radius; char name[16]; } md3Frame_t; typedef struct md3Tag_s { char name[MAX_QPATH]; // tag name vec3_t origin; vec3_t axis[3]; } md3Tag_t; /* ** md3Surface_t ** ** CHUNK SIZE ** header sizeof( md3Surface_t ) ** shaders sizeof( md3Shader_t ) * numShaders ** triangles[0] sizeof( md3Triangle_t ) * numTriangles ** st sizeof( md3St_t ) * numVerts ** XyzNormals sizeof( md3XyzNormal_t ) * numVerts * numFrames */ typedef struct { int32_t ident; // char name[MAX_QPATH]; // polyset name int32_t flags; int32_t numFrames; // all surfaces in a model should have the same int32_t numShaders; // all surfaces in a model should have the same int32_t numVerts; int32_t numTriangles; uint32_t ofsTriangles; uint32_t ofsShaders; // offset from start of md3Surface_t uint32_t ofsSt; // texture coords are common for all frames uint32_t ofsXyzNormals; // numVerts * numFrames uint32_t ofsEnd; // next surface follows } md3Surface_t; typedef struct { char name[MAX_QPATH]; int shaderIndex; // for in-game use } md3Shader_t; typedef struct { int indexes[3]; } md3Triangle_t; typedef struct { float st[2]; } md3St_t; typedef struct { short xyz[3]; short normal; } md3XyzNormal_t; typedef struct { int32_t ident; int32_t version; char name[MAX_QPATH]; // model name uint32_t flags; int32_t numFrames; int32_t numTags; int32_t numSurfaces; int32_t numSkins; uint32_t ofsFrames; // offset for first frame uint32_t ofsTags; // numFrames * numTags uint32_t ofsSurfaces; // first surface, others follow uint32_t ofsEnd; // end of file } md3Header_t; /* ============================================================================== .BSP file format ============================================================================== */ #define BSP_VERSION 46 typedef struct { int32_t fileofs; int32_t filelen; } lump_t; #define LUMP_ENTITIES 0 #define LUMP_SHADERS 1 #define LUMP_PLANES 2 #define LUMP_NODES 3 #define LUMP_LEAFS 4 #define LUMP_LEAFSURFACES 5 #define LUMP_LEAFBRUSHES 6 #define LUMP_MODELS 7 #define LUMP_BRUSHES 8 #define LUMP_BRUSHSIDES 9 #define LUMP_DRAWVERTS 10 #define LUMP_DRAWINDEXES 11 #define LUMP_FOGS 12 #define LUMP_SURFACES 13 #define LUMP_LIGHTMAPS 14 #define LUMP_LIGHTGRID 15 #define LUMP_VISIBILITY 16 #define HEADER_LUMPS 17 typedef struct { int ident; int version; lump_t lumps[HEADER_LUMPS]; } dheader_t; typedef struct { float mins[3], maxs[3]; int firstSurface, numSurfaces; int firstBrush, numBrushes; } dmodel_t; typedef struct { char shader[MAX_QPATH]; int surfaceFlags; int contentFlags; } dshader_t; // planes x^1 is always the opposite of plane x typedef struct { float normal[3]; float dist; } dplane_t; typedef struct { int planeNum; int children[2]; // negative numbers are -(leafs+1), not nodes int mins[3]; // for frustom culling int maxs[3]; } dnode_t; typedef struct { int cluster; // -1 = opaque cluster (do I still store these?) int area; int mins[3]; // for frustum culling int maxs[3]; int firstLeafSurface; int numLeafSurfaces; int firstLeafBrush; int numLeafBrushes; } dleaf_t; typedef struct { int planeNum; // positive plane side faces out of the leaf int shaderNum; } dbrushside_t; typedef struct { int firstSide; int numSides; int shaderNum; // the shader that determines the contents flags } dbrush_t; typedef struct { char shader[MAX_QPATH]; int brushNum; int visibleSide; // the brush side that ray tests need to clip against (-1 == none) } dfog_t; typedef struct { vec3_t xyz; float st[2]; float lightmap[2]; vec3_t normal; color4ub_t color; } drawVert_t; typedef enum { MST_BAD, MST_PLANAR, MST_PATCH, MST_TRIANGLE_SOUP, MST_FLARE } mapSurfaceType_t; typedef struct { int shaderNum; int fogNum; int surfaceType; int firstVert; int numVerts; int firstIndex; int numIndexes; int lightmapNum; int lightmapX, lightmapY; int lightmapWidth, lightmapHeight; vec3_t lightmapOrigin; vec3_t lightmapVecs[3]; // for patches, [0] and [1] are lodbounds int patchWidth; int patchHeight; } dsurface_t; #endif