Game Engine Architecture
119 U32* getMeaningOfLife() { U32 anInteger = 42; return &anInteger; } You might get away with this if you use the returned ...
120 3. Fundamentals of Software Engineering for Games struct Foo // struct declaration { U32 mUnsignedValue; F32 mFloatValue; bo ...
121 3.2.4.1. Class-Static Members As we’ve seen, the static keyword has many diff erent meanings depending on context: z When us ...
122 3. Fundamentals of Software Engineering for Games example of such a diagram for the struct Foo listed below is shown in Fig- ...
123 Why does the compiler leave these “holes?” The reason lies in the fact that every data type has a natural alignment which mu ...
124 3. Fundamentals of Software Engineering for Games or class, the compiler introduces padding (holes) in order to ensure that ...
125 aligned. I usually like to add explicit padding to the end of my structs, to make the wasted space visible and explicit, lik ...
126 3. Fundamentals of Software Engineering for Games concrete class. Circle’s vtable will contain a pointer to Circle::Draw(), ...
127 class Circle : public Shape { public: void SetCenter(const Vector3& c) { m_center=c; } Vector3 GetCenter() const { retur ...
128 3. Fundamentals of Software Engineering for Games // do additional work specific to Triangles... } private: Vector3 m_vtx[3] ...
129 There’s actually a third kind of user—the other programmers on your team. (And if you are writing a piece of game middleware ...
130 3. Fundamentals of Software Engineering for Games On the one hand, it seems important to prevent bad game assets from persis ...
131 error checks to halt the program. Such a mechanism is known as an assertion system; we’ll investigate assertions in detail i ...
132 3. Fundamentals of Software Engineering for Games One way to solve this problem is to throw an exception. Structured excep- ...
133 Assertions check a programmer’s assumptions. They act like land mines for bugs. They check the code when it is fi rst writt ...
134 3. Fundamentals of Software Engineering for Games #else #define ASSERT(expr) // evaluates to nothing #endif Let’s break down ...
135 and then it breaks into the debugger. Notice the use of #expr as the fi rst argument to the message display function. The po ...
...
137 4 3D Math for Games A game is a mathematical model of a virtual world simulated in real-time on a computer of some kind. The ...
138 4. 3D Math for Games Figure 4.1. A point rep- resented in Cartesian coordinates. Py z x y Pz Px P Ph P h r Pr θ Pθ Figure 4. ...
«
3
4
5
6
7
8
9
10
11
12
»
Free download pdf