Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2006-01-08 12:37:15 +0300
committerErwin Coumans <blender@erwincoumans.com>2006-01-08 12:37:15 +0300
commitc94455c14d28221f6e05f33ba42e23a5d3245a28 (patch)
tree733dfaccbbcd71cf66e2d33b1868f64f78189eeb /source/gameengine/Ketsji/BL_Material.cpp
parent88a8508b347dda050557e72dfad105023e5095aa (diff)
more linux game engine work. hopefully works now!
Diffstat (limited to 'source/gameengine/Ketsji/BL_Material.cpp')
-rw-r--r--source/gameengine/Ketsji/BL_Material.cpp132
1 files changed, 132 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/BL_Material.cpp b/source/gameengine/Ketsji/BL_Material.cpp
new file mode 100644
index 00000000000..b77750c1644
--- /dev/null
+++ b/source/gameengine/Ketsji/BL_Material.cpp
@@ -0,0 +1,132 @@
+// ------------------------------------
+#ifdef WIN32
+#include <windows.h>
+#endif // WIN32
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
+#include <GL/gl.h>
+#include <GL/glu.h>
+#endif
+
+
+#include <iostream>
+
+#include "BL_Material.h"
+#include "MT_assert.h"
+
+#include "DNA_material_types.h"
+#include "DNA_texture_types.h"
+#include "DNA_image_types.h"
+#include "DNA_mesh_types.h"
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+
+MTex* getImageFromMaterial(Material *mat, int index)
+{
+ if(!mat) return 0;
+
+ if(!(index >=0 && index <=10) ) return 0;
+
+ MTex *m = mat->mtex[index];
+ return m?m:0;
+}
+
+int getNumTexChannels( Material *mat )
+{
+ int count = -1;
+ if(!mat) return -1;
+
+ for(count =0; (count < 10) && mat->mtex[count] != 0; count++) {}
+ return count;
+}
+
+BL_Material::BL_Material()
+{
+ rgb[0] = 0;
+ rgb[1] = 0;
+ rgb[2] = 0;
+ rgb[3] = 0;
+ IdMode = 0;
+ ras_mode = 0;
+ tile = 0;
+ matname = "NoMaterial";
+ matcolor[0] = 0.5f;
+ matcolor[1] = 0.5f;
+ matcolor[2] = 0.5f;
+ matcolor[3] = 0.5f;
+ speccolor[0] = 1.f;
+ speccolor[1] = 1.f;
+ speccolor[2] = 1.f;
+ transp = 0;
+ hard = 50.f;
+ spec_f = 0.5f;
+ alpha = 1.f;
+ emit = 0.f;
+ mode = 0;
+ material = 0;
+ tface = 0;
+ material_index = 0;
+ amb=0.5f;
+ num_enabled = 0;
+
+ int i;
+ for(i=0; i<4; i++)
+ uv[i] = MT_Point2(0.f,1.f);
+
+ for(i=0; i<MAXTEX; i++) // :(
+ {
+ mapping[i].mapping = 0;
+ mapping[i].offsets[0] = 0.f;
+ mapping[i].offsets[1] = 0.f;
+ mapping[i].offsets[2] = 0.f;
+ mapping[i].scale[0] = 1.f;
+ mapping[i].scale[1] = 1.f;
+ mapping[i].scale[2] = 1.f;
+ mapping[i].projplane[0] = PROJX;
+ mapping[i].projplane[1] = PROJY;
+ mapping[i].projplane[2] = PROJZ;
+ mapping[i].objconame = "";
+ mtexname[i] = "NULL";
+ imageId[i]="NULL";
+ flag[i] = 0;
+ texname[i] = "NULL";
+ tilexrep[i] = 1;
+ tileyrep[i] = 1;
+ color_blend[i] = 1.f;
+ blend_mode[i] = 0;
+ img[i] = 0;
+ cubemap[i] = 0;
+ }
+}
+
+void BL_Material::SetConversionRGB(unsigned int *nrgb) {
+ rgb[0]=*nrgb++;
+ rgb[1]=*nrgb++;
+ rgb[2]=*nrgb++;
+ rgb[3]=*nrgb;
+}
+
+void BL_Material::GetConversionRGB(unsigned int *nrgb) {
+ *nrgb++ = rgb[0];
+ *nrgb++ = rgb[1];
+ *nrgb++ = rgb[2];
+ *nrgb = rgb[3];
+}
+
+void BL_Material::SetConversionUV(MT_Point2 *nuv) {
+ uv[0] = *nuv++;
+ uv[1] = *nuv++;
+ uv[2] = *nuv++;
+ uv[3] = *nuv;
+}
+
+void BL_Material::GetConversionUV(MT_Point2 *nuv){
+ *nuv++ = uv[0];
+ *nuv++ = uv[1];
+ *nuv++ = uv[2];
+ *nuv = uv[3];
+}
+
+