Added runtime fx compilation and lighting

Tuesday, February 17, 2009 by gradbot

I spent some time fighting with matrices to get the lighting correct but I'm happy now that I have a rotating and moving object in XNA that is lit from a single stationary source. I'm using the plastic shader that comes with NVIDIA FX Composer 2.5.




Here's my runtime code that compiles a fx file into an Effect.


let compileEffect(fileName : string)=
let compiledEffect =
Effect.CompileEffectFromFile(
fileName,
null,
null,
CompilerOptions.Debug,
TargetPlatform.Windows)
let effectCode =
compiledEffect.GetEffectCode()
new Effect(
this.graphics.GraphicsDevice,
effectCode,
CompilerOptions.Debug,
null)

source code

Filed under , , having  

Moving along in XNA

Saturday, February 14, 2009 by gradbot

I added a shape class and some basic shapes made out of line segments. Along with this i added collision for the line segments with a player and mapped the first controller pad to control it. Jumping is very basic and gravity is simple.





Images from the project.


source code: github.com/gradbot/xna-f-sharp

Filed under , , having