コード例 #1
0
ファイル: Draw.cs プロジェクト: JakeSmokie/SharpQuake
        /// <summary>
        /// Draw_TextureMode_f
        /// </summary>
        static void TextureMode_f()
        {
            int i;

            if (Cmd.Argc == 1)
            {
                for (i = 0; i < 6; i++)
                {
                    if (_MinFilter == _Modes[i].minimize)
                    {
                        Con.Print("{0}\n", _Modes[i].name);
                        return;
                    }
                }

                Con.Print("current filter is unknown???\n");
                return;
            }

            for (i = 0; i < _Modes.Length; i++)
            {
                if (Common.SameText(_Modes[i].name, Cmd.Argv(1)))
                {
                    break;
                }
            }
            if (i == _Modes.Length)
            {
                Con.Print("bad filter name!\n");
                return;
            }

            _MinFilter = _Modes[i].minimize;
            _MagFilter = _Modes[i].maximize;

            // change all the existing mipmap texture objects
            for (i = 0; i < _NumTextures; i++)
            {
                gltexture_t glt = _glTextures[i];
                if (glt.mipmap)
                {
                    Bind(glt.texnum);
                    SetTextureFilters(_MinFilter, _MagFilter);
                }
            }
        }
コード例 #2
0
    public static void Draw_TextureMode_f()
    {
        int i;

        if (cmd_argc == 1)
        {
            for (i = 0; i < 6; i++)
            {
                if (gl_filter_min == _Modes[i].minimize)
                {
                    Con_Printf("{0}\n", _Modes[i].name);
                    return;
                }
            }
            Con_Printf("current filter is unknown???\n");
            return;
        }

        for (i = 0; i < _Modes.Length; i++)
        {
            if (SameText(_Modes[i].name, Cmd_Argv(1)))
            {
                break;
            }
        }
        if (i == _Modes.Length)
        {
            Con_Printf("bad filter name!\n");
            return;
        }

        gl_filter_min = _Modes[i].minimize;
        gl_filter_max = _Modes[i].maximize;

        // change all the existing mipmap texture objects
        for (i = 0; i < numgltextures; i++)
        {
            gltexture_t glt = gltextures[i];
            if (glt.mipmap)
            {
                GL_Bind(glt.texnum);
                SetTextureFilters(gl_filter_min, gl_filter_max);
            }
        }
    }
コード例 #3
0
ファイル: Draw.cs プロジェクト: JakeSmokie/SharpQuake
        /// <summary>
        /// GL_LoadTexture
        /// </summary>
        public static int LoadTexture(string identifier, int width, int height, ByteArraySegment data, bool mipmap, bool alpha)
        {
            // see if the texture is allready present
            if (!String.IsNullOrEmpty(identifier))
            {
                for (int i = 0; i < _NumTextures; i++)
                {
                    gltexture_t glt = _glTextures[i];
                    if (glt.identifier == identifier)
                    {
                        if (width != glt.width || height != glt.height)
                        {
                            Sys.Error("GL_LoadTexture: cache mismatch!");
                        }

                        return(glt.texnum);
                    }
                }
            }
            if (_NumTextures == _glTextures.Length)
            {
                Sys.Error("GL_LoadTexture: no more texture slots available!");
            }

            gltexture_t tex = new gltexture_t();

            _glTextures[_NumTextures] = tex;
            _NumTextures++;

            tex.identifier = identifier;
            tex.texnum     = _TextureExtensionNumber;
            tex.width      = width;
            tex.height     = height;
            tex.mipmap     = mipmap;

            Bind(tex.texnum);

            Upload8(data, width, height, mipmap, alpha);

            _TextureExtensionNumber++;

            return(tex.texnum);
        }
コード例 #4
0
ファイル: Draw.cs プロジェクト: Memorix101/SharpQuake
        /// <summary>
        /// GL_LoadTexture
        /// </summary>
        public static int LoadTexture(string identifier, int width, int height, ByteArraySegment data, bool mipmap, bool alpha)
        {
            // see if the texture is allready present
            if (!String.IsNullOrEmpty(identifier))
            {
                for (int i = 0; i < _NumTextures; i++)
                {
                    gltexture_t glt = _glTextures[i];
                    if (glt.identifier == identifier)
                    {
                        if (width != glt.width || height != glt.height)
                            Sys.Error("GL_LoadTexture: cache mismatch!");
                        return glt.texnum;
                    }
                }
            }
            if (_NumTextures == _glTextures.Length)
                Sys.Error("GL_LoadTexture: no more texture slots available!");

            gltexture_t tex = new gltexture_t();
            _glTextures[_NumTextures] = tex;
            _NumTextures++;

            tex.identifier = identifier;
            tex.texnum = _TextureExtensionNumber;
            tex.width = width;
            tex.height = height;
            tex.mipmap = mipmap;

            Bind(tex.texnum);

            Upload8(data, width, height, mipmap, alpha);

            _TextureExtensionNumber++;

            return tex.texnum;
        }