Changeset 186

Show
Ignore:
Timestamp:
06/01/10 13:21:18 (2 years ago)
Author:
JoeCoder
Message:

Renamed Texture to TextureInstance?.
Renamed GPUTexture to Texture.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build/buildyage.d

    r183 r186  
    1010 */ 
    1111 
    12 const char[] app = "demo1"; // set which program to build against yage. 
    13 //const char[] app = "tests/integration/main.d"; 
     12//const char[] app = "demo1"; // set which program to build against yage. 
     13const char[] app = "tests/integration/main.d"; 
    1414 
    1515/** 
  • trunk/src/demo1/main.d

    r183 r186  
    9494        pass.ambient = "#fff"; 
    9595        pass.textures = [ 
    96             Texture(ResourceManager.texture("space/rocky2.jpg")), 
    97             Texture(ResourceManager.texture("space/rocky2-normal.jpg", GPUTexture.Format.AUTO_UNCOMPRESSED)) 
     96            TextureInstance(ResourceManager.texture("space/rocky2.jpg")), 
     97            TextureInstance(ResourceManager.texture("space/rocky2-normal.jpg", Texture.Format.AUTO_UNCOMPRESSED)) 
    9898        ]; 
    9999        pass.autoShader = MaterialPass.AutoShader.PHONG; 
  • trunk/src/tests/integration/main.d

    r184 r186  
    155155        // Create a textured plane 
    156156        Geometry geometry = Geometry.createPlane(4, 4); 
    157         Texture texture = Texture(ResourceManager.texture("space/rocky2.jpg")); 
    158         Texture normal = Texture(ResourceManager.texture("space/rocky2-normal.jpg")); 
     157        auto texture = TextureInstance(ResourceManager.texture("space/rocky2.jpg")); 
     158        auto normal = TextureInstance(ResourceManager.texture("space/rocky2-normal.jpg")); 
    159159        texture.transform = Matrix().scale(Vec3f(8)); 
    160160         
     
    272272        // Create a textured plane 
    273273        Geometry geometry = Geometry.createPlane(1, 1); 
    274         Texture texture = Texture(ResourceManager.texture("misc/reference2.png")); 
     274        auto texture = TextureInstance(ResourceManager.texture("misc/reference2.png")); 
    275275         
    276276        pass = geometry.getMeshes()[0].getMaterial().getPass();          
     
    282282         
    283283        Geometry geometry2 = Geometry.createPlane(1, 1); 
    284         Texture texture2 = Texture(ResourceManager.texture("fx/smoke.png")); 
     284        auto texture2 = TextureInstance(ResourceManager.texture("fx/smoke.png")); 
    285285         
    286286        MaterialPass pass2 = geometry2.getMeshes()[0].getMaterial().getPass();           
  • trunk/src/yage/core/object2.d

    r180 r186  
    195195     
    196196    /* 
    197     // Itemporal will be implemented by:   
     197    // Itemporal may be implemented by:    
    198198    Timer 
    199199    Repeater (loop makes no sense) 
  • trunk/src/yage/gui/style.d

    r175 r186  
    233233    union { 
    234234        struct { 
    235             GPUTexture borderTopImage; /// Border Images (TODO: support border-style and border-image-widths?) 
    236             GPUTexture borderRightImage; /// ditto 
    237             GPUTexture borderBottomImage; /// ditto 
    238             GPUTexture borderLeftImage; /// ditto 
    239         } 
    240         GPUTexture[4] borderImage; /// Set the four top/right/bottom/left border images in one array. 
    241     } 
    242     GPUTexture borderCenterImage; /// Border center image (not a part of CSS3, this image is stretched to fit within the borders). 
     235            Texture borderTopImage; /// Border Images (TODO: support border-style and border-image-widths?) 
     236            Texture borderRightImage; /// ditto 
     237            Texture borderBottomImage; /// ditto 
     238            Texture borderLeftImage; /// ditto 
     239        } 
     240        Texture[4] borderImage; /// Set the four top/right/bottom/left border images in one array. 
     241    } 
     242    Texture borderCenterImage; /// Border center image (not a part of CSS3, this image is stretched to fit within the borders). 
    243243     
    244244    union { 
    245245        struct { 
    246             GPUTexture borderTopLeftImage; /// Border corner images 
    247             GPUTexture borderTopRightImage;    /// ditto       
    248             GPUTexture borderBottomLeftImage; /// ditto 
    249             GPUTexture borderBottomRightImage; /// ditto 
    250         } 
    251         GPUTexture[4] borderCornerImage; /// Set the four border corner images images in one array. 
     246            Texture borderTopLeftImage; /// Border corner images 
     247            Texture borderTopRightImage;   /// ditto       
     248            Texture borderBottomLeftImage; /// ditto 
     249            Texture borderBottomRightImage; /// ditto 
     250        } 
     251        Texture[4] borderCornerImage; /// Set the four border corner images images in one array. 
    252252    } 
    253253     
     
    263263     
    264264    /// Background image and color.  backgroundColor is drawn first, with backgroundImage second, then borderImage on top. 
    265     GPUTexture backgroundImage; // just streteched for now. 
     265    Texture backgroundImage; // just streteched for now. 
    266266    Color backgroundColor; /// ditto 
    267267 
  • trunk/src/yage/gui/surface.d

    r176 r186  
    4141     
    4242    protected char[] oldText; 
    43     protected GPUTexture textTexture;  
     43    protected Texture textTexture;     
    4444 
    4545    /// Callback functions 
     
    343343             
    344344            if (!textTexture) // create texture on first go 
    345                 textTexture = new GPUTexture(textImage, GPUTexture.Format.AUTO, false, "Surface Text", true); 
     345                textTexture = new Texture(textImage, Texture.Format.AUTO, false, "Surface Text", true); 
    346346            else 
    347347            //  textTexture.commit(textImage, false, false, text, true); 
  • trunk/src/yage/gui/surfacegeometry.d

    r183 r186  
    224224 
    225225    // TODO: Convert this to accept materials as well as textures,  
    226     // or maybe just allow instantiation of a Material from a GPUTexture or Textur
    227     void setMaterials(GPUTexture backgroundImage, GPUTexture centerImage,  
    228                       GPUTexture[] borderImage, GPUTexture[] borderCornerImage, GPUTexture text, float opacity) 
     226    // or maybe just allow instantiation of a Material from a Texture or TextureInstanc
     227    void setMaterials(Texture backgroundImage, Texture centerImage,  
     228                      Texture[] borderImage, Texture[] borderCornerImage, Texture text, float opacity) 
    229229    {    
    230         MaterialPass createPass(GPUTexture texture, bool clamp=false) 
     230        MaterialPass createPass(Texture texture, bool clamp=false) 
    231231        {   auto result = new MaterialPass(); 
    232             result.textures  ~= Texture(texture, clamp, Texture.Filter.BILINEAR); 
     232            result.textures  ~= TextureInstance(texture, clamp, TextureInstance.Filter.BILINEAR); 
    233233            result.diffuse = Color(1f, 1f, 1f, opacity); 
    234234            result.blend = MaterialPass.Blend.AVERAGE; 
     
    270270        {   this.text.setMaterial(new Material()); 
    271271            this.text.getMaterial().setPass(createPass(text, true)); 
    272             this.text.getMaterial().getPass().textures[0].filter = Texture.Filter.NONE; 
     272            this.text.getMaterial().getPass().textures[0].filter = TextureInstance.Filter.NONE; 
    273273             
    274274            // Text bottom vertices depend on text texture size. 
  • trunk/src/yage/resource/collada.d

    r185 r186  
    5454    private Material[char[]] materials; 
    5555    private Image[char[]] images; 
    56     private GPUTexture[char[]] textures; 
     56    private Texture[char[]] textures; 
    5757     
    5858    /** 
     
    320320         
    321321        // Helper function for loading material data. 
    322         void getColorOrTexture(Node n, inout Color color, inout GPUTexture texture) 
     322        void getColorOrTexture(Node n, inout Color color, inout Texture texture) 
    323323        {   char[] name = n.name(); 
    324324            switch (name) 
     
    331331                    break; 
    332332                case "texture": 
    333                     texture = getTextureById(n.getAttribute("texture")); // TODO getImageByTexture 
     333                    texture = getTextureById(n.getAttribute("texture")); 
    334334                    break; 
    335335                default: 
     
    345345             
    346346            Node child = param.getChild();               
    347             GPUTexture texture; 
     347            Texture texture; 
    348348            switch(param.name()) 
    349349            { 
     
    353353                case "diffuse": 
    354354                    getColorOrTexture(child, pass.diffuse, texture); 
    355                     pass.setDiffuseTexture(Texture(texture)); // may be null 
     355                    pass.setDiffuseTexture(TextureInstance(texture)); // may be null 
    356356                    break; 
    357357                case "bump": // Bump map extension used by Okino, http://www.okino.com/conv/exp_collada_extensions.htm 
    358358                    getColorOrTexture(child, pass.diffuse, texture); 
    359                     pass.setNormalSpecularTexture(Texture(texture)); // may be null 
     359                    pass.setNormalSpecularTexture(TextureInstance(texture)); // may be null 
    360360                    break; 
    361361                case "specular": 
     
    391391            {   Node extraTechnique = extra.getChild("technique"); 
    392392                if (extraTechnique.hasChild("bump")) 
    393                 {   GPUTexture texture; 
     393                {   Texture texture; 
    394394                    getColorOrTexture(extraTechnique.getChild("bump").getChild("texture"), pass.diffuse, texture); 
    395                     pass.setNormalSpecularTexture(Texture(texture)); // may be null 
     395                    pass.setNormalSpecularTexture(TextureInstance(texture)); // may be null 
    396396        }   }   } 
    397397         
     
    542542     
    543543    /** 
    544      * Get a yage GPUTexture from the Collada file by its id. 
    545      * This uses ResourceManager.texture internally, so subsequent calls will return an already loaded GPUTexture. 
     544     * Get a yage Texture from the Collada file by its id. 
     545     * This uses ResourceManager.texture internally, so subsequent calls will return an already loaded Texture. 
    546546     *  
    547547     * These are Yage-specific notes for loading Collada textures: 
     
    551551     *     HIGH: 16 bit float (not supported yet) 
    552552     *     MAX: 32 bit float (not supported yet)</li> */ 
    553     GPUTexture getTextureById(char[] id) 
     553    Texture getTextureById(char[] id) 
    554554    {   id = Xml.makeId(id);         
    555555        if (id in textures) 
     
    577577         
    578578        // Load texture 
    579         GPUTexture.Format format = GPUTexture.Format.AUTO; 
     579        Texture.Format format = Texture.Format.AUTO; 
    580580        if (precision=="MID") 
    581             format = GPUTexture.Format.AUTO_UNCOMPRESSED; 
    582         GPUTexture result = ResourceManager.texture(imagePath, format); 
     581            format = Texture.Format.AUTO_UNCOMPRESSED; 
     582        Texture result = ResourceManager.texture(imagePath, format); 
    583583         
    584584        textures[id] = result; 
  • trunk/src/yage/resource/manager.d

    r179 r186  
    4040    private struct TextureKey 
    4141    {   char[] source; 
    42         GPUTexture.Format format; 
     42        Texture.Format format; 
    4343        bool mipmap; 
    4444    } 
     
    5151    private static Shader[char[]]   shaders; 
    5252    private static Sound[char[]]    sounds; 
    53     private static GPUTexture[TextureKey] textures; 
     53    private static Texture[TextureKey] textures; 
    5454     
    5555     
     
    255255     * If not, it will be loaded, uploaded to video memory, and stored in the resource pool.   
    256256     * This function is called automatically for each of a material's textures when loading a material. 
    257      * Keep in mind that multiple requested textures may use the same GPUTexture. 
     257     * Keep in mind that multiple requested textures may use the same Texture. 
    258258     * Params: filename = The Texture image file that will be loaded. */     
    259     static GPUTexture texture(char[] filename, GPUTexture.Format format=GPUTexture.Format.AUTO, bool mipmap=true) 
     259    static Texture texture(char[] filename, Texture.Format format=Texture.Format.AUTO, bool mipmap=true) 
    260260    {   filename = resolvePath(filename); 
    261261        TextureKey key; 
     
    264264         
    265265        // Search for matching format 
    266         int minFormat = GPUTexture.Format.AUTO ? 0 : format; 
    267         int maxFormat = GPUTexture.Format.AUTO ? GPUTexture.Format.max : format; 
     266        int minFormat = Texture.Format.AUTO ? 0 : format; 
     267        int maxFormat = Texture.Format.AUTO ? Texture.Format.max : format; 
    268268        for (int i=minFormat; i<maxFormat+1; i++) 
    269         {   key.format = cast(GPUTexture.Format)i; 
     269        {   key.format = cast(Texture.Format)i; 
    270270            auto result = key in textures; 
    271271            if (result) 
     
    275275        // Create new texture 
    276276        Timer t = new Timer(true); 
    277         GPUTexture result = new GPUTexture(filename, format, mipmap); 
     277        Texture result = new Texture(filename, format, mipmap); 
    278278        Log.info("Texture '%s' loaded in %s seconds.", filename, t); 
    279279        textures[key] = result; 
  • trunk/src/yage/resource/material.d

    r183 r186  
    126126    bool flat = false;      /// If true, use flat shading 
    127127    float lineWidth = 1;    /// Thickness in pixels of lines and points.  
    128     Texture[] textures; 
     128    TextureInstance[] textures; 
    129129     
    130130    Blend blend = Blend.NONE; /// Loaded from Collada's transparent property. 
     
    157157    } 
    158158     
    159     void setDiffuseTexture(Texture texture) 
     159    void setDiffuseTexture(TextureInstance texture) 
    160160    {   if (textures.length < 1) 
    161161            textures.length = 1; 
     
    163163    } 
    164164     
    165     void setNormalSpecularTexture(Texture texture) 
     165    void setNormalSpecularTexture(TextureInstance texture) 
    166166    {   if (textures.length < 2) 
    167167            textures.length = 2; 
  • trunk/src/yage/resource/texture.d

    r183 r186  
    1919 
    2020/** 
    21  * An instance of a GPUTexture. 
    22  * This allows many options to be set per instance of a GPUTexture instead of 
    23  * creating multiple copies of the GPUTexture (and consuming valuable memory) 
     21 * An instance of a Texture. 
     22 * This allows many options to be set per instance of a Texture instead of 
     23 * creating multiple copies of the Texture (and consuming valuable memory) 
    2424 * just to change filtering, clamping, or relative scale. */ 
    25 struct Texture 
     25struct TextureInstance 
    2626{ 
    2727    enum Filter /// 
     
    6464 
    6565    /// Property to set the type of filtering used for the textures of this layer. 
    66     int filter = Texture.Filter.DEFAULT; 
     66    int filter = TextureInstance.Filter.DEFAULT; 
    6767     
    6868    /// 
     
    7070 
    7171    ///  
    72     GPUTexture texture; 
     72    Texture texture; 
    7373     
    7474    protected static int[int] translate; 
    7575 
    7676    /// Create a new TextureInstance with the parameters specified. 
    77     static Texture opCall(GPUTexture texture, bool clamp=false, int filter=Texture.Filter.DEFAULT) 
    78  
    79     { 
    80         Texture result; 
     77    static TextureInstance opCall(Texture texture, bool clamp=false, int filter=TextureInstance.Filter.DEFAULT) 
     78 
     79    { 
     80        TextureInstance result; 
    8181        result.texture = texture; 
    8282        result.clamp = clamp; 
     
    8686     
    8787    char[] toString() 
    88     {   return swritef(`Texture {source: "%s"}`, texture ? texture.source : "null"); 
     88    {   return swritef(`TextureInstance {source: "%s"}`, texture ? texture.source : "null"); 
    8989    } 
    9090} 
     
    9292 
    9393/** 
    94  * A GPUTexture represents image data in video memory. 
     94 * A Texture represents image data in video memory. 
    9595 * 
    96  * Also, there's no need to be concerned about making 
     96 * There's no need to be concerned about making 
    9797 * texture dimensions a power of two, as they're automatically resized up to 
    9898 * the next highest supported size if the non_power_of_two OpenGL extension 
    9999 * isn't supported in hardware. */ 
    100 class GPUTexture : IRenderTarget 
     100class Texture : IRenderTarget 
    101101{ 
    102102     
     
    149149     
    150150    /** 
    151      * Create a GPUTexture from an image. 
    152      * The image will be uploaded to memory when the GPUTexture is first bound. */ 
    153     this(char[] filename, Format format=GPUTexture.Format.AUTO, bool mipmap=true) 
     151     * Create a Texture from an image. 
     152     * The image will be uploaded to memory when the Texture is first bound. */ 
     153    this(char[] filename, Format format=Texture.Format.AUTO, bool mipmap=true) 
    154154    {   source = ResourceManager.resolvePath(filename); 
    155155        this.format = format; 
     
    158158    } 
    159159     
    160     this(Image image, Format format=GPUTexture.Format.AUTO, bool mipmap=true, char[] source="", bool padding=false) 
     160    this(Image image, Format format=Texture.Format.AUTO, bool mipmap=true, char[] source="", bool padding=false) 
    161161    {   this.format = format; 
    162162        this.mipmap = mipmap; 
  • trunk/src/yage/scene/camera.d

    r183 r186  
    2525 
    2626/** 
    27  * A CameraNode renders everything it sees to a Texture. 
    28  * Currently, several constraints are used that allow for render-to-texture 
    29  * on hardware that only supports power-of-two sized textures.  In the future, 
    30  * this will be dropped for a more robust but less backward-compatible solution. 
    31  * Node that two Cameras cannot render concurrently since OpenGL itself 
    32  * isn't threadsafe.*/ 
     27 * TODO: Document me. */ 
    3328class CameraNode : MovableNode 
    3429{ 
  • trunk/src/yage/scene/terrain.d

    r182 r186  
    3535     *     resolution = The number of points (grid resolution) in the x and y directions passed  
    3636     *         to generator's getPoint() function. */ 
    37     this(TerrainGenerator generator, Texture[] textures, Vec2f min=Vec2f(-128), Vec2f max=Vec2f(127), Vec2f resolution=Vec2f(256)) 
     37    this(TerrainGenerator generator, TextureInstance[] textures, Vec2f min=Vec2f(-128), Vec2f max=Vec2f(127), Vec2f resolution=Vec2f(256)) 
    3838    { 
    3939        /// TODO 
     
    7575        Vec2f textureCoordinate;    /// Texture coordinates for this point on the terrain 
    7676        float[] textureBlend;       /// Normalized vector of arbitrary length specifying the amount of each texture to 
    77                                     /// use at this point.  TerrainNode.setTextures() specifies the textures themselves. 
     77                                    /// use at this point. 
    7878    } 
    7979     
     
    8484    /** 
    8585     * Get a lightmap Texture to use across the range of coordinates. 
    86      * If no lightmap is desired, this function can return a Texture without a GPUTexture. 
     86     * If no lightmap is desired, this function can return a Texture without a Texture. 
    8787     * The same GPU Texture can be reused across multiple calls with different values,  
    8888     * if the Textures' texture matrix adjusted as needed. 
     
    9191     *     max = Maximum xy coordinate of the rectangle needing a lightmap. 
    9292     * Returns: An RGB texture to use as a baked light-map.  It's color values will be modulated with the terrain. */ 
    93     Texture getLightmap(Vec2f min, Vec2f max);     
     93    TextureInstance getLightmap(Vec2f min, Vec2f max);     
    9494} 
    9595 
     
    133133    } 
    134134 
    135     Texture getLightmap(Vec2f min, Vec2f max) 
    136     {   Texture texture; 
     135    TextureInstance getLightmap(Vec2f min, Vec2f max) 
     136    {   TextureInstance texture; 
    137137        return texture; // return no lightmap for now. 
    138138    } 
  • trunk/src/yage/system/graphics/api/api.d

    r183 r186  
    3434        static LightNode[8] lights;      
    3535        static MaterialPass pass; /// 
    36         static ArrayBuilder!(Texture) textures; 
     36        static ArrayBuilder!(TextureInstance) textures; 
    3737         
    3838        static ArrayBuilder!(Matrix) projectionMatrixStack; 
  • trunk/src/yage/system/graphics/api/opengl.d

    r183 r186  
    325325        {            
    326326            // If target is a texture to render to 
    327             GPUTexture texture = cast(GPUTexture)target; 
     327            Texture texture = cast(Texture)target; 
    328328            if (texture) 
    329329            { 
     
    353353        { 
    354354             
    355             GPUTexture texture = cast(GPUTexture)current.renderTarget; 
     355            Texture texture = cast(Texture)current.renderTarget; 
    356356            if (texture) 
    357357            {    
     
    382382                    glBindTexture(GL_TEXTURE_2D, textures[texture.toHash()].id); 
    383383                    glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texture.width, texture.height, 0); 
    384                     texture.format = GPUTexture.Format.RGB8; 
     384                    texture.format = Texture.Format.RGB8; 
    385385                    texture.flipped = true; 
    386386                } 
     
    591591     *     textures = Textures to be bound.  Texture units beyond the array length will be disabled. 
    592592     * Returns:  True if all of the textures were bound.  Otherwise as many as possible will be bound. */ 
    593     bool bindTextures(Texture[] textures) 
     593    bool bindTextures(TextureInstance[] textures) 
    594594    {        
    595595        bool result = true; 
     
    620620            glEnable(GL_TEXTURE_2D); // does this need to be done for all textures or just once?             
    621621             
    622             GPUTexture gpuTexture = texture.texture; 
     622            Texture gpuTexture = texture.texture; 
    623623            assert(gpuTexture); 
    624624            ResourceInfo info = ResourceInfo.getOrCreate(gpuTexture, this.textures); 
     
    650650                             
    651651                // Convert auto format to a real format based on the image given. 
    652                 GPUTexture.Format format; 
    653                 if (gpuTexture.getFormat() == GPUTexture.Format.AUTO) 
     652                Texture.Format format; 
     653                if (gpuTexture.getFormat() == Texture.Format.AUTO) 
    654654                    switch(image.getChannels()) // This will support float formats when we switch to using Image2. 
    655                     {   case 1: format = GPUTexture.Format.COMPRESSED_LUMINANCE; break; 
    656                         case 2: format = GPUTexture.Format.COMPRESSED_LUMINANCE_ALPHA; break; 
    657                         case 3: format = GPUTexture.Format.COMPRESSED_RGB; break;                  
    658                         case 4: format = GPUTexture.Format.COMPRESSED_RGBA; break;                     
     655                    {   case 1: format = Texture.Format.COMPRESSED_LUMINANCE; break; 
     656                        case 2: format = Texture.Format.COMPRESSED_LUMINANCE_ALPHA; break; 
     657                        case 3: format = Texture.Format.COMPRESSED_RGB; break;                     
     658                        case 4: format = Texture.Format.COMPRESSED_RGBA; break;                    
    659659                        default: throw new ResourceException("Images with more than 4 channels are not supported."); 
    660660                    } 
    661                 else if (gpuTexture.getFormat() == GPUTexture.Format.AUTO_UNCOMPRESSED) 
     661                else if (gpuTexture.getFormat() == Texture.Format.AUTO_UNCOMPRESSED) 
    662662                    switch(image.getChannels()) // This will support float formats when we switch to using Image2. 
    663                     {   case 1: format = GPUTexture.Format.LUMINANCE8; break; 
    664                         case 2: format = GPUTexture.Format.LUMINANCE8_ALPHA8; break; 
    665                         case 3: format = GPUTexture.Format.RGB8; break;                    
    666                         case 4: format = GPUTexture.Format.RGBA8; break;                   
     663                    {   case 1: format = Texture.Format.LUMINANCE8; break; 
     664                        case 2: format = Texture.Format.LUMINANCE8_ALPHA8; break; 
     665                        case 3: format = Texture.Format.RGB8; break;                   
     666                        case 4: format = Texture.Format.RGBA8; break;                  
    667667                        default: throw new ResourceException("Images with more than 4 channels are not supported."); 
    668668                    } 
    669669                 
    670                 // Convert from GPUTexture.Format to OpenGL format constants. 
    671                 uint[GPUTexture.Format] glFormatMap = [ 
    672                     GPUTexture.Format.COMPRESSED_LUMINANCE : GL_LUMINANCE, 
    673                     GPUTexture.Format.COMPRESSED_LUMINANCE_ALPHA : GL_LUMINANCE_ALPHA, 
    674                     GPUTexture.Format.COMPRESSED_RGB : GL_RGB, 
    675                     GPUTexture.Format.COMPRESSED_RGBA : GL_RGBA, 
    676                     GPUTexture.Format.LUMINANCE8 : GL_LUMINANCE, 
    677                     GPUTexture.Format.LUMINANCE8_ALPHA8 : GL_LUMINANCE_ALPHA, 
    678                     GPUTexture.Format.RGB8 : GL_RGB, 
    679                     GPUTexture.Format.RGBA8 : GL_RGBA,                 
     670                // Convert from Texture.Format to OpenGL format constants. 
     671                uint[Texture.Format] glFormatMap = [ 
     672                    Texture.Format.COMPRESSED_LUMINANCE : GL_LUMINANCE, 
     673                    Texture.Format.COMPRESSED_LUMINANCE_ALPHA : GL_LUMINANCE_ALPHA, 
     674                    Texture.Format.COMPRESSED_RGB : GL_RGB, 
     675                    Texture.Format.COMPRESSED_RGBA : GL_RGBA, 
     676                    Texture.Format.LUMINANCE8 : GL_LUMINANCE, 
     677                    Texture.Format.LUMINANCE8_ALPHA8 : GL_LUMINANCE_ALPHA, 
     678                    Texture.Format.RGB8 : GL_RGB, 
     679                    Texture.Format.RGBA8 : GL_RGBA,                
    680680                ]; 
    681                 uint[GPUTexture.Format] glInternalFormatMap = [ 
    682                     GPUTexture.Format.COMPRESSED_LUMINANCE : GL_COMPRESSED_LUMINANCE, 
    683                     GPUTexture.Format.COMPRESSED_LUMINANCE_ALPHA : GL_COMPRESSED_LUMINANCE_ALPHA, 
    684                     GPUTexture.Format.COMPRESSED_RGB : GL_COMPRESSED_RGB, 
    685                     GPUTexture.Format.COMPRESSED_RGBA : GL_COMPRESSED_RGBA, 
    686                     GPUTexture.Format.LUMINANCE8 : GL_LUMINANCE, 
    687                     GPUTexture.Format.LUMINANCE8_ALPHA8 : GL_LUMINANCE_ALPHA, 
    688                     GPUTexture.Format.RGB8 : GL_RGB, 
    689                     GPUTexture.Format.RGBA8 : GL_RGBA,                 
     681                uint[Texture.Format] glInternalFormatMap = [ 
     682                    Texture.Format.COMPRESSED_LUMINANCE : GL_COMPRESSED_LUMINANCE, 
     683                    Texture.Format.COMPRESSED_LUMINANCE_ALPHA : GL_COMPRESSED_LUMINANCE_ALPHA, 
     684                    Texture.Format.COMPRESSED_RGB : GL_COMPRESSED_RGB, 
     685                    Texture.Format.COMPRESSED_RGBA : GL_COMPRESSED_RGBA, 
     686                    Texture.Format.LUMINANCE8 : GL_LUMINANCE, 
     687                    Texture.Format.LUMINANCE8_ALPHA8 : GL_LUMINANCE_ALPHA, 
     688                    Texture.Format.RGB8 : GL_RGB, 
     689                    Texture.Format.RGBA8 : GL_RGBA,                
    690690                ];           
    691691                uint glFormat = glFormatMap[format]; 
     
    738738             
    739739            // Filtering 
    740             if (texture.filter == Texture.Filter.DEFAULT) 
    741                 texture.filter = Texture.Filter.TRILINEAR;    // Create option to set this later 
     740            if (texture.filter == TextureInstance.Filter.DEFAULT) 
     741                texture.filter = TextureInstance.Filter.TRILINEAR;    // Create option to set this later 
    742742            switch(texture.filter) 
    743             {   case Texture.Filter.NONE: 
     743            {   case TextureInstance.Filter.NONE: 
    744744                    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpuTexture.mipmap ?  GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST); 
    745745                    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 
    746746                    break; 
    747                 case Texture.Filter.BILINEAR: 
     747                case TextureInstance.Filter.BILINEAR: 
    748748                    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpuTexture.mipmap ? GL_LINEAR_MIPMAP_NEAREST : GL_NEAREST); 
    749749                    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 
    750750                    break; 
    751751                default: 
    752                 case Texture.Filter.TRILINEAR: 
     752                case TextureInstance.Filter.TRILINEAR: 
    753753                    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpuTexture.mipmap ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR); 
    754754                    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 
     
    796796            uint blendTranslated; 
    797797            switch (texture.blend) 
    798             {   case Texture.Blend.ADD: blendTranslated = GL_ADD; break; 
    799                 case Texture.Blend.AVERAGE: blendTranslated = GL_DECAL; break; 
    800                 case Texture.Blend.NONE: 
    801                 case Texture.Blend.MULTIPLY: 
     798            {   case TextureInstance.Blend.ADD: blendTranslated = GL_ADD; break; 
     799                case TextureInstance.Blend.AVERAGE: blendTranslated = GL_DECAL; break; 
     800                case TextureInstance.Blend.NONE: 
     801                case TextureInstance.Blend.MULTIPLY: 
    802802                default: blendTranslated = GL_MODULATE; break;               
    803803            }