Author Topic: Gun sight image size analysis  (Read 31737 times)

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
Re: Gun sight image size analysis
« Reply #210 on: July 20, 2010, 03:24:53 PM »
Ghost,

Time and patience.

Very soon another decade will come and go. Can't you hear it? Bullet will be in the same place you are now.....

Now littel one if you just wait, Granpaw HiTech will finish COADing the neural brain interface and you can twist the range ring knob.....I just wantted to push the button thingy and make it bigger....now littel one it's a range ring knob....I I really wanna learn...I just wanna push the button thingy noby thingy and shoot the pink guys dead....I'm just trying to help you littelone.....Oh fiddelsticks...bet Ghost is giggling reading this one drinking his morning coffe in his fuzzy bunny slippers..... :old:
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline BulletVI

  • Silver Member
  • ****
  • Posts: 891
      • http://virtuallyinfamous.webs.com
Re: Gun sight image size analysis
« Reply #211 on: July 20, 2010, 03:35:18 PM »
Ghost,

Time and patience.

Very soon another decade will come and go. Can't you hear it? Bullet will be in the same place you are now.....

Now littel one if you just wait, Granpaw HiTech will finish COADing the neural brain interface and you can twist the range ring knob.....I just wantted to push the button thingy and make it bigger....now littel one it's a range ring knob....I I really wanna learn...I just wanna push the button thingy noby thingy and shoot the pink guys dead....I'm just trying to help you littelone.....Oh fiddelsticks...bet Ghost is giggling reading this one drinking his morning coffe in his fuzzy bunny slippers..... :old:

 Im laughing my socks off  :rofl :rofl :rofl :rofl
You Don't See Me But You Hear Me Coming Then Darkness

HUH Computer's GIVE ME A SPANNER AND A WRENCH ANY DAY OF THE WEEK.  ( Mr Fix It ) :)

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
Re: Gun sight image size analysis
« Reply #212 on: July 20, 2010, 04:00:47 PM »
Bullet,

It is very possible if Ghost has been kind enough to give you a freindly nudge that it's time to give your freinds on this Forum a tiny break. Other wise I suspect your enthusiam throughout all of the sections on the Forum may result in fuzzy bunny slipper and LCD cleaning bills from sputtered and spewed coffee mysteriously showing up in your mailbox.....Don't fret, your fan club still loves you...we need a break to get our beauty sleep... :joystick:

The BulletVI Fuzzy Bunny Slippers Fan Club........   :angel:
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline BulletVI

  • Silver Member
  • ****
  • Posts: 891
      • http://virtuallyinfamous.webs.com
Re: Gun sight image size analysis
« Reply #213 on: July 20, 2010, 04:06:50 PM »
Ok i just cant resist a good joke lol  :rofl :rofl

( And i probally dont have freinds here maybe enemy's tho i cant tell if you fly for the rooks or knight's or the bish even :lol  :rofl :rofl :rofl :rofl )
« Last Edit: July 20, 2010, 04:09:35 PM by BulletVI »
You Don't See Me But You Hear Me Coming Then Darkness

HUH Computer's GIVE ME A SPANNER AND A WRENCH ANY DAY OF THE WEEK.  ( Mr Fix It ) :)

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
Re: Gun sight image size analysis
« Reply #214 on: July 20, 2010, 08:01:10 PM »
Skuzzy,

Please smack me in the noggin as hard as you can several times with your "NUMPTE" stick........ :salute
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline Ardy123

  • Gold Member
  • *****
  • Posts: 3417
Re: Gun sight image size analysis
« Reply #215 on: July 20, 2010, 08:31:44 PM »
I didn't even remember we had a limit. But the limit was simply to make sure they were a power of 2. Never really thought someone would want more then 256. Any way it now reads.


static int _TexImageOk(grTEX_IMAGE * TexImage)
{
   if(TexImage->Width != TexImage->Height)
   {
      return 0;
   }
   if(TexImage->Width != 16 &&
      TexImage->Width != 32 &&
      TexImage->Width != 64 &&
      TexImage->Width != 128 &&
      TexImage->Width != 256 &&
      TexImage->Width != 512 &&
      TexImage->Width != 1024)
   {
      return 0;
   }
   return 1;
}



heres a more compact way... just cuz I'm lame and like stupid programming challenges...

static int _TexImageOk(grTEX_IMAGE * TexImage)
{
   return (  (TexImage->Width | TexImage->Height ) &&
                    ( TexImage->Width == TexImage->Height ) &&
                    !( TexImage->Width & ( TexImage->Width - 1 ) )
                  );           
}


I didn't test or compile it so there may be some syntactical issues but its less processor cycles.

Yeah, that's right, you just got your rear handed to you by a fuggly puppet!
==Army of Muppets==
(Bunnies)

Offline gyrene81

  • Plutonium Member
  • *******
  • Posts: 11629
Re: Gun sight image size analysis
« Reply #216 on: July 20, 2010, 09:44:11 PM »

heres a more compact way... just cuz I'm lame and like stupid programming challenges...

static int _TexImageOk(grTEX_IMAGE * TexImage)
{
   return (  (TexImage->Width | TexImage->Height ) &&
                    ( TexImage->Width == TexImage->Height ) &&
                    !( TexImage->Width & ( TexImage->Width - 1 ) )
                  );           
}


I didn't test or compile it so there may be some syntactical issues but its less processor cycles.


You're missing the variables Ardy, the way it's written it's just making empty repeated calls looking for something that either has to exist somewhere else or within the script.
jarhed  
Build a man a fire and he'll be warm for a day...
Set a man on fire and he'll be warm for the rest of his life. - Terry Pratchett

Offline hitech

  • Administrator
  • Administrator
  • *****
  • Posts: 12326
      • http://www.hitechcreations.com
Re: Gun sight image size analysis
« Reply #217 on: July 20, 2010, 10:05:33 PM »
Ardy if you ever wrote that code for me you would be fired.

HiTech

Offline Ardy123

  • Gold Member
  • *****
  • Posts: 3417
Re: Gun sight image size analysis
« Reply #218 on: July 21, 2010, 12:05:35 AM »
You're missing the variables Ardy, the way it's written it's just making empty repeated calls looking for something that either has to exist somewhere else or within the script.

The passed in parameters TexImage which can be dereferenced to point to TexImage->Width and TexImage->Height are the only variables you need.

 there are no function calls from within that function..

(TexImage->Width | TexImage->Height ) =  will result in a non-zero value if either width or height is non-zero by 'or'ing the two values
( TexImage->Width == TexImage->Height )  =  checks if both the texture width and height are the same size
!( TexImage->Width & ( TexImage->Width - 1 ) = checks if the width is a power of 2

The return statement returns the result of the logical expression.

Ardy if you ever wrote that code for me you would be fired.

HiTech

 :rofl I'm not trying to question your abilities at all,  and very true, it is obfuscated and hard to understand, thus hard to maintain but you don't have to keep adding logical expressions every time you want to support a larger texture that is a power of 2. I suppose if you wanted to lock it so it didn't support beyond a certain size you could throw in one last expression like

(TexImage->Width <= MAX_GUNTEX_SIZE)

where somewhere else you had defined.
enum {
...
MAX_GUNTEX_SIZE = 1024
...
};


« Last Edit: July 21, 2010, 12:55:31 AM by Ardy123 »
Yeah, that's right, you just got your rear handed to you by a fuggly puppet!
==Army of Muppets==
(Bunnies)

Offline bustr

  • Plutonium Member
  • *******
  • Posts: 12436
Re: Gun sight image size analysis
« Reply #219 on: July 21, 2010, 03:16:14 AM »
What does HiTech know to which he is looking for the return of 16, 32, 128, 256, 512, 1024 as specific responses opposed to sampling for all text images between "0" and "1024"? Is it to account for end user fat fingering when creating the milrad size text file data entry? --Or-- Is the function looking for those specific responses a very simple and elegant entity which needs only those 6 responces opposed to parsing everything between 0 and 1024 in each text file? After all we can only black box the COAD in this post looking for the 6 responses. We have absolutly no clue if it is a real part of the game COAD or HiTech chatting with a freind in a casual moment.

Seems like something my assembley language teacher used to ding me over.
bustr - POTW 1st Wing


This is like the old joke that voters are harsher to their beer brewer if he has an outage, than their politicians after raising their taxes. Death and taxes are certain but, fun and sex is only now.

Offline Ardy123

  • Gold Member
  • *****
  • Posts: 3417
Re: Gun sight image size analysis
« Reply #220 on: July 21, 2010, 05:22:57 AM »
What does HiTech know to which he is looking for the return of 16, 32, 128, 256, 512, 1024 as specific responses opposed to sampling for all text images between "0" and "1024"? Is it to account for end user fat fingering when creating the milrad size text file data entry? --Or-- Is the function looking for those specific responses a very simple and elegant entity which needs only those 6 responces opposed to parsing everything between 0 and 1024 in each text file? After all we can only black box the COAD in this post looking for the 6 responses. We have absolutly no clue if it is a real part of the game COAD or HiTech chatting with a freind in a casual moment.

Seems like something my assembley language teacher used to ding me over.

HiTech is looking for images with widths that are a power of 2. Traditionally a lot of graphics platforms required the width of a texture to be a power of 2. This is mainly for performance and silicon reduction reasons. For example, when the hardware indexes into the texture to retrieve a texel, it would have to convert a 2d coordinate (u,v) to a 1 dimensional memory address. The formula for finding this is...
(texture_width * v + u) * texture_bit_depth + texture_start_memory_location

Now what does that have to do with widths that are a power of 2? Well, if the width is a power of two a 'bit-shift' to the left can be used instead of a multiplication operation which is faster and requires less silicon to do. AKA

2<<1 = 2 *2 = 4
or
2<<2 = 2 *4 = 8


Also you could 'cap' and 'wrap' texture u values and force them to be within the bounds of the texture with simple boolean operations such as 'and'.

texture width = 32

/* force texture u coordinate to wrap */
u = u&(width-1);


Now of course there are many more reasons hardware designers chose this option beyond just texel indexing but the short answer is that historically textures had to be widths of powers of 2.

I don't know that much about DirectX, but I know that there are extensions to OpenGL which support non-power of 2 texture widths... aka GL_ARB_texture_non_power_of_t wo is one that comes to mind.

Another option would be wasteful of memory but a non-power-of-2 width texture could be blited into a larger power-of-2-texture then the corresponding texture coordinates on the mesh could be updated to point to the correct locations in the texture.

Ok HiTech, now its your turn to attempt to lambast me on the BBS as I know your itching too. :)

Yeah, that's right, you just got your rear handed to you by a fuggly puppet!
==Army of Muppets==
(Bunnies)

Offline AKDogg

  • Gold Member
  • *****
  • Posts: 2305
      • http://aksquad.net/
Re: Gun sight image size analysis
« Reply #221 on: July 21, 2010, 08:05:15 AM »
 :banana: :noid :lol :O
AKDogg
Arabian knights
#Dogg in AW
http://aksquad.net/

Offline hitech

  • Administrator
  • Administrator
  • *****
  • Posts: 12326
      • http://www.hitechcreations.com
Re: Gun sight image size analysis
« Reply #222 on: July 21, 2010, 08:58:36 AM »
Ardy it simple, I have been coading for close to 40 years.  The piece of coad you wrote is

1. Not equivalent to mine. Yours test only for power of 2, mine test for specific size, hence any discussion which is better is moot.
2. As I said, I would fire some one for writing that.
3. There are times for efficient code, But 99% of the time straight forward easy to understand code trumps speed.
4. I don't write code for the simple sake of coading, I write coad to do something with it.

HiTech


Offline Slash27

  • Plutonium Member
  • *******
  • Posts: 12792
Re: Gun sight image size analysis
« Reply #223 on: July 21, 2010, 09:49:55 AM »
You're old.

Offline BulletVI

  • Silver Member
  • ****
  • Posts: 891
      • http://virtuallyinfamous.webs.com
Re: Gun sight image size analysis
« Reply #224 on: July 21, 2010, 11:31:43 AM »

Cripes Coad
You Don't See Me But You Hear Me Coming Then Darkness

HUH Computer's GIVE ME A SPANNER AND A WRENCH ANY DAY OF THE WEEK.  ( Mr Fix It ) :)