Пример #1
0
	void shader_prog(const vs_input& in, vs_output& out)
	{
		vec4 pos = in.attribute(0);
		vec4 nor = in.attribute(1);

		out.position() = out.attribute(0) = vec4(0.0f, 0.0f, 0.0f, 0.0f);
		pos.w(1.0f);
		nor.w(0.0f);

		for(int i = 0; i < 4; ++i)
		{
			union {float f; int i;} f2i;
			f2i.f = in.attribute(3)[i];
			float w = in.attribute(4)[i];
			int boneIndex = f2i.i;
			if(boneIndex == -1){break;}
			vec4 skin_pos;
			vec4 skin_nor;
			transform(skin_pos, invMatrices[boneIndex], pos);
			transform(skin_pos, boneMatrices[boneIndex], skin_pos);
			transform(skin_nor, invMatrices[boneIndex], nor);
			transform(skin_nor, boneMatrices[boneIndex], skin_nor);
			out.position() += (skin_pos*w);
			out.attribute(0) += (skin_nor*w);
		}
		
		transform(out.position(), out.position(), wvp);

		// out.attribute(0) = in.attribute(1);
		out.attribute(1) = in.attribute(2);
		out.attribute(2) = light_pos - pos;
		out.attribute(3) = eye_pos - pos;
	}
 void shader_prog(const vs_input& in, vs_output& out)
 {
     vec4 pos = in.attribute(0);
     transform(out.position(), pos, wvp);
     out.attribute(0) = in.attribute(0);//(vec4(1.0f, 1.0f, 1.0f, 1.0f) - in[0]);
     out.attribute(1) = in.attribute(1);
 }
Пример #3
0
	void shader_prog(const vs_input& in, vs_output& out)
	{
		vec4 pos = in.attribute(0);
		transform(out.position(), pos, wvp);
		out.attribute(0) = in.attribute(1);
		out.attribute(1) = in.attribute(2);
		out.attribute(2) = light_pos - pos;
		out.attribute(3) = eye_pos - pos;
	}
Пример #4
0
	void shader_prog(const vs_input& in, vs_output& out)
	{
		vec4 pos = in.attribute(0);
		vec4 pos_es, normal_es;
		transform(pos_es, pos, wv);
		transform33(normal_es, in.attribute(1), wv);
		transform(out.position(), pos_es, proj);
		out.attribute(0) = vec4(light_pos - pos_es.xyz(), 1);
		out.attribute(1) = vec4(eye_pos - pos_es.xyz(), 1);
		out.attribute(2) = normal_es;
	}
 void shader_prog(const vs_input& in, vs_output& out)
 {
     vec4 pos = in.attribute(0);
     transform(out.position(), pos, wvp);
     out.attribute(0) = vec4(in.attribute(0).x(), in.attribute(0).z(), 0, 0);
 }