halflife-thewastes-sdk/common/twm.h

97 lines
2.0 KiB
C

/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
//
// The Wastes Model format description
//
#ifndef __TWM_H_
#define __TWM_H_
#define TWM_ID (('1'<<24)+('M'<<16)+('W'<<8)+'T') // little-endian "TWM1" -> bitwise shifts rock
#define TWM_MAJOR_VERSION 2
#define TWM_MINOR_VERSION 0
typedef float twm_vert_t[3];
typedef struct twm_triangle_s
{
short vert_indices[3]; // index into vertex_lump
// Texture info
float u[3];
float v[3];
} twm_triangle_t;
typedef struct twm_materialgroup_s
{
#ifdef CLIENT_DLL
int sprite_handle; // Used for rendering
#endif
char texturename[64];
// Triangle list
short num_triangles;
short *tris_indices; // indices into triangle_lump
} twm_materialgroup_t;
typedef struct twm_info_s
{
// Header stuff
int header_id;
short major_version;
short minor_version;
// Vertices
short num_vertices;
twm_vert_t *vertex_lump;
// Tris
short num_tris;
twm_triangle_t *triangle_lump;
// Material groups
short num_materialgroups;
twm_materialgroup_t *materialgroup_lump;
} twm_info_t;
#ifdef CLIENT_DLL
// Extra data support for client.dll
typedef struct twm_clientinfo_s
{
// origin info
cl_entity_t *attached_ent;
int attachment_num; // which attachment to draw from
// update info
float fadetime;
int dead; // if true we need to remove this ent
// triAPI info
int render_mode;
int sprite_frame;
float brightness;
float color[4];
// We grab a pointer to twm_info
// LEAVE AS READ ONLY!
// if we change data in here we
// would change in all models
// that use this information!
const twm_info_t *twm_info;
} twm_clientinfo_t;
#endif // CLIENT_DLL
#endif // __TWM_H_