changes for materials to treat them as shorts not int/chars (since they are stored as shorts intermally)

- converting nurbs to mesh was casting the material to unsigned char.
- subsurf was casting to char, then int -> short in a loop.
- have material functions take & return shorts.
This commit is contained in:
Campbell Barton
2011-09-20 06:25:15 +00:00
parent 2b1513dbda
commit 13dfd82997
16 changed files with 78 additions and 59 deletions

View File

@@ -981,7 +981,7 @@ static void flag_render_node_material(Render *re, bNodeTree *ntree)
}
}
static Material *give_render_material(Render *re, Object *ob, int nr)
static Material *give_render_material(Render *re, Object *ob, short nr)
{
extern Material defmaterial; /* material.c */
Material *ma;
@@ -2688,7 +2688,8 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
int timeoffset, float *orco, float mat[4][4])
{
Object *ob= obr->ob;
int a, a1, end, totvert, vertofs;
int a, end, totvert, vertofs;
short mat_iter;
VertRen *ver;
VlakRen *vlr;
MVert *mvert = NULL;
@@ -2718,16 +2719,16 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
/* faces in order of color blocks */
vertofs= obr->totvert - totvert;
for(a1=0; (a1<ob->totcol || (a1==0 && ob->totcol==0)); a1++) {
for(mat_iter= 0; (mat_iter < ob->totcol || (mat_iter==0 && ob->totcol==0)); mat_iter++) {
ma= give_render_material(re, ob, a1+1);
ma= give_render_material(re, ob, mat_iter+1);
end= dm->getNumFaces(dm);
mface= dm->getFaceArray(dm);
for(a=0; a<end; a++, mface++) {
int v1, v2, v3, v4, flag;
if( mface->mat_nr==a1 ) {
if(mface->mat_nr == mat_iter) {
float len;
v1= mface->v1;