This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TEST_EVAL_LIST(myTests) | |
| { | |
| TEST_EVAL(MyTest0), | |
| TEST_EVAL(MyTest1), | |
| // ... | |
| } | |
| RunTests(myTests, ARRAY_COUNT(myTests), args, passBits); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define BEGIN_TEST_DEFINES static const int testIndexCounterBase = __COUNTER__ | |
| #define END_TEST_DEFINES static const int kNumTests = (__COUNTER__ - testIndexCounterBase - 1) | |
| #define TEST_CASE(TestName) \ | |
| static const int k##TestName##Index = __COUNTER__ - testIndexCounterBase - 1; \ | |
| bool TestName##Func(TestArgs &args) | |
| struct TestEval | |
| { | |
| int m_testIndex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public struct Aabb | |
| { | |
| public Vector2 Min; | |
| public Vector2 Max; | |
| public Aabb(Vector2 min, Vector2 max) | |
| { | |
| Min = min; | |
| Max = max; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int lastUpdateSector = 0; | |
| void Update() | |
| { | |
| xRotation = Mathf.Repeat(xRotation, 360.0f); | |
| int currentSector = (int) (xRotation / 45.0f); | |
| if (currentSector != lastUpdate) | |
| { | |
| int n = lastUpdateSector - currentSector; | |
| n = (n >= 0) ? n : -n; | |
| if (n > 4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void DrawFan(Vector3 o, Vector3 a, Vector3 b, uint numSegments) | |
| { | |
| a.Normalize(); | |
| b.Normalize(); | |
| Vector3 axis = Vector3.Cross(a, b); | |
| float angle = Mathf.Acos(Vector3.Dot(a, b)) * Mathf.Rad2Deg; | |
| float deltaAngle = angle / numSegments; | |
| Quaternion q = Quaternion.AngleAxis(deltaAngle, axis); |
NewerOlder