home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2006 July & August
/
PCWorld_2006-07-08_cd.bin
/
temacd
/
planearcade
/
planearcade.exe
/
Tank3.bmp
/
q3structs.h
< prev
next >
Wrap
Text File
|
2004-04-12
|
10KB
|
308 lines
///////////////////////////////////////////////
//original zdrojak: Jan Koci (koci.opengl.cz)//
//upravil: Peter AdamΦφk //
///////////////////////////////////////////////
///////////////
// Struktury //
///////////////
// This is our BSP header structure
// HlaviΦka souboru BSP
struct TBspHeader
{
// This should always be 'IBSP'
// Identifikßtor, kter² musφ b²t v₧dy °et∞zec IBSP
char pc_id[4];
// This should be 0x2e for Quake 3 files
// Verze, kterß musφ mφt hodnotu 0x2e
int i_version;
};
// This is our BSP lump structure
// Struktura BSP identifikßtor∙
struct TBspLump
{
// The offset into the file for the start of this lump
// Informace pot°ebnß p°i naΦφtßnφ BSP souboru,
// podle kterΘ se urΦuje, kterß z polo₧ek scΘny se mß prßv∞ naΦφtat
int i_offset;
// The length in bytes for this lump
// Celkovß velikost identifikßtor∙
int i_length;
};
// This is our BSP vertex structure
// Struktura vrchol∙ BSP scΘny
struct TBspVertex
{
// (x, y, z) position.
// xyz pozice
float pf_position[3];
// (u, v) texture coordinate
// Texturovß koordinace
float pf_texture_coord[2];
// (u, v) lightmap coordinate
// Texturovß koordinace sv∞teln²ch map (lightmap)
float pf_lightmap_coord[2];
// (x, y, z) normal vector
// Normßlov² vektor vrcholu
float pf_normal[3];
// RGBA color for the vertex
// RGBA barevnß hodnota vrcholu
byte pby_color[4];
};
// This is our BSP face structure
// Struktura ploÜek BSP scΘny
struct TBspFace
{
// The index into the texture array
// IdentifikßΦnφ Φφslo textury
int i_texture_id;
// The index for the effects (or -1 = n/a)
// IdentifikaΦnφ Φφslo efekt∙ (hodnoty se zatφm nenaΦφtajφ)
int i_effect;
// 1=polygon, 2=patch, 3=mesh, 4=billboard
// Typ ploÜky viz. v²Üe
int i_type;
// The starting index into this face's first vertex
// Index prvnφho vrcholu ploÜky
int i_start_vert_index;
// The number of vertices for this face
// PoΦet vrchol∙ ploÜky
int i_num_of_verts;
// The index into the first meshvertex
// Index prvnφho vrcholu skupiny vrchol∙ (hodnoty se zatφm nenaΦφtajφ)
int i_mesh_vert_index;
// The number of mesh vertices
// PoΦet vrchol∙ ve skupin∞ vrchlol∙ (hodnoty se zatφm nenaΦφtajφ)
int i_num_mesh_verts;
// The texture index for the lightmap
// IdentifikaΦnφ Φφslo lightmap textury
int i_lightmap_id;
// The face's lightmap corner in the image
// RohovΘ ploÜky lightmap (hodnoty se zatφm nenaΦφtßjφ)
int pi_lightmap_corner[2];
// The size of the lightmap section
// Velikost lightmap Φßstice (hodnoty se zatφm nenaΦφtajφ)
int pi_lightmap_size[2];
// The 3D origin of lightmap.
// Pozice 3D lightmapy (hodnoty se zatφm nenaΦφtajφ)
float pf_lightmap_pos[3];
// The 3D space for s and t unit vectors.
// 3D prostor pro "st! vektorovΘ jednotky 3D lightmap (hodnoty se zatφm nenaΦφtajφ)
float ppf_lightmap_vectors[3][2];
// The face normal.
// Normßlov² vektor ploÜky (hodnoty se zatφm nenaΦφtajφ)
float pf_normal[3];
// The bezier patch dimensions.
// Velikost bezierovy plochy (hodnoty se zatφm nenaΦφtajφ)
int pi_bezier_size[2];
};
// This is our BSP texture structure
// Struktura textur BSP scΘny
struct TBspTexture
{
// The name of the texture w/o the extension
// JmΘno textury
char pc_filename[64];
// The surface flags (unknown)
// PovrchovΘ vlajky (hodnoty se zatφm nenaΦφtajφ)
int i_flags;
// The content flags (unknown)
// Obsah vlajek (hodnoty se zatφm nenaΦφtajφ)
int i_flag_contents;
};
// This is our BSP lightmap structure which stores the 128x128 RGB values
// Struktura lightmap, kterΘ jsou tvo°eny o velikosti 128x128 a RGB barev
struct TBspLightmap
{
// The RGB data in a 128x128 image
// Schrßnka pro RGB hodnoty barev lightmap a jejich velikost 128x128
byte pppby_image_bits[128][128][3];
};
// This stores a node in the BSP tree
// Struktura uzl∙ BSP stromu
struct TBspNode
{
// The index into the planes array
// IdentifikaΦnφ Φφslo ploch
int i_plane;
// The child index for the front node
// IdentifikaΦnφ Φφslo dce°innΘho p°ednφho uzlu
int i_front;
// The child index for the back node
// IdentifikaΦnφ Φφslo dce°innΘho zadnφho uzlu
int i_back;
// The bounding box min position.
// Minimßlnφ hodnota koliznφho boxu (hodnoty se zatφm nenaΦφtajφ)
int pi_min_box[3];
// The bounding box max position.
// Maximßlnφ hodnota koliznφho boxu (hodnoty se zatφm nenaΦφtajφ)
int pi_max_box[3];
};
// This stores a leaf (end node) in the BSP tree
// Struktura list∙ (leaf) uzl∙ (node) BSP stromu
struct TBspLeaf
{
// The visibility cluster
// IdentifikaΦnφ Φφslo klastr∙ (cluster)
// Podle hodnoty clusteru se vyhledßvajφ listy BSP stromu
int i_cluster;
// The area portal
// Rozsah portßlu (hodnoty se zatφm nenaΦφtajφ)
int i_area;
// The bounding box min position
// Minimßlnφ hodnota koliznφho boxu (hodnoty se zatφm nenaΦφtajφ)
int pi_min_box[3];
// The bounding box max position
// Maximßlnφ hodnota koliznφho boxu (hodnoty se zatφm nenaΦφtajφ)
int pi_max_box[3];
// The first index into the face array
// IdentifikaΦnφ Φφslo ploÜky listu
int i_leaf_face;
// The number of faces for this leaf
// PoΦet ploÜek listu
int i_num_of_leaf_faces;
// The first index for into the brushes
// IdentifikaΦnφ Φφslo koliznφch srß₧ek (hodnoty se zatφm nenaΦφtajφ)
int i_leaf_brush;
// The number of brushes for this leaf
// PoΦet koliznφch srß₧ek tohoto listu (hodnoty se zatφm nenaΦφtajφ)
int i_num_of_leaf_brushes;
};
// This stores a splitter plane in the BSP tree
// Struktura d∞licφch ploch BSP stromu
struct TBspPlane
{
// Plane normal.
// Normßlov² vektor plochy
float pf_normal[3];
// The plane distance from origin
// Vzdßlenost od plochy kdy dochßzφ k detekci bodu s d∞licφ plochou
float f_distance;
};
// This stores the cluster data for the PVS's (Potential Visibility Sets)
// Struktura dat klastr∙ (cluster) pro PVS (Nastavenφ mo₧nΘ viditelnosti)
struct TBspVisData
{
// The number of clusters
// PoΦet klastr∙
int i_num_of_clusters;
// The amount of bytes (8 bits) in the cluster's bitset
// Mno₧stvφ byt∙ (1byte = 8bit∙) v klastrovΘ (cluster) informaci
int i_bytes_per_cluster;
// The array of bytes that holds the cluster bitsets
// ╪et∞zec bitov²ch informacφ klastru
byte *pby_cluster_bitsets;
};
// Struktura dat srß₧ek pro detekce kolizφ
struct TBspBrush
{
int i_brush_side; // Startovacφ strana srß₧ky
int i_num_of_brush_sides; // PoΦet stran srß₧ek
int i_texture_id; // Index textury srß₧ky
};
// Struktura d∞licφch ploch srß₧ek
struct TBspBrushSides
{
int i_plane; // Index d∞licφ plochy
int i_texture_id; // Index textury
};
// Struktura detekΦnφch box∙
struct TBspBoundingBox
{
int pi_bounding_face[6];
int pi_bounding_vertex[8];
};
// Struktura. stφn∙, a dalÜφch efekt∙, jako
// mlha, dve°e, okna, obloha, ohe≥, snφh...
struct TBspShader
{
char pc_name[64]; // Nßzev efektu
int i_brush_index; // Index braÜe
int i_unknown; // Neznßmß hodnota, snad Φas, nebo rychlos animace
};
// Struktura. model∙..
struct TBspModel
{
// The bounding box min position
// Minimßlnφ hodnota koliznφho boxu
int pi_min_box[3];
// The bounding box max position
// Maximßlnφ hodnota koliznφho boxu
int pi_max_box[3];
// The first index into the face array
// IdentifikaΦnφ Φφslo prvnφ ploÜky listu
int i_face_index;
// The number of faces for this leaf
// PoΦet ploÜek listu
int i_num_of_faces;
// The first index for into the brushes
// IdentifikaΦnφ Φφslo koliznφch srß₧ek
int i_brush_index;
// The number of brushes for this leaf
// PoΦet koliznφch srß₧ek tohoto listu
int i_num_of_brushes;
};