Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 23 Sep 2009
Offline Last Active Apr 25 2013 05:06 AM

#4776821 How to include in *fx. file?

Posted by on 20 February 2011 - 04:44 PM

I've not read the book so can't be sure but my guess is that he wants you to pass the value returned from the GameTimer::GetTime() function into the .fx file as a variable.
So something like this,

.fx file
float	gTime;

// vertex shader stuff.
Output VertexShader(Input in)
	Output out;

	out = in.Position*gTime;

	return out;

So basically in the .fx file I've created a variable at the top called gTime. This value is then accessed somewhere inside the vertex shader ( in my basic example it is multiplied with the given position values).
You would need to set this new variable in your C++ code before drawing anything with the effect applied, something like this,

.cpp file
// Heres the important line!!!
Effect.SetBool("gTime", GameTimer.GetTime());

// Draw something awesome. Like a duck!

Unfortunatly I have no idea of the exact code to set variables in your example but your current code should be setting some variables for the effect file already. So if you can find that code and copy it for your new variable that should work out.
Look in your draw code within your .cpp file and it should be setting a View or ViewProjection for the effect somewhere before drawing it.

hope that all makes sense and that its what your actually looking for.