Engine::pickObjects() calculating the correct ray direction now
git-svn-id: svn://anubis/anaglym/trunk@251 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
0ec9d0e74d
commit
f230fb648b
18
Engine.cc
18
Engine.cc
@ -111,7 +111,7 @@ Engine::Engine(const string & path, Video & video)
|
||||
m_engine_cursor_visible = m_video.getCursorVisible();
|
||||
m_script_cursor_visible = false;
|
||||
m_input_grabbed = m_video.getInputGrabbed();
|
||||
m_screen_dist = (m_video.getWidth() / 2.0) / tan(30.0 * M_PI / 180.0);
|
||||
m_screen_dist = (m_video.getHeight() / 2.0) / tan(30.0 * M_PI / 180.0);
|
||||
|
||||
size_t pos = path.find_last_of("\\/");
|
||||
m_engine_path = (pos != string::npos) ? string(path, 0, pos) : ".";
|
||||
@ -652,7 +652,8 @@ refptr< vector<int> > Engine::pickObjects(int x, int y)
|
||||
initial_direction[0] = x - m_video.getWidth() / 2;
|
||||
initial_direction[1] = m_screen_dist;
|
||||
initial_direction[2] = m_video.getHeight() / 2 - y;
|
||||
dMultiply0(rotated_direction, initial_direction, r, 1, 3, 3);
|
||||
//dMultiply0(rotated_direction, initial_direction, r, 1, 3, 3);
|
||||
dMultiply0(rotated_direction, r, initial_direction, 3, 3, 1);
|
||||
|
||||
normalize(rotated_direction);
|
||||
/* TODO: finish */
|
||||
@ -662,9 +663,9 @@ refptr< vector<int> > Engine::pickObjects(int x, int y)
|
||||
{
|
||||
int o = addObject(false, false, OdeWorld::SPHERE, args);
|
||||
m_objects[o]->setPosition(
|
||||
m_center[0] + d * rotated_direction[0],
|
||||
m_center[1] + d * rotated_direction[1],
|
||||
m_center[2] + d * rotated_direction[2]);
|
||||
m_eye[0] + d * rotated_direction[0],
|
||||
m_eye[1] + d * rotated_direction[1],
|
||||
m_eye[2] + d * rotated_direction[2]);
|
||||
}
|
||||
|
||||
return new vector<int>();
|
||||
@ -1407,10 +1408,9 @@ void Engine::Object::render()
|
||||
dVector3 default_plane_direction = {0, 0, 1, 0};
|
||||
dVector3 default_x = {1, 0, 0, 0};
|
||||
dVector3 default_y = {0, 1, 0, 0};
|
||||
dMultiply0(normal, default_plane_direction,
|
||||
r, 1, 3, 3);
|
||||
dMultiply0(rotated_x, default_x, r, 1, 3, 3);
|
||||
dMultiply0(rotated_y, default_y, r, 1, 3, 3);
|
||||
dMultiply0(normal, r, default_plane_direction, 3, 3, 1);
|
||||
dMultiply0(rotated_x, r, default_x, 3, 3, 1);
|
||||
dMultiply0(rotated_y, r, default_y, 3, 3, 1);
|
||||
x_o = (*m_args)[0];
|
||||
y_o = (*m_args)[1];
|
||||
z_o = (*m_args)[2];
|
||||
|
Loading…
x
Reference in New Issue
Block a user