} // Load() public static BasicShader LoadFromEmbeddedFile(IXNAGame game, Assembly assembly, string manifestResource, string sourceFileRelativePath, EffectPool pool) { var shader = new BasicShader(game); shader.InitFromEmbeddedFile(game, assembly, manifestResource, sourceFileRelativePath, pool); return(shader); }
/// <summary> /// Load an effect from an hlsl .fx file /// </summary> public static BasicShader LoadFromFXFile(IXNAGame game, IGameFile file, EffectPool pool) { BasicShader s = new BasicShader(game); s.LoadFromFXFile(file, pool); return(s); }
public static BasicShader LoadFromFXFile(IXNAGame game, System.IO.Stream strm, EffectPool pool) { BasicShader s = new BasicShader(game); s.LoadFromFXFile(strm, pool); return(s); }
public BasicShader Clone() { BasicShader clone = new BasicShader(game); clone.effect = effect.Clone(game.GraphicsDevice); clone.LoadParameters(); return(clone); //TODO: maybe also set the world, viewprojection, etc params to be identical, but probably not necessary }
/// <summary> /// Init LineManager /// TODO: this class should be adapted so that it can be fully created even when the device isn't fully initialized. /// </summary> public LineManager3D(IXNAGame nGame) { game = nGame; /*if ( HoofdObject.XNAGame.Graphics.GraphicsDevice == null ) * throw new NullReferenceException( * "XNA device is not initialized, can't init line manager." );*/ lines = new LineManager3DLines(); //shader = BasicShader.LoadFromFXFile( game, game.EngineFiles.LineRenderingShader ); shader = BasicShader.LoadFromFXFile(game, game.EngineFiles.GetLineRenderingShaderStream(), null); shader.SetTechnique("LineRendering3D"); decl = new VertexDeclaration(game.GraphicsDevice, VertexPositionColor.VertexElements); WorldMatrix = Matrix.Identity; } // LineManager()
/*public static MaterialCollada FromColladaMaterial( ColladaMaterial mat ) * { * MaterialCollada ret = new MaterialCollada(); * * ret.Ambient = mat.Ambient; * ret.Diffuse = mat.Diffuse; * ret.Specular = mat.Specular; * ret.Shininess = mat.Shininess; * * if ( mat.DiffuseTexture != null ) * ret.DiffuseTexture = mat.DiffuseTexture.GetFullFilename(); * ret.DiffuseTextureRepeatU = mat.DiffuseTextureRepeatU; * ret.DiffuseTextureRepeatV = mat.DiffuseTextureRepeatV; * * if ( mat.NormalTexture != null ) * ret.NormalTexture = mat.NormalTexture.GetFullFilename(); * ret.NormalTextureRepeatU = mat.NormalTextureRepeatU; * ret.NormalTextureRepeatV = mat.NormalTextureRepeatV; * * return ret; * * }*/ private void LoadShader(EffectPool pool) { // // Load the shader and set the material properties // if (shader != null) { shader.Dispose(); } System.IO.Stream strm = EmbeddedFile.GetStreamFullPath( "MHGameWork.TheWizards.Graphics.Files.ColladaModelNew.fx", game.EngineFiles.DebugFilesDirectory + "/ColladaModelNew.fx"); shader = BasicShader.LoadFromFXFile(game, strm, pool); //Shader = BasicShader.LoadFromFXFile( game, new GameFile( shaderFilename ), pool ); LoadParameters(); LoadTechniques(); SetTechniqueType(TechniqueType.Colored); }
public void AddBasicShader(BasicShader basicShader) { shaders.Add(basicShader); }