PDA

View Full Version : A miColor can not connect a texture?


Lolly
12-15-2010, 06:20 AM
Hello everybody,
I created the following shader, compiled it in vs2008 there. But it's "inputDis" argument does not work after connecting the texture, and why?
Only adjust the color, this parameter is normal.

My laptop:i7 740 / 4G ddr3 / geforce GT335M/win7 x64/maya2009 x64



#include <math.h>
#include "shader.h"


struct com_zbfake_color {
miColor inputDis;
miScalar subDown;
miScalar alpha;
miScalar multiply;
miBoolean noAlpha;
};

extern "C"
{
DLLEXPORT int com_zbfake_color_version() {return 1;}
DLLEXPORT miBoolean com_zbfake_color (miColor *,miState *, struct com_zbfake_color *);
}

DLLEXPORT miBoolean com_zbfake_color(
miColor *result,
miState *state,
struct com_zbfake_color *paras)
{
miScalar multiply = *mi_eval_scalar(&paras->multiply);
miScalar sub = *mi_eval_scalar(&paras->subDown);
miScalar alpha = *mi_eval_scalar(&paras->alpha);
miBoolean noAlpha = *mi_eval_boolean(&paras->noAlpha);
miColor *input;
input = mi_eval_color(&paras->inputDis);
*result =*mi_eval_color(&paras->inputDis);



if(noAlpha)
{
result->r+=input->r* multiply-sub* multiply;
result->g+=input->g* multiply-sub* multiply;
result->b+=input->b* multiply-sub* multiply;
result->a=alpha;
}
else
{
result->r +=input->r-sub * multiply *(1-alpha);
result->g +=input->g-sub * multiply *(1-alpha);
result->b +=input->b-sub * multiply *(1-alpha);
result->a=alpha;
};

return(miTRUE);
}


Thanks in advance!

CGTalk Moderation
12-15-2010, 06:20 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.