source: golgotha/src/max_plugin/max_object.hh @ 484

Last change on this file since 484 was 80, checked in by Sam Hocevar, 14 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.9 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef M1_MAX_OBJECT_HH
10#define M1_MAX_OBJECT_HH
11
12#include "obj3d.hh"
13#include "load3d.hh"
14#include "memory/array.hh"
15#include "loaders/dir_save.hh"
16
17class i4_grow_heap_class;
18extern i4_grow_heap_class *m1_object_heap;
19
20// derive off of g1 quad so we can store the string texture name name
21class m1_quad_class : public g1_quad_class
22{
23public:
24  char texture_name[256];
25  m1_quad_class() {}
26  m1_quad_class(w16 a, w16 b, w16 c, w16 d=0xffff) { set(a,b,c,d); flags = 0; }
27
28  i4_bool set(w16 a, w16 b, w16 c, w16 d=0xffff);
29
30  void set_texture(char *name);
31  void calc_texture(int reverse,
32                    i4_array<g1_vert_class> &verts, w16 vert_off,
33                    char *texture_name);
34
35  void calc_texture_scale(i4_array<g1_vert_class> &verts, w16 vert_off);
36};
37 
38
39
40// derive off of g1 animation so we can store the string animation name
41class m1_animation_class : public g1_quad_object_class::animation_class
42{
43public:
44  i4_str *animation_name;
45  i4_array<g1_vert_class>                     vertex_a;
46
47  void set_name(const i4_const_str &animation_n)
48  {
49    if (animation_name) delete animation_name;
50    animation_name=new i4_str(animation_n);
51  }
52
53  m1_animation_class(const i4_const_str &name)
54    : animation_name(new i4_str(name)),
55      vertex_a(1,20) {}
56
57  m1_animation_class()
58    : animation_name(0),
59      vertex_a(1,20) {}
60
61  ~m1_animation_class()
62  {
63    if (animation_name)
64      delete animation_name;
65  }
66};
67
68class m1_mount_point_class
69{
70public:
71  i4_str *name;
72  i4_3d_vector offset;
73
74  m1_mount_point_class(i4_str *name, const i4_3d_vector &offset): name(name), offset(offset) {}
75
76  ~m1_mount_point_class()
77  {
78    if (name)
79      delete name;
80  }
81};
82
83class m1_poly_object_class : public g1_quad_object_class
84{
85  void save_quads(i4_saver_class *fp);
86  void save_texture_names(i4_saver_class *fp);
87  void save_vert_animations(i4_saver_class *fp);
88  void save_mount_points(i4_saver_class *fp);
89 
90  void calc_quad_normal(i4_array<g1_vert_class> &v,
91                       m1_quad_class &q);
92  void calc_vert_normals();
93public:
94  i4_array<m1_quad_class *>        quad_a;
95  i4_array<m1_animation_class *>   anim_a;
96  i4_array<m1_mount_point_class *> mount_a;
97
98  void cleanup();
99  void save(i4_saver_class *fp);
100
101  m1_poly_object_class() : quad_a(256,10), anim_a(256,100), mount_a(10,10) {}
102  ~m1_poly_object_class() { cleanup(); }
103};
104
105#endif
106
Note: See TracBrowser for help on using the repository browser.