00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef AMN_SMATERIAL_H
00028 #define AMN_SMATERIAL_H
00029
00030 namespace amn
00031 {
00032 class IMaterialRenderer;
00033 class STexture;
00034
00035 enum E_MATERIAL_TYPE
00036 {
00038 EMT_WIREFRAME = 0,
00040 EMT_SOLID,
00042 EMT_TRANSPARENT_ALPHA,
00044 EMT_TRANSPARENT_VERTEX_ALPHA,
00046 EMT_TRANSPARENT_ADD_COLOR,
00048 EMT_LIGHTMAP,
00050 EMT_CUSTOM_SOLID,
00052 EMT_CUSTOM_TRANSPARENT
00053 };
00054
00055 class SColor
00056 {
00057 public:
00059 SColor() {color.full = 0;}
00061 SColor(int a, int r, int g, int b) {set(a,r,g,b);}
00062
00064 SColor(const SColor& copy)
00065 {
00066
00067 }
00068
00070 inline void set(int a, int r, int g, int b)
00071 {
00072 color.indv[0] = a;
00073 color.indv[1] = r;
00074 color.indv[2] = g;
00075 color.indv[3] = b;
00076 }
00077
00079 inline unsigned char getAlpha() { return color.indv[0]; }
00081 inline unsigned char getRed() { return color.indv[1]; }
00083 inline unsigned char getBlue() { return color.indv[2]; }
00085 inline unsigned char getGreen() { return color.indv[3]; }
00086
00088 inline int getIntegerColor() { return color.full; }
00089
00090 private:
00091 union
00092 {
00093 int full;
00094 unsigned char indv[4];
00095 }color;
00096 };
00097
00098 class SMaterial
00099 {
00100 public:
00102 SMaterial()
00103 {
00104 materialType = EMT_SOLID;
00105 materialRenderer = NULL;
00106
00107 Texture1 = 0;
00108 Texture2 = 0;
00109 Texture3 = 0;
00110 Texture4 = 0;
00111 Texture5 = 0;
00112 Texture6 = 0;
00113 Texture7 = 0;
00114 Texture8 = 0;
00115
00116 flagLighting = true;
00117 flagDepthTesting = true;
00118 flagBlending = false;
00119 }
00121 SMaterial(const SMaterial& copy)
00122 {
00123 memcpy(this, ©, sizeof(SMaterial));
00124 }
00125
00127 E_MATERIAL_TYPE materialType;
00129 IMaterialRenderer* materialRenderer;
00130
00131 union
00132 {
00133 struct
00134 {
00135 STexture* Texture1;
00136 STexture* Texture2;
00137 STexture* Texture3;
00138 STexture* Texture4;
00139 STexture* Texture5;
00140 STexture* Texture6;
00141 STexture* Texture7;
00142 STexture* Texture8;
00143 };
00144
00145 STexture* Texture[8];
00146 };
00147
00148 bool flagLighting;
00149 bool flagDepthTesting;
00150 bool flagBlending;
00151 };
00152 };
00153
00154 #endif//AMN_SMATERIAL_H
00155
00156