Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • Cole1497: this shout box is diarrhetic
      July 15, 2019, 04:53:27 PM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 13, 2019, 04:54:43 PM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 13, 2019, 04:34:05 PM
    • rune-list:[link] RuneScape Private Servers List & Community.
      July 12, 2019, 12:25:23 AM
    • ragnoroker: Join PoonScape today! amazing new server - growing fast! [link]
      July 11, 2019, 10:31:15 AM
    • ragnoroker: Join PoonScape today! amazing new server - growing fast! [link]
      July 11, 2019, 10:31:11 AM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 10, 2019, 05:27:05 AM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 10, 2019, 05:10:40 AM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 10, 2019, 04:43:07 AM
    • ArtexAdv: Artex-rsps,com [link] (BRAND NEW SERVER)
      July 08, 2019, 07:59:48 PM
    • ArtexAdv:[link] (BRAND NEW SERVER)
      July 08, 2019, 07:59:31 PM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 08, 2019, 07:03:33 PM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 08, 2019, 07:03:16 PM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 08, 2019, 06:59:50 PM
    • dan v jad: guys join PkOwnage today!! Great new server, raids, eco, PK! Discord [link] homepage [link]
      July 07, 2019, 10:59:48 AM
    • ragnoroker: Join PoonScape today! amazing new server - growing fast! - [link]
      July 07, 2019, 08:19:24 AM
    • ragnoroker: Join PoonScape today! amazing new server - growing fast! - [link]
      July 07, 2019, 08:19:04 AM
    • PavSwag: autoscape,0rg free ultra M box today (twisted bow??)
      July 05, 2019, 04:22:44 PM
    • PavSwag: autoscape,0rg
      July 05, 2019, 04:22:32 PM
    • PavSwag: #AS [link] is 317 Oldschool RuneScape Private Server emulating core factors of the game with a strong economy and balance of experience to bossing and prestiging - Lumbridge remade - Login with a starter set of armour and items - PK District - Preloading sets - GE PVP - Clan Wars Safe PK - PVP Tournaments - Activity points for training - All Skills Working, Skilling Island, Skilling Pets, Skilling Rewards - All Working Max Capes - 25+ Bosses with Pets - Superior Slayer Encounters - Clue Scrolls & Imbue Scrolls - Player Profiles - Player Owned Shops - Minigames, Construction, Sawmill, Warriors Guild, Pest Control, Barrows (with pets), Fight Caves, Inferno Caves, Chambers of Xeric, Custom Raids - QoL Updates: Keybinds, Skill Guides,
      July 05, 2019, 04:22:29 PM

    Author Topic: 317 Client RGB/HSL  (Read 3157 times)

    0 Members and 1 Guest are viewing this topic.

    Offlinesini

    • Member
    • ****
    • *
    • *
    • Posts: 5,785
    • Thanks: +0/-0
      • View Profile
    317 Client RGB/HSL
    « on: March 26, 2016, 06:21:26 AM »
    The older clients use a 16 bit color. The most significant 6 bits are used for hue, the least significant 7 bits are used for lightness or luminosity, and the other 3 bits are used for saturation. As you can see there isn't much room for variation in terms of saturation, which I find could be fairly limiting. But they did have support to where they could have effective lighting, but even if you're interpolating colors between vertices you only have 7 bits of variance which isn't much. I think it's easy to see why 32 bit color is superior.

    You either had: Very grey, Very intense?, or normal.

    https://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion

    Here's more information on the subject.

    Code: Java
    1.  
    2.   publicstaticvoid initColorTable(double d){
    3.     d +=Math.random()* 0.029999999999999999D - 0.014999999999999999D;
    4.     int j =0;
    5.     // 6 bits of hue
    6.     // 3 bits of saturation
    7.     // 7 bits of lightness
    8.     // hhhhhhssslllllll
    9.     for(int i =0; i <512; i++){
    10.       double hue =(double)(i >>3)/ 64D + 0.0078125D;
    11.       double saturation =(double)(i &7)/ 8D + 0.0625D;
    12.       for(int lightness =0; lightness <128; lightness++){
    13.         double l =(double) lightness / 128D;
    14.         // Achromatic, no saturation.
    15.         double r = l;
    16.         double g = l;
    17.         double b = l;
    18.         if(saturation != 0.0D){
    19.           double p;
    20.           if(l < 0.5D){
    21.             p = l *(1.0D + saturation);
    22.           }else{
    23.             p =(l + saturation)- l * saturation;
    24.           }
    25.           double q = 2D * l - p;
    26.  
    27.           double redHue = hue + 0.33333333333333331D;
    28.           if(redHue > 1.0D){
    29.             redHue--;
    30.           }
    31.  
    32.           double greenHue = hue;
    33.  
    34.           double blueHue = hue - 0.33333333333333331D;
    35.           if(blueHue < 0.0D){
    36.             blueHue++;
    37.           }
    38.  
    39.           if(6D * redHue < 1.0D){
    40.             r = q +(p - q)* 6D * redHue;
    41.           }elseif(2D * redHue < 1.0D){
    42.             r = p;
    43.           }elseif(3D * redHue < 2D){
    44.             r = q +(p - q)*(0.66666666666666663D - redHue)* 6D;
    45.           }else{
    46.             r = q;
    47.           }
    48.  
    49.           if(6D * greenHue < 1.0D)
    50.             g = q +(p - q)* 6D * greenHue;
    51.           elseif(2D * greenHue < 1.0D)
    52.             g = p;
    53.           elseif(3D * greenHue < 2D)
    54.             g = q +(p - q)*(0.66666666666666663D - greenHue)* 6D;
    55.           else
    56.             g = q;
    57.  
    58.           if(6D * blueHue < 1.0D)
    59.             b = q +(p - q)* 6D * blueHue;
    60.           elseif(2D * blueHue < 1.0D)
    61.             b = p;
    62.           elseif(3D * blueHue < 2D)
    63.             b = q +(p - q)*(0.66666666666666663D - blueHue)* 6D;
    64.           else
    65.             b = q;
    66.         }
    67.         int ri =(int)(r * 256D);
    68.         int gi =(int)(g * 256D);
    69.         int bi =(int)(b * 256D);
    70.         int rgb =(ri <<16)+(gi <<8)+ bi;
    71.         rgb = intensify(rgb, d);
    72.         if(rgb ==0){
    73.           rgb =1;
    74.         }
    75.         colorTable[j++]= rgb;
    76.       }
    77.     }
    78. }
    79.  
    80.  


    Code: Java
    1.   privatestaticint repackHSL(int hsl, int lightIntensity, int mode){
    2.     if((mode &2)==2){
    3.       if(lightIntensity <0){
    4.         lightIntensity =0;
    5.       }elseif(lightIntensity >127){
    6.         lightIntensity =127;
    7.       }
    8.       lightIntensity =127- lightIntensity;
    9.       return lightIntensity;
    10.     }
    11.     lightIntensity = lightIntensity *(hsl & 0x7f)>>7;
    12.     if(lightIntensity <2){
    13.       lightIntensity =2;
    14.     }elseif(lightIntensity >126){
    15.       lightIntensity =126;
    16.     }
    17.     return(hsl & 0xff80)+ lightIntensity;
    18.   }
    19.  
    « Last Edit: March 26, 2016, 06:33:33 AM by sini »
    Runescape Gambling

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal