Anybody have an idea what this variable is used for?
I'm trying to reverse engineer some code, and there is a variable called detailh. There is only one line where it is used. In all other instances, it is set to 1.0.
Anybody know what this does?
thanks.
Code:
vector<Uint8> texture::make_normals(const vector<Uint8>& src, unsigned w, unsigned h, float detailh) const
{
// src size must be w*h
vector<Uint8> dst(3*w*h);
float zh = 255.0f/detailh;
etc. etc. etc.Anybody know what this does?
thanks.
I don't know, but that is definitely some of the ugliest code I've ever seen!
I'll take a wild guess that h stands for height. zh might mean height expressed in terms of the z axis. detailh might mean detail scale corresponding to height. So height along the z axis is derived from a parameter passed in as detailh? Hey, my crystal ball is just as hazy as the next guy's...
[sarcasm] And I absolutely *love* comments! [/sarcasm] I don't understand why people are so crazy about them when they waste much more time and space than they save, 99% of the time. Somebody should start a non-comment revolution. It should go something like this: If you can't think of something helpful to say in a comment, then don't say it!
[edit] 'Nuther wild guess: Is this for some type of height-mapped terrain figgamajigger? [/edit]
I'll take a wild guess that h stands for height. zh might mean height expressed in terms of the z axis. detailh might mean detail scale corresponding to height. So height along the z axis is derived from a parameter passed in as detailh? Hey, my crystal ball is just as hazy as the next guy's...
[sarcasm] And I absolutely *love* comments! [/sarcasm] I don't understand why people are so crazy about them when they waste much more time and space than they save, 99% of the time. Somebody should start a non-comment revolution. It should go something like this: If you can't think of something helpful to say in a comment, then don't say it!
[edit] 'Nuther wild guess: Is this for some type of height-mapped terrain figgamajigger? [/edit]
Looks like it might be part of some code for turning an 8-bit image into a height map or normal map, but you haven't exactly given us enough information to say anything more than "255 is divided by it" 
Jake: the anti-comment revolution is called "extreme programming".

Jake: the anti-comment revolution is called "extreme programming".
Extreme programming huh? Doesn't seem very `extreme' to me to write code that documents itself, but I guess I'll have to do a Google trip for that next time I get the chance.
It would help if we knew what happened to zh after that.
A x / 255.0 would suggest converting an 8bit image value to a 0-1 float, which would be the normal way to do things like what OSC is suggesting.
But this is 255.0 / x which I can't see a simple use for.
I wrote a big stupid theory in here then deleted it because I think there are about 5000 possible explanations with the example given.
Kinda reminds me of a 'Add a quote to this image' type thing. 'What is this code trying to do?' <insert some funny response here>
Who knows? It could be a bug...
A x / 255.0 would suggest converting an 8bit image value to a 0-1 float, which would be the normal way to do things like what OSC is suggesting.
But this is 255.0 / x which I can't see a simple use for.
I wrote a big stupid theory in here then deleted it because I think there are about 5000 possible explanations with the example given.
Kinda reminds me of a 'Add a quote to this image' type thing. 'What is this code trying to do?' <insert some funny response here>
Who knows? It could be a bug...
Chopper, iSight Screensavers, DuckDuckDuck: http://majicjungle.com
AnotherJake Wrote:Extreme programming huh? Doesn't seem very `extreme' to me to write code that documents itself, but I guess I'll have to do a Google trip for that next time I get the chance.No need: Wikipedia knows all.
what are you attempting to reverse engineer?
Sir, e^iπ + 1 = 0, hence God exists; reply!
Well, it's submarine game code I found in - I believe at site's name was - sourceforge? Or something like that?
I thought this might be some typical technique, but obviously not.
Actually, I'm interested in the part of the code that implements a widgets interface. But to get here, i have to fudge with fonts. It's Linux/PC SDL/C++ code but it's turning into more trouble than it's worth.
I thought this might be some typical technique, but obviously not.
Actually, I'm interested in the part of the code that implements a widgets interface. But to get here, i have to fudge with fonts. It's Linux/PC SDL/C++ code but it's turning into more trouble than it's worth.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Use an integer value as part of a variable name | PHANTOMIAS | 5 | 3,346 |
Dec 8, 2009 09:24 AM Last Post: PHANTOMIAS |
|
| variable frame rate animation in Cocoa | Damian | 3 | 3,304 |
Jul 16, 2003 06:00 PM Last Post: macboy |
|

