www.pudn.com > map_editor.rar > e3d.h


#ifndef __E3D_H__
#define __E3D_H__

#define MAX_OBJ_3D 15000
#define MAX_E3D_CACHE 1000

#ifdef	NEW_E3D_FORMAT

#include "../elc/md5.h"
#include "../elc/e3d_object.h"

#else	// NEW_E3D_FORMAT

//the new array structures
typedef struct
{
  float x;
  float y;
  float z;
}e3d_array_vertex;

typedef struct
{
  float nx;
  float ny;
  float nz;
}e3d_array_normal;

typedef struct
{
  float u;
  float v;
}e3d_array_uv_main;

typedef struct
{
  float u;
  float v;
}e3d_array_uv_detail;

typedef struct
{
  int texture_id;
  int count;
  int start;
}e3d_array_order;

//end of the new things

typedef struct
{
	int material_id;
	char material_name[40];
}e3d_material;

typedef struct
{
  float x;
  float y;
  float z;

  float nx;
  float ny;
  float nz;
}e3d_vertex;

typedef struct
{
  int a;
  int b;
  int c;
  float au;
  float av;
  float bu;
  float bv;
  float cu;
  float cv;
  int material;
}e3d_face;


typedef struct
{
	char magic[4];
	int face_no;
	int face_size;
	int face_offset;
	int vertex_no;
	int vertex_size;
	int vertex_offset;
	int material_no;
	int material_size;
	int material_offset;
	float min_x;
	float min_y;
	float min_z;
	float max_x;
	float max_y;
	float max_z;
	int crc;
	char is_ground;
	char char_reserved_1;
	char char_reserved_2;
	char char_reserved_3;
	int reserved_2;
	int reserved_3;
	int reserved_4;
	int reserved_5;
	int reserved_6;
	char is_transparent;

}e3d_header;

typedef struct
{
	e3d_array_vertex *array_vertex;
	e3d_array_normal *array_normal;
	e3d_array_uv_main *array_uv_main;
	e3d_array_order *array_order;
	int materials_no;
	int face_no;
	float min_x;
	float min_y;
	float min_z;
	float max_x;
	float max_y;
	float max_z;
	char is_transparent;
	char is_ground;

}e3d_object;
#endif	// NEW_E3D_FORMAT

typedef struct
{
   char file_name[80];
   float x_pos;
   float y_pos;
   float z_pos;

   float x_rot;
   float y_rot;
   float z_rot;

   char self_lit;
   char blended;
   float r,g,b;
#ifndef	NEW_E3D_FORMAT
   e3d_array_uv_detail *clouds_uv;
#endif	// NEW_E3D_FORMAT

   e3d_object *e3d_data;
   unsigned int last_acessed_time;
}object3d;

typedef struct
{
	char file_name[128];
	e3d_object * e3d_id;
	int flag_for_destruction;
}e3d_cache_struct;

extern e3d_cache_struct e3d_cache[1000];


extern object3d *objects_list[MAX_OBJ_3D];


//proto
e3d_object * load_e3d(char *file_name);

#endif