On Wednesday, 20 November 2013 at 10:20:06 UTC, Rene Zwanenburg wrote:
On Wednesday, 20 November 2013 at 09:15:41 UTC, Rene Zwanenburg wrote:
Hi,

A few things jumped out at me:

Camera.d:

...

Oops, I have to run.. Will take a look at the rest later.

Still regarding camera.d:

- The glfw3 import appears to be unused and can be removed.

- the call to Math.perspectiveGL modifies OpenGL state. Your math functions _really_ shouldn't interact with OpenGL.

- Taking the previous point a bit further, your Camera class doesn't need to know about OpenGL either. In your rendering routine, get the camera matrices from a camera and pass them to OpenGL.

- Like Paulo said, don't use the fixed function pipeline. If you're not familiar with 3D yet the FFP is easier to use at first, but using modern OpenGL will pay for itself in the long run. I don't know where to find a good introduction to modern OpenGL though, perhaps someone else around here..

- rotate, move are unnecessary. Once you switch to gl3n, move becomes:
camera.position += someVector;
Same thing with rotate, only you multiply:
camera.rotation *= someQuaternion;


math.d:

- D allows free functions. There's no need to use hacks like completely static classes. You can remove the Math class and put it's functions in the module.

- I'd also make std.math a public import, so you only have to import your math to get both in another module.

- perspectiveGL doesn't belong here, but this is fixed by using gl3n.


time.d

- Same thing with the statics as in math. Though personally I'd call Time Timer, and make instances. You'll probably want to have more than one timer.

- Sleeping doesn't belong in the timer. It should only calculate total running time and delta time in update. Later on you'll probably find out it needs more features, but these two will be fine for now. If anywhere, sleeping belongs in the game loop. That being said I'd advise against sleeping at all. It's usually better to use vsync, or run at max fps if the user disables it.


That's all I could find during a quick peek.. If you'd like me to clarify some of these points, please don't hesitate to ask!

Interesting, would you give me an example of the @property and the timer stuff, if that's all right with you?

I've attempted doing the @property stuff, but I run into lots of problems, so maybe your example will show me what I've done wrong.

Reply via email to