Changeset 2900
 Timestamp:
 Sep 12, 2013, 3:50:41 PM (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/test/unit/camera.cpp
r2897 r2900 38 38 void SetUp() 39 39 { 40 eye = vec3(0.f, 50.f, 50.f);40 eye = vec3(0.f, 0.f, 50.f); 41 41 target = vec3(0.f); 42 42 up = vec3(0.f, 1.f, 0.f); … … 80 80 TEST_VECTOR(target, tc.GetTarget()); 81 81 TEST_VECTOR(up, tc.GetUp()); 82 83 tc.UseTarget(false); 84 TEST_VECTOR(vec3(0.f, 0.f, 49.f), tc.GetTarget()); 82 85 } 83 86 … … 106 109 LOLUNIT_TEST(SetProjectionTest) 107 110 { 108 mat4 refmx = mat4::perspective(fov, screen_size, screen_ ratio, near, far);111 mat4 refmx = mat4::perspective(fov, screen_size, screen_size * screen_ratio, near, far); 109 112 110 tc.SetProjection( refmx);113 tc.SetProjection(fov, near, far, screen_size, screen_ratio); 111 114 TEST_MATRIX(refmx, tc.GetProjection()); 115 LOLUNIT_ASSERT_DOUBLES_EQUAL(fov, tc.GetFov(), 1.e5f); 116 LOLUNIT_ASSERT_DOUBLES_EQUAL(screen_size, tc.GetScreenSize(), 1.e5f); 117 LOLUNIT_ASSERT_DOUBLES_EQUAL(screen_ratio, tc.GetScreenRatio(), 1.e5f); 118 LOLUNIT_ASSERT_DOUBLES_EQUAL(near, tc.GetNear(), 1.e5f); 119 LOLUNIT_ASSERT_DOUBLES_EQUAL(far, tc.GetFar(), 1.e5f); 120 LOLUNIT_ASSERT(is_shifted == tc.IsShifted()); 112 121 113 122 tc.SetProjection(fov, near, far); … … 118 127 LOLUNIT_ASSERT_DOUBLES_EQUAL(near, tc.GetNear(), 1.e5f); 119 128 LOLUNIT_ASSERT_DOUBLES_EQUAL(far, tc.GetFar(), 1.e5f); 120 LOLUNIT_ASSERT(is_shifted != tc.IsShifted());129 LOLUNIT_ASSERT(is_shifted == tc.IsShifted()); 121 130 122 tc.SetProjection( fov, near, far, screen_size, screen_ratio);131 tc.SetProjection(refmx); 123 132 TEST_MATRIX(refmx, tc.GetProjection()); 124 LOLUNIT_ASSERT_DOUBLES_EQUAL(fov, tc.GetFov(), 1.e5f);125 LOLUNIT_ASSERT_DOUBLES_EQUAL(screen_size, tc.GetScreenSize(), 1.e5f);126 LOLUNIT_ASSERT_DOUBLES_EQUAL(screen_ratio, tc.GetScreenRatio(), 1.e5f);127 LOLUNIT_ASSERT_DOUBLES_EQUAL(near, tc.GetNear(), 1.e5f);128 LOLUNIT_ASSERT_DOUBLES_EQUAL(far, tc.GetFar(), 1.e5f);129 LOLUNIT_ASSERT(is_shifted != tc.IsShifted());130 133 131 134 tc.SetFov(fov); … … 136 139 LOLUNIT_ASSERT_DOUBLES_EQUAL(near, tc.GetNear(), 1.e5f); 137 140 LOLUNIT_ASSERT_DOUBLES_EQUAL(far, tc.GetFar(), 1.e5f); 138 LOLUNIT_ASSERT(is_shifted != tc.IsShifted());141 LOLUNIT_ASSERT(is_shifted == tc.IsShifted()); 139 142 140 143 tc.SetScreenInfos(screen_size); … … 145 148 LOLUNIT_ASSERT_DOUBLES_EQUAL(near, tc.GetNear(), 1.e5f); 146 149 LOLUNIT_ASSERT_DOUBLES_EQUAL(far, tc.GetFar(), 1.e5f); 147 LOLUNIT_ASSERT(is_shifted != tc.IsShifted());150 LOLUNIT_ASSERT(is_shifted == tc.IsShifted()); 148 151 149 152 tc.SetScreenInfos(screen_size, screen_ratio); … … 154 157 LOLUNIT_ASSERT_DOUBLES_EQUAL(near, tc.GetNear(), 1.e5f); 155 158 LOLUNIT_ASSERT_DOUBLES_EQUAL(far, tc.GetFar(), 1.e5f); 156 LOLUNIT_ASSERT(is_shifted != tc.IsShifted());159 LOLUNIT_ASSERT(is_shifted == tc.IsShifted()); 157 160 158 161 tc.SetDrawInfos(far); … … 163 166 LOLUNIT_ASSERT_DOUBLES_EQUAL(near, tc.GetNear(), 1.e5f); 164 167 LOLUNIT_ASSERT_DOUBLES_EQUAL(far, tc.GetFar(), 1.e5f); 165 LOLUNIT_ASSERT(is_shifted != tc.IsShifted());168 LOLUNIT_ASSERT(is_shifted == tc.IsShifted()); 166 169 167 170 tc.SetDrawInfos(near, far); … … 172 175 LOLUNIT_ASSERT_DOUBLES_EQUAL(near, tc.GetNear(), 1.e5f); 173 176 LOLUNIT_ASSERT_DOUBLES_EQUAL(far, tc.GetFar(), 1.e5f); 174 LOLUNIT_ASSERT(is_shifted != tc.IsShifted());177 LOLUNIT_ASSERT(is_shifted == tc.IsShifted()); 175 178 176 179 is_shifted = true; … … 184 187 LOLUNIT_ASSERT_DOUBLES_EQUAL(near, tc.GetNear(), 1.e5f); 185 188 LOLUNIT_ASSERT_DOUBLES_EQUAL(far, tc.GetFar(), 1.e5f); 186 LOLUNIT_ASSERT(is_shifted != tc.IsShifted());189 LOLUNIT_ASSERT(is_shifted == tc.IsShifted()); 187 190 } 188 191 };
Note: See TracChangeset
for help on using the changeset viewer.