All pastes #673790 Raw Edit

Unnamed

public text v1 · immutable
#673790 ·published 2007-08-28 17:55 UTC
rendered paste body
GLSL Supported
ARB_fragment_program is supported.
   ALU instructions:    512
   texture instructions: 512
   texture indirections: 4
   local parameters:      1024
   env parameters:        128
   temp registers:         64
   attributes:             10
ARB_vertex_program is supported.
   ALU instructions:    0
   texture instructions: 0
   texture indirections: 0
   local parameters:      1024
   env parameters:        256
   temp registers:         65535
   attributes:             32

GLSL Light created.

GLSL Light created.

 GLSL Material created.

 GLSL MaterialTree created.

GLSL Program created.

GLSL Shader code writing...

GLSL Shader Compiled.

 Code:
struct light{
	vec3 loc;
	vec3 vec;
	vec3 color;
	float dist;
	float energy;
	float att1;
	float att2;
	float att3;
	float att4;
	float gamma;
	float area_x;
	float area_y;
	float sphere;
	float square;
	float area_type;
	float layer;
	mat4 mat;
	float areasize;
	float k;
	float spotsize;
	float spotblend;
};
varying vec3 vert_color;
varying vec3 normal, pos;
varying vec4 realcolor;
uniform vec3 eye;
uniform vec3 amb_color;
uniform float amb_exp, amb_range;
uniform sampler2D colorband_tex;
uniform vec3 u_mat_0_diff_color;
uniform vec3 u_mat_0_spec_color;
uniform vec3 u_mat_0_normal;
uniform float u_mat_0_alpha;
uniform float u_mat_0_diff1;
uniform float u_mat_0_diff2;
uniform float u_mat_0_diff3;
uniform float u_mat_0_spec1;
uniform float u_mat_0_spec2;
uniform float u_mat_0_spec3;
uniform float u_mat_0_amb_fac;
uniform float u_mat_0_emit;
uniform float u_mat_0_hard;
uniform float u_mat_0_tanv;
uniform float u_mat_0_shless;
uniform light lights[2];
float area_energy(light l, vec3 vnormal);
float visibility_lamp(light l){
	float visifac = 1.0;
	vec3 lv = (pos - l.loc);
	float dist = sqrt(dot(lv, lv));
	visifac = l.dist / (l.dist + (l.att1 * dist));
	visifac *= (l.dist * l.dist) / ( l.dist * l.dist + (l.att2 * dist * dist));
	visifac = max(visifac * l.att3, l.dist / (l.dist + dist) * l.att4);
	float m = max(l.dist - dist, 0.0);
	return(visifac * max(m / l.dist, l.sphere));
}
float visibility_spot(light l){
	float visifac = 1.0;
	vec3 lv = (pos - l.loc);
	float dist = sqrt(dot(lv, lv));
	float t = 1.0 / dist;
	lv = normalize(lv * t);
	vec3 vec = normalize(l.vec);
	vec3 lvrot;
	float x;
	float inpr;
	float i;
	mat3 matr;

	visifac = l.dist / (l.dist + (l.att1 * dist));
	visifac *= (l.dist * l.dist) / ( l.dist * l.dist + (l.att2 * dist * dist));
	visifac = max(visifac * l.att3, l.dist / (l.dist + dist) * l.att4);
	float m = max(l.dist - dist, 0.0);

	visifac *= max(m / l.dist, l.sphere);

	if(visifac > 0.0){
		if(l.square != 0.0){
			if(dot(lv, vec) > 0.0){
				matr[0] = vec3(l.mat[0][0], l.mat[0][1], l.mat[0][2]);
				matr[1] = vec3(l.mat[1][0], l.mat[1][1], l.mat[1][2]);
				matr[2] = vec3(l.mat[2][0], l.mat[2][1], l.mat[2][2]);
			
				lvrot = matr * lv;
				x = max(max(lvrot.x / lvrot.z, (lvrot.x / lvrot.z) * -1.0), max(lvrot.y / lvrot.z, (lvrot.y / lvrot.z) * -1.0));
				inpr = 1.0 / sqrt(1.0 + x * x);
			}
			else{
				inpr = 0.0;
			}
		}
		else{
			inpr = dot(lv, vec);
		}


		t = l.spotsize;

		if(inpr <= t){
			visifac = 0.0;
		}

		else{
			t = inpr - t;
			if(t < l.spotblend && l.spotblend != 0.0){
				i = t / l.spotblend;
				t = i * i;
				inpr *= (3.0 * t  - 2.0 * t * i);
			}

			visifac *= inpr;
		}
	}

	return visifac;
}
float lambertdef(light l, vec3 vnormal, float unused1, float unused2){
	vec3 lightVec = normalize(l.loc - pos);
    	return(max(dot(lightVec, vnormal), 0.0));
}
float lambertsun(light l, vec3 vnormal, float unused1, float unused2){
	vec3 lightVec = normalize(l.vec);
 	return(max(dot(lightVec, vnormal), 0.0));
}float lamberthemi(light l, vec3 vnormal){
	vec3 lightVec = normalize(l.vec);
	return(0.5 * dot(lightVec, vnormal) + 0.5);
}float lambertarea(light l, vec3 vnormal, float unused1, float unused2){
	return(max(area_energy(l, vnormal), 0.0));
}
float cooktorrdef(light l, vec3 vnormal, float hard, float unused){
	vec3 view = normalize(eye - pos);
	vec3 h = normalize(view + normalize(l.loc - pos));
	float nh = max(dot(vnormal, h), 0.0);
	float nv = max(dot(vnormal, view), 0.0);
	return(pow(nh, hard) / (0.1 + nv));
}
float cooktorrsun(light l, vec3 vnormal, float hard, float unused){
	vec3 view = normalize(eye - pos);
	vec3 h = normalize(view + l.vec);
	float nh = max(dot(vnormal, h), 0.0);
	float nv = max(dot(vnormal, view), 0.0);
	return(pow(nh, hard) / (0.1 + nv));
}
float cooktorrhemi(light l, vec3 vnormal, float hard){
	vec3 view = normalize(eye - pos);
	vec3 h = normalize(view + l.vec);
	float nh = 0.5 * (max(dot(vnormal, h), 0.0)) + 0.5;
	return(nh * pow(nh, hard));
}
float cooktorrarea(light l, vec3 vnormal, float hard, float unused){
	vec3 view = normalize(eye - pos);
	vec3 h = normalize(view + normalize(l.loc - pos));
	float nh = max(dot(vnormal, h), 0.0);
	float nv = max(dot(vnormal, view), 0.0);
	return( pow(nh, hard) / (0.1 + nv));
}

#define MATERIAL_ID 0

#define MATERIAL_FUNC material_0
vec3 MATERIAL_FUNC(inout vec3 diff_color, inout vec3 spec_color, inout vec3 normal, inout float alpha, float diff1, float diff2, float diff3, float spec1, float spec2, float spec3, float amb_fac, float emit, float hard, float tanv, float shless){
  vec3 diff_rslt = vec3(0.0, 0.0, 0.0);
  vec3 spec_rslt = vec3(0.0, 0.0, 0.0);
  vec3 amb_rslt = amb_color * amb_fac;
  float vis = 0.0, rslt1, rslt2, diff_fac, spec_fac;
  vec4 diff_cb, spec_cb;
  float diff_cb_res = 0.0;
  float spec_cb_res = 0.0;
  vec3 unnorm = normal;
  vec3 norm = normalize(normal);

  if(tanv > 0.0){
    norm = -(cross(cross(eye - pos, normal), normal));
  }


#define LIGHT_ID 0

#define VISIBILITY visibility_spot

#define CALC_DIFFUSE 1

#define DIFF_SHADER_ID lambertdef

#define CALC_SPECULAR 1

#define SPEC_SHADER_ID cooktorrdef
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0 )
  vis = VISIBILITY(lights[LIGHT_ID]);
#endif    

#ifdef CALC_DIFFUSE 
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0){
#ifdef DIFF_CB_TYPE
#ifdef HEMI
  rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], norm);
#else
  rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], norm, diff2, diff3);
#endif
#if DIFF_CB_TYPE == 0
  diff_fac = rslt1;
#else
#if DIFF_CB_TYPE == 1
  diff_fac = (0.3 * lights[LIGHT_ID].color.r + 0.58 * lights[LIGHT_ID].color.g + 0.12 * lights[LIGHT_ID].color.b) * vis * rslt1 * (lights[LIGHT_ID].energy * diff1);
#else
  diff_fac = dot(normalize((eye - pos)), normalize(normal));
#endif
#endif
  diff_cb = texture2D(colorband_tex, vec2(clamp(diff_fac, 0.000, 0.999), DIFF_CB_INDEX));
  diff_rslt += DIFF_CB_BLEND_FUNC(diff_cb.rgb, diff_color, DIFF_CB_FAC * diff_cb.a) * rslt1 * diff1 * vec3(lights[LIGHT_ID].color) * vis * lights[LIGHT_ID].energy;
#else
#ifdef HEMI
  diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], norm) * diff1 * diff_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis);
#else
  diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], norm, diff2, diff3) * diff1 * diff_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis);
#endif
#endif
 }
#endif
#endif

    
#ifdef CALC_SPECULAR
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0){
#ifdef HEMI
  spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], norm, hard) * spec1 * spec_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#else
  rslt2 = SPEC_SHADER_ID(lights[LIGHT_ID], norm, spec2, spec3);
#ifdef AREA
  rslt2 *= area_energy(lights[LIGHT_ID], norm);
#endif
#ifdef SPEC_CB_TYPE
#if SPEC_CB_TYPE == 0
  spec_fac = rslt2;
#else
#if SPEC_CB_TYPE == 1
  spec_fac = spec1 * vis * rslt2;
#else
  spec_fac = dot(normalize(eye - pos), normalize(normal));
#endif
#endif
  spec_cb = texture2D(colorband_tex, vec2(clamp(spec_fac, 0.0, 0.999), SPEC_CB_INDEX));
  spec_rslt += SPEC_CB_BLEND_FUNC(spec_cb.rgb, spec_color, SPEC_CB_FAC * spec_cb.a) * rslt2 * spec1 * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#else
  spec_rslt+= rslt2 * spec1 * spec_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#endif
#endif
 }
#endif
#endif

#ifdef DIFF_CB_RESULT
if(lights[LIGHT_ID].layer > 0.0)
  diff_cb_res = 1.0;
#endif

#ifdef SPEC_CB_RESULT
if(lights[LIGHT_ID].layer > 0.0)
  spec_cb_res = 1.0;
#endif


#undef VISIBILITY
#undef LIGHT_ID
#undef DIFF_SHADER_ID
#undef SPEC_SHADER_ID
#undef HEMI
#undef AREA
#undef CALC_DIFFUSE
#undef CALC_SPECULAR

#define LIGHT_ID 1

#define VISIBILITY visibility_lamp

#define CALC_DIFFUSE 1

#define DIFF_SHADER_ID lambertdef

#define CALC_SPECULAR 1

#define SPEC_SHADER_ID cooktorrdef
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0 )
  vis = VISIBILITY(lights[LIGHT_ID]);
#endif    

#ifdef CALC_DIFFUSE 
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0){
#ifdef DIFF_CB_TYPE
#ifdef HEMI
  rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], norm);
#else
  rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], norm, diff2, diff3);
#endif
#if DIFF_CB_TYPE == 0
  diff_fac = rslt1;
#else
#if DIFF_CB_TYPE == 1
  diff_fac = (0.3 * lights[LIGHT_ID].color.r + 0.58 * lights[LIGHT_ID].color.g + 0.12 * lights[LIGHT_ID].color.b) * vis * rslt1 * (lights[LIGHT_ID].energy * diff1);
#else
  diff_fac = dot(normalize((eye - pos)), normalize(normal));
#endif
#endif
  diff_cb = texture2D(colorband_tex, vec2(clamp(diff_fac, 0.000, 0.999), DIFF_CB_INDEX));
  diff_rslt += DIFF_CB_BLEND_FUNC(diff_cb.rgb, diff_color, DIFF_CB_FAC * diff_cb.a) * rslt1 * diff1 * vec3(lights[LIGHT_ID].color) * vis * lights[LIGHT_ID].energy;
#else
#ifdef HEMI
  diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], norm) * diff1 * diff_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis);
#else
  diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], norm, diff2, diff3) * diff1 * diff_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis);
#endif
#endif
 }
#endif
#endif

    
#ifdef CALC_SPECULAR
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0){
#ifdef HEMI
  spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], norm, hard) * spec1 * spec_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#else
  rslt2 = SPEC_SHADER_ID(lights[LIGHT_ID], norm, spec2, spec3);
#ifdef AREA
  rslt2 *= area_energy(lights[LIGHT_ID], norm);
#endif
#ifdef SPEC_CB_TYPE
#if SPEC_CB_TYPE == 0
  spec_fac = rslt2;
#else
#if SPEC_CB_TYPE == 1
  spec_fac = spec1 * vis * rslt2;
#else
  spec_fac = dot(normalize(eye - pos), normalize(normal));
#endif
#endif
  spec_cb = texture2D(colorband_tex, vec2(clamp(spec_fac, 0.0, 0.999), SPEC_CB_INDEX));
  spec_rslt += SPEC_CB_BLEND_FUNC(spec_cb.rgb, spec_color, SPEC_CB_FAC * spec_cb.a) * rslt2 * spec1 * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#else
  spec_rslt+= rslt2 * spec1 * spec_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#endif
#endif
 }
#endif
#endif

#ifdef DIFF_CB_RESULT
if(lights[LIGHT_ID].layer > 0.0)
  diff_cb_res = 1.0;
#endif

#ifdef SPEC_CB_RESULT
if(lights[LIGHT_ID].layer > 0.0)
  spec_cb_res = 1.0;
#endif


#undef VISIBILITY
#undef LIGHT_ID
#undef DIFF_SHADER_ID
#undef SPEC_SHADER_ID
#undef HEMI
#undef AREA
#undef CALC_DIFFUSE
#undef CALC_SPECULAR
diff_rslt = amb_exp * (1.0 - exp((diff_rslt + (diff_color * vec3(emit + vert_color.r, emit + vert_color.g, emit + vert_color.b))) * amb_range));
spec_rslt = amb_exp * (1.0 - exp(spec_rslt * amb_range));
return(diff_rslt + spec_rslt + amb_rslt); 

#undef DIFF_CB_TYPE
#undef SPEC_CB_TYPE
#undef DIFF_CB_BLEND_FUNC
#undef SPEC_CB_BLEND_FUNC
#undef DIFF_CB_INDEX
#undef SPEC_CB_INDEX
#undef DIFF_CB_FAC
#undef SPEC_CB_FAC
}

#undef MATERIAL_ID
#undef MATERIAL_FUNC
void main(void){  vec3 norm = normal; vec3 diff_color = realcolor.xyz; vec3 spec_color = u_mat_0_spec_color; float alpha = realcolor.a; float diff1 = u_mat_0_diff1; float diff2 = u_mat_0_diff2; float diff3 = u_mat_0_diff3; float spec1 = u_mat_0_spec1; float spec2 = u_mat_0_spec2; float spec3 = u_mat_0_spec3; float amb_fac = u_mat_0_amb_fac; float emit = u_mat_0_emit; float hard = u_mat_0_hard; float tanv = u_mat_0_tanv; float shless = u_mat_0_shless; vec3 result = material_0(diff_color, spec_color, norm, alpha, diff1, diff2, diff3, spec1, spec2, spec3, amb_fac, emit, hard, tanv, shless); gl_FragColor = vec4(result, alpha);}


GLSL Shader Compiled.

ERROR: Function 'area_energy' is called but not defined in fragment shader.


GLSL Linking Error.

GLSL Program removed.

 GLSL MaterialTree removed.

 GLSL Material removed.

GLSL GHash init

GLSL Light removed.

GLSL Light removed.

GLSL deactivated.

 GLSL Material created.

GLSL Texture created

 GLSL MaterialTree created.

GLSL Program created.

GLSL Shader code writing...

GLSL Shader Compiled.
Memoryblock free: pointer not in memlist

 Code:
struct light{
	vec3 loc;
	vec3 vec;
	vec3 color;
	float dist;
	float energy;
	float att1;
	float att2;
	float att3;
	float att4;
	float gamma;
	float area_x;
	float area_y;
	float sphere;
	float square;
	float area_type;
	float layer;
	mat4 mat;
	float areasize;
	float k;
	float spotsize;
	float spotblend;
};
varying vec3 vert_color;
varying vec3 normal, pos;
varying vec4 realcolor;
uniform vec3 eye;
uniform vec3 amb_color;
uniform float amb_exp, amb_range;
uniform sampler2D colorband_tex;
uniform vec3 u_mat_0_diff_color;
uniform vec3 u_mat_0_spec_color;
uniform vec3 u_mat_0_normal;
uniform float u_mat_0_alpha;
uniform float u_mat_0_diff1;
uniform float u_mat_0_diff2;
uniform float u_mat_0_diff3;
uniform float u_mat_0_spec1;
uniform float u_mat_0_spec2;
uniform float u_mat_0_spec3;
uniform float u_mat_0_amb_fac;
uniform float u_mat_0_emit;
uniform float u_mat_0_hard;
uniform float u_mat_0_tanv;
uniform float u_mat_0_shless;
uniform vec3 mat_0_tex_0_ofs;
uniform vec3 mat_0_tex_0_size;
uniform float mat_0_tex_0_colfac;
uniform float mat_0_tex_0_norfac;
uniform float mat_0_tex_0_varfac;
uniform float mat_0_tex_0_warpfac;
uniform float mat_0_tex_0_neg;
uniform float mat_0_tex_0_norgb;
uniform vec3 mat_0_tex_0_norgbcol;
uniform float mat_0_tex_0_dvarfac;
varying vec3 mat_0_tex_0_coords;
uniform light lights[1];
float area_energy(light l, vec3 vnormal);
vec3 tex_blend_mix(vec3 texcol, vec3 col, float fac1, float fac2)
{
  float fact = fac1 * fac2;
  float facm = 1.0 - fact;
  vec3 color;
  
  color.r = fact * texcol.r + facm * col.r;
  color.g = fact * texcol.g + facm * col.g;
  color.b = fact * texcol.b + facm * col.b;

  return(color);
}

#define TEX_FUNC material_0_tex_0
#define TEX_DIFFCOL 1
#define TEX_SPECCOL 1
#define TEX_NORMAL 1
#define TEX_COLFAC mat_0_tex_0_colfac
#define TEX_NORFAC mat_0_tex_0_norfac
#define TEX_BLEND tex_blend_mix
void TEX_FUNC(inout vec3 dc, inout vec3 sc, inout vec3 nor, inout float alph, inout float d1, inout float s1, inout float ambf, inout float e, inout float h)
{
  vec4 res = TEX_CALC_FUNC;

#ifdef TEX_DIFFCOL
  dc = TEX_BLEND(res.rgb, dc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_SPECCOL
  sc = TEX_BLEND(res.rgb, sc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_NORMAL

#endif

#ifdef TEX_ALPHA
  alph = TEX_BLEND_VAL(TEX_DVAR, alph, res.a, TEX_VARFAC);
#endif

#ifdef TEX_REF
  d1 = TEX_BLEND_VAL(TEX_DVAR, d1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_SPEC
  s1 = TEX_BLEND_VAL(TEX_DVAR, s1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_AMB
  ambf = TEX_BLEND_VAL(TEX_DVAR, ambf, res.a, TEX_VARFAC);
#endif

#ifdef TEX_EMIT
  e = TEX_BLEND_VAL(TEX_DVAR, e, res.a, TEX_VARFAC);
#endif

#ifdef TEX_HARD
  h = TEX_BLEND_VAL(TEX_DVAR, h, res.a, TEX_VARFAC);
#endif
}

#undef TEX_FUNC
#undef TEX_CALC_FUNC
#undef TEX_BLEND
#undef TEX_BLEND_VAL
#undef TEX_DIFFCOL
#undef TEX_SPECCOL
#undef TEX_NORMAL
#undef TEX_ALPHA
#undef TEX_REF
#undef TEX_SPEC
#undef TEX_AMB
#undef TEX_EMIT
#undef TEX_HARD

#undef TEX_DVAR
#undef TEX_VARFAC
#undef TEX_COLFAC
#undef TEX_NORFAC

#define MATERIAL_ID 0

#define MATERIAL_FUNC material_0
vec3 MATERIAL_FUNC(inout vec3 diff_color, inout vec3 spec_color, inout vec3 normal, inout float alpha, float diff1, float diff2, float diff3, float spec1, float spec2, float spec3, float amb_fac, float emit, float hard, float tanv, float shless){
  vec3 diff_rslt = vec3(0.0, 0.0, 0.0);
  vec3 spec_rslt = vec3(0.0, 0.0, 0.0);
  vec3 amb_rslt = amb_color * amb_fac;
  float vis = 0.0, rslt1, rslt2, diff_fac, spec_fac;
  vec4 diff_cb, spec_cb;
  float diff_cb_res = 0.0;
  float spec_cb_res = 0.0;
  vec3 unnorm = normal;
  vec3 norm = normalize(normal);

  if(tanv > 0.0){
    norm = -(cross(cross(eye - pos, normal), normal));
  }

return(0.0, 0.0, 0.0);
}
#undef MATERIAL_ID
#undef MATERIAL_FUNC
void main(void){  vec3 norm = normal; vec3 diff_color = realcolor.xyz; vec3 spec_color = u_mat_0_spec_color; float alpha = realcolor.a; float diff1 = u_mat_0_diff1; float diff2 = u_mat_0_diff2; float diff3 = u_mat_0_diff3; float spec1 = u_mat_0_spec1; float spec2 = u_mat_0_spec2; float spec3 = u_mat_0_spec3; float amb_fac = u_mat_0_amb_fac; float emit = u_mat_0_emit; float hard = u_mat_0_hard; float tanv = u_mat_0_tanv; float shless = u_mat_0_shless; vec3 result = material_0(diff_color, spec_color, norm, alpha, diff1, diff2, diff3, spec1, spec2, spec3, amb_fac, emit, hard, tanv, shless); gl_FragColor = vec4(result, alpha);}


ec3 loc;
	vec3 vec;
	vec3 color;
	float dist;
	float energy;
	float att1;
	float att2;
	float att3;
	float att4;
	float gamma;
	float area_x;
	float area_y;
	float sphere;
	float square;
	float area_t

GLSL Shader Compile Error

GLSL Program removed.

 GLSL Material created.

GLSL Texture created

GLSL Texture created

 GLSL MaterialTree created.

GLSL Program created.

GLSL Shader code writing...

GLSL Shader Compiled.
Memoryblock free: pointer not in memlist

 Code:
struct light{
	vec3 loc;
	vec3 vec;
	vec3 color;
	float dist;
	float energy;
	float att1;
	float att2;
	float att3;
	float att4;
	float gamma;
	float area_x;
	float area_y;
	float sphere;
	float square;
	float area_type;
	float layer;
	mat4 mat;
	float areasize;
	float k;
	float spotsize;
	float spotblend;
};
varying vec3 vert_color;
varying vec3 normal, pos;
varying vec4 realcolor;
uniform vec3 eye;
uniform vec3 amb_color;
uniform float amb_exp, amb_range;
uniform sampler2D colorband_tex;
uniform vec3 u_mat_0_diff_color;
uniform vec3 u_mat_0_spec_color;
uniform vec3 u_mat_0_normal;
uniform float u_mat_0_alpha;
uniform float u_mat_0_diff1;
uniform float u_mat_0_diff2;
uniform float u_mat_0_diff3;
uniform float u_mat_0_spec1;
uniform float u_mat_0_spec2;
uniform float u_mat_0_spec3;
uniform float u_mat_0_amb_fac;
uniform float u_mat_0_emit;
uniform float u_mat_0_hard;
uniform float u_mat_0_tanv;
uniform float u_mat_0_shless;
uniform vec3 mat_0_tex_0_ofs;
uniform vec3 mat_0_tex_0_size;
uniform float mat_0_tex_0_colfac;
uniform float mat_0_tex_0_norfac;
uniform float mat_0_tex_0_varfac;
uniform float mat_0_tex_0_warpfac;
uniform float mat_0_tex_0_neg;
uniform float mat_0_tex_0_norgb;
uniform vec3 mat_0_tex_0_norgbcol;
uniform float mat_0_tex_0_dvarfac;
varying vec3 mat_0_tex_0_coords;
uniform vec3 mat_0_tex_1_ofs;
uniform vec3 mat_0_tex_1_size;
uniform float mat_0_tex_1_colfac;
uniform float mat_0_tex_1_norfac;
uniform float mat_0_tex_1_varfac;
uniform float mat_0_tex_1_warpfac;
uniform float mat_0_tex_1_neg;
uniform float mat_0_tex_1_norgb;
uniform vec3 mat_0_tex_1_norgbcol;
uniform float mat_0_tex_1_dvarfac;
varying vec3 mat_0_tex_1_coords;
uniform light lights[1];
float area_energy(light l, vec3 vnormal);
float tex_blend_val_mix(float tex, float param, float fac1, float fac2)
{
  float res = 0.0;
  float fact = fac1 * fac2;
  float facm = 1.0 - fact;

  res = fact * tex + facm * param;

  return(res);
}
vec3 tex_blend_mix(vec3 texcol, vec3 col, float fac1, float fac2)
{
  float fact = fac1 * fac2;
  float facm = 1.0 - fact;
  vec3 color;
  
  color.r = fact * texcol.r + facm * col.r;
  color.g = fact * texcol.g + facm * col.g;
  color.b = fact * texcol.b + facm * col.b;

  return(color);
}

#define TEX_FUNC material_0_tex_0
#define TEX_DIFFCOL 1
#define TEX_NORMAL 1
#define TEX_COLFAC mat_0_tex_0_colfac
#define TEX_NORFAC mat_0_tex_0_norfac
#define TEX_BLEND tex_blend_mix
void TEX_FUNC(inout vec3 dc, inout vec3 sc, inout vec3 nor, inout float alph, inout float d1, inout float s1, inout float ambf, inout float e, inout float h)
{
  vec4 res = TEX_CALC_FUNC;

#ifdef TEX_DIFFCOL
  dc = TEX_BLEND(res.rgb, dc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_SPECCOL
  sc = TEX_BLEND(res.rgb, sc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_NORMAL

#endif

#ifdef TEX_ALPHA
  alph = TEX_BLEND_VAL(TEX_DVAR, alph, res.a, TEX_VARFAC);
#endif

#ifdef TEX_REF
  d1 = TEX_BLEND_VAL(TEX_DVAR, d1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_SPEC
  s1 = TEX_BLEND_VAL(TEX_DVAR, s1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_AMB
  ambf = TEX_BLEND_VAL(TEX_DVAR, ambf, res.a, TEX_VARFAC);
#endif

#ifdef TEX_EMIT
  e = TEX_BLEND_VAL(TEX_DVAR, e, res.a, TEX_VARFAC);
#endif

#ifdef TEX_HARD
  h = TEX_BLEND_VAL(TEX_DVAR, h, res.a, TEX_VARFAC);
#endif
}

#undef TEX_FUNC
#undef TEX_CALC_FUNC
#undef TEX_BLEND
#undef TEX_BLEND_VAL
#undef TEX_DIFFCOL
#undef TEX_SPECCOL
#undef TEX_NORMAL
#undef TEX_ALPHA
#undef TEX_REF
#undef TEX_SPEC
#undef TEX_AMB
#undef TEX_EMIT
#undef TEX_HARD

#undef TEX_DVAR
#undef TEX_VARFAC
#undef TEX_COLFAC
#undef TEX_NORFAC

#define TEX_FUNC material_0_tex_1
#define TEX_ALPHA 1
#define TEX_REF 1
#define TEX_DVAR mat_0_tex_1_dvarfac
#define TEX_VARFAC mat_0_tex_1_varfac
#define TEX_BLEND_VAL tex_blend_val_mix
void TEX_FUNC(inout vec3 dc, inout vec3 sc, inout vec3 nor, inout float alph, inout float d1, inout float s1, inout float ambf, inout float e, inout float h)
{
  vec4 res = TEX_CALC_FUNC;

#ifdef TEX_DIFFCOL
  dc = TEX_BLEND(res.rgb, dc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_SPECCOL
  sc = TEX_BLEND(res.rgb, sc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_NORMAL

#endif

#ifdef TEX_ALPHA
  alph = TEX_BLEND_VAL(TEX_DVAR, alph, res.a, TEX_VARFAC);
#endif

#ifdef TEX_REF
  d1 = TEX_BLEND_VAL(TEX_DVAR, d1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_SPEC
  s1 = TEX_BLEND_VAL(TEX_DVAR, s1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_AMB
  ambf = TEX_BLEND_VAL(TEX_DVAR, ambf, res.a, TEX_VARFAC);
#endif

#ifdef TEX_EMIT
  e = TEX_BLEND_VAL(TEX_DVAR, e, res.a, TEX_VARFAC);
#endif

#ifdef TEX_HARD
  h = TEX_BLEND_VAL(TEX_DVAR, h, res.a, TEX_VARFAC);
#endif
}

#undef TEX_FUNC
#undef TEX_CALC_FUNC
#undef TEX_BLEND
#undef TEX_BLEND_VAL
#undef TEX_DIFFCOL
#undef TEX_SPECCOL
#undef TEX_NORMAL
#undef TEX_ALPHA
#undef TEX_REF
#undef TEX_SPEC
#undef TEX_AMB
#undef TEX_EMIT
#undef TEX_HARD

#undef TEX_DVAR
#undef TEX_VARFAC
#undef TEX_COLFAC
#undef TEX_NORFAC

#define MATERIAL_ID 0

#define MATERIAL_FUNC material_0
vec3 MATERIAL_FUNC(inout vec3 diff_color, inout vec3 spec_color, inout vec3 normal, inout float alpha, float diff1, float diff2, float diff3, float spec1, float spec2, float spec3, float amb_fac, float emit, float hard, float tanv, float shless){
  vec3 diff_rslt = vec3(0.0, 0.0, 0.0);
  vec3 spec_rslt = vec3(0.0, 0.0, 0.0);
  vec3 amb_rslt = amb_color * amb_fac;
  float vis = 0.0, rslt1, rslt2, diff_fac, spec_fac;
  vec4 diff_cb, spec_cb;
  float diff_cb_res = 0.0;
  float spec_cb_res = 0.0;
  vec3 unnorm = normal;
  vec3 norm = normalize(normal);

  if(tanv > 0.0){
    norm = -(cross(cross(eye - pos, normal), normal));
  }

return(0.0, 0.0, 0.0);
}
#undef MATERIAL_ID
#undef MATERIAL_FUNC
void main(void){  vec3 norm = normal; vec3 diff_color = realcolor.xyz; vec3 spec_color = u_mat_0_spec_color; float alpha = realcolor.a; float diff1 = u_mat_0_diff1; float diff2 = u_mat_0_diff2; float diff3 = u_mat_0_diff3; float spec1 = u_mat_0_spec1; float spec2 = u_mat_0_spec2; float spec3 = u_mat_0_spec3; float amb_fac = u_mat_0_amb_fac; float emit = u_mat_0_emit; float hard = u_mat_0_hard; float tanv = u_mat_0_tanv; float shless = u_mat_0_shless; vec3 result = material_0(diff_color, spec_color, norm, alpha, diff1, diff2, diff3, spec1, spec2, spec3, amb_fac, emit, hard, tanv, shless); gl_FragColor = vec4(result, alpha);}


at u_mat_0_hard;
uniform float u_mat_0_tanv;
uniform float u_mat_0_shless;


GLSL Shader Compile Error

GLSL Program removed.

GLSL activated.
^C
Program received signal SIGINT, Interrupt.
0x939d3bbf in mach_msg_trap ()
(gdb) Quit
(gdb) quit
The program is running.  Exit anyway? (y or n) y
devera:~ jandevera$ cls
-bash: cls: command not found
devera:~ jandevera$ clr
-bash: clr: command not found
devera:~ jandevera$ clear

devera:~ jandevera$ gdb /Users/jandevera/Developer/build/darwin/bin/blender.app 
GNU gdb 6.3.50-20050815 (Apple version gdb-687) (Sat Jun  2 01:14:17 UTC 2007)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries ........................ done

(gdb) run
Starting program: /Users/jandevera/Developer/build/darwin/bin/blender.app/Contents/MacOS/blender 
Reading symbols for shared libraries +++++++++++++++++++++++.................................................................... done

GLSL GHash init
Compiled with Python version 2.5.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender: This Python has API version 1013, module Blender has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Armature: This Python has API version 1013, module Blender.Armature has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Armature.NLA: This Python has API version 1013, module Blender.Armature.NLA has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.BezTriple: This Python has API version 1013, module Blender.BezTriple has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.BGL: This Python has API version 1013, module Blender.BGL has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.CurNurb: This Python has API version 1013, module Blender.CurNurb has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Constraint: This Python has API version 1013, module Blender.Constraint has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Curve: This Python has API version 1013, module Blender.Curve has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Camera: This Python has API version 1013, module Blender.Camera has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Draw: This Python has API version 1013, module Blender.Draw has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Effect: This Python has API version 1013, module Blender.Effect has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Particle: This Python has API version 1013, module Blender.Particle has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Ipo: This Python has API version 1013, module Blender.Ipo has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.IpoCurve: This Python has API version 1013, module Blender.IpoCurve has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Image: This Python has API version 1013, module Blender.Image has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Key: This Python has API version 1013, module Blender.Key has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Lamp: This Python has API version 1013, module Blender.Lamp has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Lattice: This Python has API version 1013, module Blender.Lattice has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Library: This Python has API version 1013, module Blender.Library has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Material: This Python has API version 1013, module Blender.Material has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Mesh: This Python has API version 1013, module Blender.Mesh has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Mesh.Primitives: This Python has API version 1013, module Blender.Mesh.Primitives has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Metaball: This Python has API version 1013, module Blender.Metaball has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Mathutils: This Python has API version 1013, module Blender.Mathutils has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Geometry: This Python has API version 1013, module Blender.Geometry has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Modifier: This Python has API version 1013, module Blender.Modifier has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.NMesh: This Python has API version 1013, module Blender.NMesh has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Noise: This Python has API version 1013, module Blender.Noise has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Object: This Python has API version 1013, module Blender.Object has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Object.Pose: This Python has API version 1013, module Blender.Object.Pose has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Group: This Python has API version 1013, module Blender.Group has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Registry: This Python has API version 1013, module Blender.Registry has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Scene: This Python has API version 1013, module Blender.Scene has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Scene.Render: This Python has API version 1013, module Blender.Scene.Render has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Scene.Radio: This Python has API version 1013, module Blender.Scene.Radio has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Scene.Sequence: This Python has API version 1013, module Blender.Scene.Sequence has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Sound: This Python has API version 1013, module Blender.Sound has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.SurfNurb: This Python has API version 1013, module Blender.SurfNurb has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.sys: This Python has API version 1013, module Blender.sys has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Types: This Python has API version 1013, module Blender.Types has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Text: This Python has API version 1013, module Blender.Text has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Text3d: This Python has API version 1013, module Blender.Text3d has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Text3d.Font: This Python has API version 1013, module Blender.Text3d.Font has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Texture: This Python has API version 1013, module Blender.Texture has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Texture.MTex: This Python has API version 1013, module Blender.Texture.MTex has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Window: This Python has API version 1013, module Blender.Window has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.Window.Theme: This Python has API version 1013, module Blender.Window.Theme has version 1012.
sys:1: RuntimeWarning: Python C API version mismatch for module Blender.World: This Python has API version 1013, module Blender.World has version 1012.
Checking for installed Python... got it!
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done

GLSL Supported
ARB_fragment_program is supported.
   ALU instructions:    512
   texture instructions: 512
   texture indirections: 4
   local parameters:      1024
   env parameters:        128
   temp registers:         64
   attributes:             10
ARB_vertex_program is supported.
   ALU instructions:    0
   texture instructions: 0
   texture indirections: 0
   local parameters:      1024
   env parameters:        256
   temp registers:         65535
   attributes:             32

GLSL Light created.

GLSL Light created.

 GLSL Material created.

 GLSL MaterialTree created.

GLSL Program created.

GLSL Shader code writing...

GLSL Shader Compiled.

 Code:
struct light{
	vec3 loc;
	vec3 vec;
	vec3 color;
	float dist;
	float energy;
	float att1;
	float att2;
	float att3;
	float att4;
	float gamma;
	float area_x;
	float area_y;
	float sphere;
	float square;
	float area_type;
	float layer;
	mat4 mat;
	float areasize;
	float k;
	float spotsize;
	float spotblend;
};
varying vec3 vert_color;
varying vec3 normal, pos;
varying vec4 realcolor;
uniform vec3 eye;
uniform vec3 amb_color;
uniform float amb_exp, amb_range;
uniform sampler2D colorband_tex;
uniform vec3 u_mat_0_diff_color;
uniform vec3 u_mat_0_spec_color;
uniform vec3 u_mat_0_normal;
uniform float u_mat_0_alpha;
uniform float u_mat_0_diff1;
uniform float u_mat_0_diff2;
uniform float u_mat_0_diff3;
uniform float u_mat_0_spec1;
uniform float u_mat_0_spec2;
uniform float u_mat_0_spec3;
uniform float u_mat_0_amb_fac;
uniform float u_mat_0_emit;
uniform float u_mat_0_hard;
uniform float u_mat_0_tanv;
uniform float u_mat_0_shless;
uniform light lights[2];
float area_energy(light l, vec3 vnormal);
float visibility_lamp(light l){
	float visifac = 1.0;
	vec3 lv = (pos - l.loc);
	float dist = sqrt(dot(lv, lv));
	visifac = l.dist / (l.dist + (l.att1 * dist));
	visifac *= (l.dist * l.dist) / ( l.dist * l.dist + (l.att2 * dist * dist));
	visifac = max(visifac * l.att3, l.dist / (l.dist + dist) * l.att4);
	float m = max(l.dist - dist, 0.0);
	return(visifac * max(m / l.dist, l.sphere));
}
float visibility_spot(light l){
	float visifac = 1.0;
	vec3 lv = (pos - l.loc);
	float dist = sqrt(dot(lv, lv));
	float t = 1.0 / dist;
	lv = normalize(lv * t);
	vec3 vec = normalize(l.vec);
	vec3 lvrot;
	float x;
	float inpr;
	float i;
	mat3 matr;

	visifac = l.dist / (l.dist + (l.att1 * dist));
	visifac *= (l.dist * l.dist) / ( l.dist * l.dist + (l.att2 * dist * dist));
	visifac = max(visifac * l.att3, l.dist / (l.dist + dist) * l.att4);
	float m = max(l.dist - dist, 0.0);

	visifac *= max(m / l.dist, l.sphere);

	if(visifac > 0.0){
		if(l.square != 0.0){
			if(dot(lv, vec) > 0.0){
				matr[0] = vec3(l.mat[0][0], l.mat[0][1], l.mat[0][2]);
				matr[1] = vec3(l.mat[1][0], l.mat[1][1], l.mat[1][2]);
				matr[2] = vec3(l.mat[2][0], l.mat[2][1], l.mat[2][2]);
			
				lvrot = matr * lv;
				x = max(max(lvrot.x / lvrot.z, (lvrot.x / lvrot.z) * -1.0), max(lvrot.y / lvrot.z, (lvrot.y / lvrot.z) * -1.0));
				inpr = 1.0 / sqrt(1.0 + x * x);
			}
			else{
				inpr = 0.0;
			}
		}
		else{
			inpr = dot(lv, vec);
		}


		t = l.spotsize;

		if(inpr <= t){
			visifac = 0.0;
		}

		else{
			t = inpr - t;
			if(t < l.spotblend && l.spotblend != 0.0){
				i = t / l.spotblend;
				t = i * i;
				inpr *= (3.0 * t  - 2.0 * t * i);
			}

			visifac *= inpr;
		}
	}

	return visifac;
}
float lambertdef(light l, vec3 vnormal, float unused1, float unused2){
	vec3 lightVec = normalize(l.loc - pos);
    	return(max(dot(lightVec, vnormal), 0.0));
}
float lambertsun(light l, vec3 vnormal, float unused1, float unused2){
	vec3 lightVec = normalize(l.vec);
 	return(max(dot(lightVec, vnormal), 0.0));
}float lamberthemi(light l, vec3 vnormal){
	vec3 lightVec = normalize(l.vec);
	return(0.5 * dot(lightVec, vnormal) + 0.5);
}float lambertarea(light l, vec3 vnormal, float unused1, float unused2){
	return(max(area_energy(l, vnormal), 0.0));
}
float cooktorrdef(light l, vec3 vnormal, float hard, float unused){
	vec3 view = normalize(eye - pos);
	vec3 h = normalize(view + normalize(l.loc - pos));
	float nh = max(dot(vnormal, h), 0.0);
	float nv = max(dot(vnormal, view), 0.0);
	return(pow(nh, hard) / (0.1 + nv));
}
float cooktorrsun(light l, vec3 vnormal, float hard, float unused){
	vec3 view = normalize(eye - pos);
	vec3 h = normalize(view + l.vec);
	float nh = max(dot(vnormal, h), 0.0);
	float nv = max(dot(vnormal, view), 0.0);
	return(pow(nh, hard) / (0.1 + nv));
}
float cooktorrhemi(light l, vec3 vnormal, float hard){
	vec3 view = normalize(eye - pos);
	vec3 h = normalize(view + l.vec);
	float nh = 0.5 * (max(dot(vnormal, h), 0.0)) + 0.5;
	return(nh * pow(nh, hard));
}
float cooktorrarea(light l, vec3 vnormal, float hard, float unused){
	vec3 view = normalize(eye - pos);
	vec3 h = normalize(view + normalize(l.loc - pos));
	float nh = max(dot(vnormal, h), 0.0);
	float nv = max(dot(vnormal, view), 0.0);
	return( pow(nh, hard) / (0.1 + nv));
}

#define MATERIAL_ID 0

#define MATERIAL_FUNC material_0
vec3 MATERIAL_FUNC(inout vec3 diff_color, inout vec3 spec_color, inout vec3 normal, inout float alpha, float diff1, float diff2, float diff3, float spec1, float spec2, float spec3, float amb_fac, float emit, float hard, float tanv, float shless){
  vec3 diff_rslt = vec3(0.0, 0.0, 0.0);
  vec3 spec_rslt = vec3(0.0, 0.0, 0.0);
  vec3 amb_rslt = amb_color * amb_fac;
  float vis = 0.0, rslt1, rslt2, diff_fac, spec_fac;
  vec4 diff_cb, spec_cb;
  float diff_cb_res = 0.0;
  float spec_cb_res = 0.0;
  vec3 unnorm = normal;
  vec3 norm = normalize(normal);

  if(tanv > 0.0){
    norm = -(cross(cross(eye - pos, normal), normal));
  }


#define LIGHT_ID 0

#define VISIBILITY visibility_spot

#define CALC_DIFFUSE 1

#define DIFF_SHADER_ID lambertdef

#define CALC_SPECULAR 1

#define SPEC_SHADER_ID cooktorrdef
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0 )
  vis = VISIBILITY(lights[LIGHT_ID]);
#endif    

#ifdef CALC_DIFFUSE 
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0){
#ifdef DIFF_CB_TYPE
#ifdef HEMI
  rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], norm);
#else
  rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], norm, diff2, diff3);
#endif
#if DIFF_CB_TYPE == 0
  diff_fac = rslt1;
#else
#if DIFF_CB_TYPE == 1
  diff_fac = (0.3 * lights[LIGHT_ID].color.r + 0.58 * lights[LIGHT_ID].color.g + 0.12 * lights[LIGHT_ID].color.b) * vis * rslt1 * (lights[LIGHT_ID].energy * diff1);
#else
  diff_fac = dot(normalize((eye - pos)), normalize(normal));
#endif
#endif
  diff_cb = texture2D(colorband_tex, vec2(clamp(diff_fac, 0.000, 0.999), DIFF_CB_INDEX));
  diff_rslt += DIFF_CB_BLEND_FUNC(diff_cb.rgb, diff_color, DIFF_CB_FAC * diff_cb.a) * rslt1 * diff1 * vec3(lights[LIGHT_ID].color) * vis * lights[LIGHT_ID].energy;
#else
#ifdef HEMI
  diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], norm) * diff1 * diff_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis);
#else
  diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], norm, diff2, diff3) * diff1 * diff_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis);
#endif
#endif
 }
#endif
#endif

    
#ifdef CALC_SPECULAR
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0){
#ifdef HEMI
  spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], norm, hard) * spec1 * spec_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#else
  rslt2 = SPEC_SHADER_ID(lights[LIGHT_ID], norm, spec2, spec3);
#ifdef AREA
  rslt2 *= area_energy(lights[LIGHT_ID], norm);
#endif
#ifdef SPEC_CB_TYPE
#if SPEC_CB_TYPE == 0
  spec_fac = rslt2;
#else
#if SPEC_CB_TYPE == 1
  spec_fac = spec1 * vis * rslt2;
#else
  spec_fac = dot(normalize(eye - pos), normalize(normal));
#endif
#endif
  spec_cb = texture2D(colorband_tex, vec2(clamp(spec_fac, 0.0, 0.999), SPEC_CB_INDEX));
  spec_rslt += SPEC_CB_BLEND_FUNC(spec_cb.rgb, spec_color, SPEC_CB_FAC * spec_cb.a) * rslt2 * spec1 * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#else
  spec_rslt+= rslt2 * spec1 * spec_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#endif
#endif
 }
#endif
#endif

#ifdef DIFF_CB_RESULT
if(lights[LIGHT_ID].layer > 0.0)
  diff_cb_res = 1.0;
#endif

#ifdef SPEC_CB_RESULT
if(lights[LIGHT_ID].layer > 0.0)
  spec_cb_res = 1.0;
#endif


#undef VISIBILITY
#undef LIGHT_ID
#undef DIFF_SHADER_ID
#undef SPEC_SHADER_ID
#undef HEMI
#undef AREA
#undef CALC_DIFFUSE
#undef CALC_SPECULAR

#define LIGHT_ID 1

#define VISIBILITY visibility_lamp

#define CALC_DIFFUSE 1

#define DIFF_SHADER_ID lambertdef

#define CALC_SPECULAR 1

#define SPEC_SHADER_ID cooktorrdef
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0 )
  vis = VISIBILITY(lights[LIGHT_ID]);
#endif    

#ifdef CALC_DIFFUSE 
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0){
#ifdef DIFF_CB_TYPE
#ifdef HEMI
  rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], norm);
#else
  rslt1 = DIFF_SHADER_ID(lights[LIGHT_ID], norm, diff2, diff3);
#endif
#if DIFF_CB_TYPE == 0
  diff_fac = rslt1;
#else
#if DIFF_CB_TYPE == 1
  diff_fac = (0.3 * lights[LIGHT_ID].color.r + 0.58 * lights[LIGHT_ID].color.g + 0.12 * lights[LIGHT_ID].color.b) * vis * rslt1 * (lights[LIGHT_ID].energy * diff1);
#else
  diff_fac = dot(normalize((eye - pos)), normalize(normal));
#endif
#endif
  diff_cb = texture2D(colorband_tex, vec2(clamp(diff_fac, 0.000, 0.999), DIFF_CB_INDEX));
  diff_rslt += DIFF_CB_BLEND_FUNC(diff_cb.rgb, diff_color, DIFF_CB_FAC * diff_cb.a) * rslt1 * diff1 * vec3(lights[LIGHT_ID].color) * vis * lights[LIGHT_ID].energy;
#else
#ifdef HEMI
  diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], norm) * diff1 * diff_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis);
#else
  diff_rslt+= (DIFF_SHADER_ID(lights[LIGHT_ID], norm, diff2, diff3) * diff1 * diff_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis);
#endif
#endif
 }
#endif
#endif

    
#ifdef CALC_SPECULAR
#ifdef LIGHT_ID
if(lights[LIGHT_ID].layer > 0.0){
#ifdef HEMI
  spec_rslt+= SPEC_SHADER_ID(lights[LIGHT_ID], norm, hard) * spec1 * spec_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#else
  rslt2 = SPEC_SHADER_ID(lights[LIGHT_ID], norm, spec2, spec3);
#ifdef AREA
  rslt2 *= area_energy(lights[LIGHT_ID], norm);
#endif
#ifdef SPEC_CB_TYPE
#if SPEC_CB_TYPE == 0
  spec_fac = rslt2;
#else
#if SPEC_CB_TYPE == 1
  spec_fac = spec1 * vis * rslt2;
#else
  spec_fac = dot(normalize(eye - pos), normalize(normal));
#endif
#endif
  spec_cb = texture2D(colorband_tex, vec2(clamp(spec_fac, 0.0, 0.999), SPEC_CB_INDEX));
  spec_rslt += SPEC_CB_BLEND_FUNC(spec_cb.rgb, spec_color, SPEC_CB_FAC * spec_cb.a) * rslt2 * spec1 * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#else
  spec_rslt+= rslt2 * spec1 * spec_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#endif
#endif
 }
#endif
#endif

#ifdef DIFF_CB_RESULT
if(lights[LIGHT_ID].layer > 0.0)
  diff_cb_res = 1.0;
#endif

#ifdef SPEC_CB_RESULT
if(lights[LIGHT_ID].layer > 0.0)
  spec_cb_res = 1.0;
#endif


#undef VISIBILITY
#undef LIGHT_ID
#undef DIFF_SHADER_ID
#undef SPEC_SHADER_ID
#undef HEMI
#undef AREA
#undef CALC_DIFFUSE
#undef CALC_SPECULAR
diff_rslt = amb_exp * (1.0 - exp((diff_rslt + (diff_color * vec3(emit + vert_color.r, emit + vert_color.g, emit + vert_color.b))) * amb_range));
spec_rslt = amb_exp * (1.0 - exp(spec_rslt * amb_range));
return(diff_rslt + spec_rslt + amb_rslt); 

#undef DIFF_CB_TYPE
#undef SPEC_CB_TYPE
#undef DIFF_CB_BLEND_FUNC
#undef SPEC_CB_BLEND_FUNC
#undef DIFF_CB_INDEX
#undef SPEC_CB_INDEX
#undef DIFF_CB_FAC
#undef SPEC_CB_FAC
}

#undef MATERIAL_ID
#undef MATERIAL_FUNC
void main(void){  vec3 norm = normal; vec3 diff_color = realcolor.xyz; vec3 spec_color = u_mat_0_spec_color; float alpha = realcolor.a; float diff1 = u_mat_0_diff1; float diff2 = u_mat_0_diff2; float diff3 = u_mat_0_diff3; float spec1 = u_mat_0_spec1; float spec2 = u_mat_0_spec2; float spec3 = u_mat_0_spec3; float amb_fac = u_mat_0_amb_fac; float emit = u_mat_0_emit; float hard = u_mat_0_hard; float tanv = u_mat_0_tanv; float shless = u_mat_0_shless; vec3 result = material_0(diff_color, spec_color, norm, alpha, diff1, diff2, diff3, spec1, spec2, spec3, amb_fac, emit, hard, tanv, shless); gl_FragColor = vec4(result, alpha);}


GLSL Shader Compiled.

ERROR: Function 'area_energy' is called but not defined in fragment shader.


GLSL Linking Error.

GLSL Program removed.

 GLSL MaterialTree removed.

 GLSL Material removed.

GLSL GHash init

GLSL Light removed.

GLSL Light removed.

GLSL deactivated.

 GLSL Material created.

GLSL Texture created

 GLSL MaterialTree created.

GLSL Program created.

GLSL Shader code writing...

GLSL Shader Compiled.
Memoryblock free: pointer not in memlist

 Code:
struct light{
	vec3 loc;
	vec3 vec;
	vec3 color;
	float dist;
	float energy;
	float att1;
	float att2;
	float att3;
	float att4;
	float gamma;
	float area_x;
	float area_y;
	float sphere;
	float square;
	float area_type;
	float layer;
	mat4 mat;
	float areasize;
	float k;
	float spotsize;
	float spotblend;
};
varying vec3 vert_color;
varying vec3 normal, pos;
varying vec4 realcolor;
uniform vec3 eye;
uniform vec3 amb_color;
uniform float amb_exp, amb_range;
uniform sampler2D colorband_tex;
uniform vec3 u_mat_0_diff_color;
uniform vec3 u_mat_0_spec_color;
uniform vec3 u_mat_0_normal;
uniform float u_mat_0_alpha;
uniform float u_mat_0_diff1;
uniform float u_mat_0_diff2;
uniform float u_mat_0_diff3;
uniform float u_mat_0_spec1;
uniform float u_mat_0_spec2;
uniform float u_mat_0_spec3;
uniform float u_mat_0_amb_fac;
uniform float u_mat_0_emit;
uniform float u_mat_0_hard;
uniform float u_mat_0_tanv;
uniform float u_mat_0_shless;
uniform vec3 mat_0_tex_0_ofs;
uniform vec3 mat_0_tex_0_size;
uniform float mat_0_tex_0_colfac;
uniform float mat_0_tex_0_norfac;
uniform float mat_0_tex_0_varfac;
uniform float mat_0_tex_0_warpfac;
uniform float mat_0_tex_0_neg;
uniform float mat_0_tex_0_norgb;
uniform vec3 mat_0_tex_0_norgbcol;
uniform float mat_0_tex_0_dvarfac;
varying vec3 mat_0_tex_0_coords;
uniform light lights[1];
float area_energy(light l, vec3 vnormal);
vec3 tex_blend_mix(vec3 texcol, vec3 col, float fac1, float fac2)
{
  float fact = fac1 * fac2;
  float facm = 1.0 - fact;
  vec3 color;
  
  color.r = fact * texcol.r + facm * col.r;
  color.g = fact * texcol.g + facm * col.g;
  color.b = fact * texcol.b + facm * col.b;

  return(color);
}

#define TEX_FUNC material_0_tex_0
#define TEX_DIFFCOL 1
#define TEX_SPECCOL 1
#define TEX_NORMAL 1
#define TEX_COLFAC mat_0_tex_0_colfac
#define TEX_NORFAC mat_0_tex_0_norfac
#define TEX_BLEND tex_blend_mix
void TEX_FUNC(inout vec3 dc, inout vec3 sc, inout vec3 nor, inout float alph, inout float d1, inout float s1, inout float ambf, inout float e, inout float h)
{
  vec4 res = TEX_CALC_FUNC;

#ifdef TEX_DIFFCOL
  dc = TEX_BLEND(res.rgb, dc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_SPECCOL
  sc = TEX_BLEND(res.rgb, sc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_NORMAL

#endif

#ifdef TEX_ALPHA
  alph = TEX_BLEND_VAL(TEX_DVAR, alph, res.a, TEX_VARFAC);
#endif

#ifdef TEX_REF
  d1 = TEX_BLEND_VAL(TEX_DVAR, d1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_SPEC
  s1 = TEX_BLEND_VAL(TEX_DVAR, s1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_AMB
  ambf = TEX_BLEND_VAL(TEX_DVAR, ambf, res.a, TEX_VARFAC);
#endif

#ifdef TEX_EMIT
  e = TEX_BLEND_VAL(TEX_DVAR, e, res.a, TEX_VARFAC);
#endif

#ifdef TEX_HARD
  h = TEX_BLEND_VAL(TEX_DVAR, h, res.a, TEX_VARFAC);
#endif
}

#undef TEX_FUNC
#undef TEX_CALC_FUNC
#undef TEX_BLEND
#undef TEX_BLEND_VAL
#undef TEX_DIFFCOL
#undef TEX_SPECCOL
#undef TEX_NORMAL
#undef TEX_ALPHA
#undef TEX_REF
#undef TEX_SPEC
#undef TEX_AMB
#undef TEX_EMIT
#undef TEX_HARD

#undef TEX_DVAR
#undef TEX_VARFAC
#undef TEX_COLFAC
#undef TEX_NORFAC

#define MATERIAL_ID 0

#define MATERIAL_FUNC material_0
vec3 MATERIAL_FUNC(inout vec3 diff_color, inout vec3 spec_color, inout vec3 normal, inout float alpha, float diff1, float diff2, float diff3, float spec1, float spec2, float spec3, float amb_fac, float emit, float hard, float tanv, float shless){
  vec3 diff_rslt = vec3(0.0, 0.0, 0.0);
  vec3 spec_rslt = vec3(0.0, 0.0, 0.0);
  vec3 amb_rslt = amb_color * amb_fac;
  float vis = 0.0, rslt1, rslt2, diff_fac, spec_fac;
  vec4 diff_cb, spec_cb;
  float diff_cb_res = 0.0;
  float spec_cb_res = 0.0;
  vec3 unnorm = normal;
  vec3 norm = normalize(normal);

  if(tanv > 0.0){
    norm = -(cross(cross(eye - pos, normal), normal));
  }

return(0.0, 0.0, 0.0);
}
#undef MATERIAL_ID
#undef MATERIAL_FUNC
void main(void){  vec3 norm = normal; vec3 diff_color = realcolor.xyz; vec3 spec_color = u_mat_0_spec_color; float alpha = realcolor.a; float diff1 = u_mat_0_diff1; float diff2 = u_mat_0_diff2; float diff3 = u_mat_0_diff3; float spec1 = u_mat_0_spec1; float spec2 = u_mat_0_spec2; float spec3 = u_mat_0_spec3; float amb_fac = u_mat_0_amb_fac; float emit = u_mat_0_emit; float hard = u_mat_0_hard; float tanv = u_mat_0_tanv; float shless = u_mat_0_shless; vec3 result = material_0(diff_color, spec_color, norm, alpha, diff1, diff2, diff3, spec1, spec2, spec3, amb_fac, emit, hard, tanv, shless); gl_FragColor = vec4(result, alpha);}




GLSL Shader Compile Error

GLSL Program removed.

 GLSL Material created.

GLSL Texture created

GLSL Texture created

 GLSL MaterialTree created.

GLSL Program created.

GLSL Shader code writing...

GLSL Shader Compiled.
Memoryblock free: pointer not in memlist

 Code:
struct light{
	vec3 loc;
	vec3 vec;
	vec3 color;
	float dist;
	float energy;
	float att1;
	float att2;
	float att3;
	float att4;
	float gamma;
	float area_x;
	float area_y;
	float sphere;
	float square;
	float area_type;
	float layer;
	mat4 mat;
	float areasize;
	float k;
	float spotsize;
	float spotblend;
};
varying vec3 vert_color;
varying vec3 normal, pos;
varying vec4 realcolor;
uniform vec3 eye;
uniform vec3 amb_color;
uniform float amb_exp, amb_range;
uniform sampler2D colorband_tex;
uniform vec3 u_mat_0_diff_color;
uniform vec3 u_mat_0_spec_color;
uniform vec3 u_mat_0_normal;
uniform float u_mat_0_alpha;
uniform float u_mat_0_diff1;
uniform float u_mat_0_diff2;
uniform float u_mat_0_diff3;
uniform float u_mat_0_spec1;
uniform float u_mat_0_spec2;
uniform float u_mat_0_spec3;
uniform float u_mat_0_amb_fac;
uniform float u_mat_0_emit;
uniform float u_mat_0_hard;
uniform float u_mat_0_tanv;
uniform float u_mat_0_shless;
uniform vec3 mat_0_tex_0_ofs;
uniform vec3 mat_0_tex_0_size;
uniform float mat_0_tex_0_colfac;
uniform float mat_0_tex_0_norfac;
uniform float mat_0_tex_0_varfac;
uniform float mat_0_tex_0_warpfac;
uniform float mat_0_tex_0_neg;
uniform float mat_0_tex_0_norgb;
uniform vec3 mat_0_tex_0_norgbcol;
uniform float mat_0_tex_0_dvarfac;
varying vec3 mat_0_tex_0_coords;
uniform vec3 mat_0_tex_1_ofs;
uniform vec3 mat_0_tex_1_size;
uniform float mat_0_tex_1_colfac;
uniform float mat_0_tex_1_norfac;
uniform float mat_0_tex_1_varfac;
uniform float mat_0_tex_1_warpfac;
uniform float mat_0_tex_1_neg;
uniform float mat_0_tex_1_norgb;
uniform vec3 mat_0_tex_1_norgbcol;
uniform float mat_0_tex_1_dvarfac;
varying vec3 mat_0_tex_1_coords;
uniform light lights[1];
float area_energy(light l, vec3 vnormal);
float tex_blend_val_mix(float tex, float param, float fac1, float fac2)
{
  float res = 0.0;
  float fact = fac1 * fac2;
  float facm = 1.0 - fact;

  res = fact * tex + facm * param;

  return(res);
}
vec3 tex_blend_mix(vec3 texcol, vec3 col, float fac1, float fac2)
{
  float fact = fac1 * fac2;
  float facm = 1.0 - fact;
  vec3 color;
  
  color.r = fact * texcol.r + facm * col.r;
  color.g = fact * texcol.g + facm * col.g;
  color.b = fact * texcol.b + facm * col.b;

  return(color);
}

#define TEX_FUNC material_0_tex_0
#define TEX_DIFFCOL 1
#define TEX_NORMAL 1
#define TEX_COLFAC mat_0_tex_0_colfac
#define TEX_NORFAC mat_0_tex_0_norfac
#define TEX_BLEND tex_blend_mix
void TEX_FUNC(inout vec3 dc, inout vec3 sc, inout vec3 nor, inout float alph, inout float d1, inout float s1, inout float ambf, inout float e, inout float h)
{
  vec4 res = TEX_CALC_FUNC;

#ifdef TEX_DIFFCOL
  dc = TEX_BLEND(res.rgb, dc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_SPECCOL
  sc = TEX_BLEND(res.rgb, sc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_NORMAL

#endif

#ifdef TEX_ALPHA
  alph = TEX_BLEND_VAL(TEX_DVAR, alph, res.a, TEX_VARFAC);
#endif

#ifdef TEX_REF
  d1 = TEX_BLEND_VAL(TEX_DVAR, d1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_SPEC
  s1 = TEX_BLEND_VAL(TEX_DVAR, s1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_AMB
  ambf = TEX_BLEND_VAL(TEX_DVAR, ambf, res.a, TEX_VARFAC);
#endif

#ifdef TEX_EMIT
  e = TEX_BLEND_VAL(TEX_DVAR, e, res.a, TEX_VARFAC);
#endif

#ifdef TEX_HARD
  h = TEX_BLEND_VAL(TEX_DVAR, h, res.a, TEX_VARFAC);
#endif
}

#undef TEX_FUNC
#undef TEX_CALC_FUNC
#undef TEX_BLEND
#undef TEX_BLEND_VAL
#undef TEX_DIFFCOL
#undef TEX_SPECCOL
#undef TEX_NORMAL
#undef TEX_ALPHA
#undef TEX_REF
#undef TEX_SPEC
#undef TEX_AMB
#undef TEX_EMIT
#undef TEX_HARD

#undef TEX_DVAR
#undef TEX_VARFAC
#undef TEX_COLFAC
#undef TEX_NORFAC

#define TEX_FUNC material_0_tex_1
#define TEX_ALPHA 1
#define TEX_REF 1
#define TEX_DVAR mat_0_tex_1_dvarfac
#define TEX_VARFAC mat_0_tex_1_varfac
#define TEX_BLEND_VAL tex_blend_val_mix
void TEX_FUNC(inout vec3 dc, inout vec3 sc, inout vec3 nor, inout float alph, inout float d1, inout float s1, inout float ambf, inout float e, inout float h)
{
  vec4 res = TEX_CALC_FUNC;

#ifdef TEX_DIFFCOL
  dc = TEX_BLEND(res.rgb, dc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_SPECCOL
  sc = TEX_BLEND(res.rgb, sc, res.a, TEX_COLFAC);
#endif

#ifdef TEX_NORMAL

#endif

#ifdef TEX_ALPHA
  alph = TEX_BLEND_VAL(TEX_DVAR, alph, res.a, TEX_VARFAC);
#endif

#ifdef TEX_REF
  d1 = TEX_BLEND_VAL(TEX_DVAR, d1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_SPEC
  s1 = TEX_BLEND_VAL(TEX_DVAR, s1, res.a, TEX_VARFAC);
#endif

#ifdef TEX_AMB
  ambf = TEX_BLEND_VAL(TEX_DVAR, ambf, res.a, TEX_VARFAC);
#endif

#ifdef TEX_EMIT
  e = TEX_BLEND_VAL(TEX_DVAR, e, res.a, TEX_VARFAC);
#endif

#ifdef TEX_HARD
  h = TEX_BLEND_VAL(TEX_DVAR, h, res.a, TEX_VARFAC);
#endif
}

#undef TEX_FUNC
#undef TEX_CALC_FUNC
#undef TEX_BLEND
#undef TEX_BLEND_VAL
#undef TEX_DIFFCOL
#undef TEX_SPECCOL
#undef TEX_NORMAL
#undef TEX_ALPHA
#undef TEX_REF
#undef TEX_SPEC
#undef TEX_AMB
#undef TEX_EMIT
#undef TEX_HARD

#undef TEX_DVAR
#undef TEX_VARFAC
#undef TEX_COLFAC
#undef TEX_NORFAC

#define MATERIAL_ID 0

#define MATERIAL_FUNC material_0
vec3 MATERIAL_FUNC(inout vec3 diff_color, inout vec3 spec_color, inout vec3 normal, inout float alpha, float diff1, float diff2, float diff3, float spec1, float spec2, float spec3, float amb_fac, float emit, float hard, float tanv, float shless){
  vec3 diff_rslt = vec3(0.0, 0.0, 0.0);
  vec3 spec_rslt = vec3(0.0, 0.0, 0.0);
  vec3 amb_rslt = amb_color * amb_fac;
  float vis = 0.0, rslt1, rslt2, diff_fac, spec_fac;
  vec4 diff_cb, spec_cb;
  float diff_cb_res = 0.0;
  float spec_cb_res = 0.0;
  vec3 unnorm = normal;
  vec3 norm = normalize(normal);

  if(tanv > 0.0){
    norm = -(cross(cross(eye - pos, normal), normal));
  }

return(0.0, 0.0, 0.0);
}
#undef MATERIAL_ID
#undef MATERIAL_FUNC
void main(void){  vec3 norm = normal; vec3 diff_color = realcolor.xyz; vec3 spec_color = u_mat_0_spec_color; float alpha = realcolor.a; float diff1 = u_mat_0_diff1; float diff2 = u_mat_0_diff2; float diff3 = u_mat_0_diff3; float spec1 = u_mat_0_spec1; float spec2 = u_mat_0_spec2; float spec3 = u_mat_0_spec3; float amb_fac = u_mat_0_amb_fac; float emit = u_mat_0_emit; float hard = u_mat_0_hard; float tanv = u_mat_0_tanv; float shless = u_mat_0_shless; vec3 result = material_0(diff_color, spec_color, norm, alpha, diff1, diff2, diff3, spec1, spec2, spec3, amb_fac, emit, hard, tanv, shless); gl_FragColor = vec4(result, alpha);}


at u_mat_0_hard;
uniform float u_mat_0_tanv;
uniform float u_mat_0_shless;


GLSL Shader Compile Error