00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef MATERIAL_LIST_H__
00022 #define MATERIAL_LIST_H__
00023
00024 #include "NameList.h"
00025 #include "ResizeArray.h"
00026
00027 class Displayable;
00028
00030 struct Material {
00031 float ambient;
00032 float specular;
00033 float diffuse;
00034 float shininess;
00035 float opacity;
00036 float outline;
00037 float outlinewidth;
00038 float transmode;
00039 int ind;
00040 };
00041
00042
00044 enum MaterialProperty {
00045 MAT_AMBIENT, MAT_SPECULAR, MAT_DIFFUSE, MAT_SHININESS, MAT_OPACITY,
00046 MAT_OUTLINE, MAT_OUTLINEWIDTH, MAT_TRANSMODE
00047 };
00048
00049
00051 class MaterialList {
00052 protected:
00053
00054 NameList<Material *> *mlist;
00055
00056
00057
00058 Displayable *root;
00059
00060
00061 void notify(int);
00062
00063
00064 int matcounter;
00065
00066 public:
00067
00068 MaterialList(Displayable *);
00069 ~MaterialList();
00070
00071
00072
00073
00074 int num() const { return mlist->num(); }
00075 const char *material_name(int i) const { return mlist->name(i); }
00076 const Material *material(int i) const { return mlist->data(i); }
00077
00078
00079
00080 int material_index(const char *nm) const { return mlist->typecode(nm); }
00081
00082
00083 void set_name(int, const char *);
00084 void set_ambient(int, float);
00085 void set_specular(int, float);
00086 void set_diffuse(int, float);
00087 void set_shininess(int, float);
00088 void set_opacity(int, float);
00089 void set_outline(int, float);
00090 void set_outlinewidth(int, float);
00091 void set_transmode(int, float);
00092
00093
00094 float get_ambient(int);
00095 float get_specular(int);
00096 float get_diffuse(int);
00097 float get_shininess(int);
00098 float get_opacity(int);
00099 float get_outline(int);
00100 float get_outlinewidth(int);
00101 float get_transmode(int);
00102
00103
00104
00105
00106
00107 const char *add_material(const char *name, const char *copyfrom);
00108
00109
00110 int delete_material(int);
00111
00112
00113 int restore_default(int);
00114 };
00115
00116 #endif
00117