Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • Shadow Monarch: where do i get a client and source
      November 19, 2019, 11:17:48 PM
    • Shadow Monarch: i wanna start a server
      November 19, 2019, 11:17:34 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 19, 2019, 12:52:54 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 19, 2019, 12:52:50 PM
    • U Go Home: hey does anyone have allstarscape v2 i want to make it better something to do and try and bring back the good old days
      November 19, 2019, 09:22:14 AM
    • ArtexAdv:[link] come check out the most
      November 18, 2019, 11:39:14 AM
    • ArtexAdv: Www.galaxy-rsps.net come check out the most unique custom rsps
      November 18, 2019, 11:38:50 AM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 17, 2019, 10:14:59 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 17, 2019, 10:14:50 PM
    • Mazeingmaze: last logged in 2008
      November 17, 2019, 06:46:52 PM
    • Mazeingmaze: Ayy BRO
      November 17, 2019, 06:46:46 PM
    • SuperNativeZ: WANT TO BE APART OF THE BEST RSPS? [link]
      November 17, 2019, 12:22:53 AM
    • SuperNativeZ: WHY CHOOSE GALAXY RSPS?  WE HAVE THE BEST UNIQUE GAMEPLAY [link]
      November 17, 2019, 12:22:42 AM
    • SuperNativeZ: WHY CHOOSE GALAXY RSPS?  WE HAVE THE BEST UNIQUE GAMEPLAY [link]
      November 17, 2019, 12:22:39 AM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild -[link]
      November 15, 2019, 12:46:05 PM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild -[link]
      November 15, 2019, 12:46:01 PM
    • Cole1497: join horney scape we are horney all the time and have a sex emote
      November 09, 2019, 05:14:33 PM
    • thewraith500: try autoscape,0rg brand new osrs CUSTOMS server! fight caves for flaming fire cape, upgrade them to infernal wings + more!
      November 09, 2019, 01:37:29 AM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:24 PM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:17 PM

    Author Topic: 317 Client RGB/HSL  (Read 3230 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