Advertisement

Writing my own camera class... Problems

Started by October 24, 2004 04:09 AM
12 comments, last by hang3r 20 years, 4 months ago
Quote:
Professor Charles Anthony Richard Hoare:
Premature optimization is the root of all evil.


Quote:
Attributed to Kent Beck:
Make it work. Make it right. Make it fast.


Quote:
Source unknown (paraphrased):
90% of execution time is spent in 10% of the code.


I believe your original code should be something like:
void positionWorld(){	glRotatef(pitch,1.0f,0,0);	glRotatef(heading,0,1.0f,0);	/* Almost certainly an unnesseccary test and an example of premature optimisation	if ((velocity > 0) || (velocity < 0))	{*/		float cosPitch = std::cos(pitch * piover180);		xpos += sin(heading * piover180) * velocity * cosPitch;		zpos -= cos(heading * piover180) * velocity * cosPitch;		ypos -= sin(pitch * piover180) * velocity;/*	}*/	glTranslatef(-xpos, -ypos, -zpos);}


Enigma
Quote:

"Belated pessimization is the leaf of no good." - Len Lattanzi
Advertisement
Enigma, your code makes things horribly worse, but it has given me a new approach to getting it the way it should be...


-Nathan
SORRY! ooppsss.... My own mistake, thank you very much enigma, it works, thank you!

-Nathan

This topic is closed to new replies.

Advertisement