Changeset 1079
- Timestamp:
- Nov 20, 2011, 2:39:23 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/tutorial/tut03.cpp
r1078 r1079 73 73 } 74 74 m_center = -0.75; 75 m_zoom_speed = 0.0; 75 76 m_radius = 5.0; 76 77 m_ready = false; … … 155 156 ivec3 buttons = Input::GetMouseButtons(); 156 157 #ifdef __CELLOS_LV2__ 157 if (true)158 m_zoom_speed = 0.0005; 158 159 #else 159 160 if ((buttons[0] || buttons[2]) && mousepos.x != -1) 160 #endif 161 { 162 double zoom = buttons[0] ? -0.0005 : 0.0005; 163 m_zoom_speed += deltams * zoom; 164 if (m_zoom_speed / zoom > 5) 165 m_zoom_speed = 5 * zoom; 166 } 167 else if (m_zoom_speed) 168 { 169 m_zoom_speed *= pow(2.0, -deltams * 0.005); 170 if (abs(m_zoom_speed) < 1e-5) 171 m_zoom_speed = 0.0; 172 } 173 #endif 174 175 if (m_zoom_speed) 161 176 { 162 177 f64cmplx oldcenter = m_center; 163 178 double oldradius = m_radius; 164 #ifdef __CELLOS_LV2__ 165 m_radius *= pow(2.0, -deltams * 0.00005); 166 m_center = f64cmplx(-.22815528839841, -1.11514249704382); 167 //m_center = f64cmplx(0.001643721971153, 0.822467633298876); 168 #else 169 double zoom = pow(2.0, (buttons[0] ? -deltams : deltams) * 0.0025); 179 double zoom = pow(2.0, deltams * m_zoom_speed); 170 180 if (m_radius * zoom > 8.0) 171 181 zoom = 8.0 / m_radius; … … 173 183 zoom = 1e-14 / m_radius; 174 184 m_radius *= zoom; 185 #ifdef __CELLOS_LV2__ 186 m_center = f64cmplx(-.22815528839841, -1.11514249704382); 187 //m_center = f64cmplx(0.001643721971153, 0.822467633298876); 188 #else 175 189 m_center = (m_center - worldmouse) * zoom + worldmouse; 176 190 worldmouse = m_center + ScreenToWorldOffset(mousepos); … … 574 588 575 589 f64cmplx m_center; 576 double m_ radius;590 double m_zoom_speed, m_radius; 577 591 vec4 m_texel_settings; 578 592 mat4 m_zoom_settings;
Note: See TracChangeset
for help on using the changeset viewer.