示例#1
0
        /// <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);
        }
示例#2
0
        public static BasicShader LoadFromFXFile(IXNAGame game, System.IO.Stream strm, EffectPool pool)
        {
            BasicShader s = new BasicShader(game);

            s.LoadFromFXFile(strm, pool);

            return(s);
        }
        /// <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);
        }