[Change] More rotating frame work. Looks pretty nice now..
This commit is contained in:
parent
5f51ee9cb1
commit
a66869c16f
16
src/main.cpp
16
src/main.cpp
@ -195,22 +195,22 @@ void L3D::MainLoop(void) {
|
|||||||
const float zpos = EARTH_RADIUS * 1;
|
const float zpos = EARTH_RADIUS * 1;
|
||||||
Frame* pframe = *(Space::rootFrame->m_children.begin());
|
Frame* pframe = *(Space::rootFrame->m_children.begin());
|
||||||
|
|
||||||
|
Frame* stationFrame = new Frame(pframe, "Station frame..");
|
||||||
|
stationFrame->SetRadius(5000);
|
||||||
|
stationFrame->sBody = 0;
|
||||||
|
stationFrame->SetPosition(vector3d(0, 0, zpos));
|
||||||
|
stationFrame->SetAngVelocity(vector3d(0,0,0.5));
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++) {
|
for(int i = 0; i < 4; i++) {
|
||||||
Ship* body = new Ship(ShipType::SLEEK/*LADYBIRD*/);
|
Ship* body = new Ship(ShipType::SLEEK/*LADYBIRD*/);
|
||||||
char buf[64];
|
char buf[64];
|
||||||
snprintf(buf, sizeof(buf), "X%c-0%02d", "A"+i, i);
|
snprintf(buf, sizeof(buf), "X%c-0%02d", "A"+i, i);
|
||||||
body->SetLabel(buf);
|
body->SetLabel(buf);
|
||||||
body->SetFrame(pframe);
|
body->SetFrame(stationFrame);
|
||||||
body->SetPosition(vector3d(i*2000, zpos*0.1, zpos+1000));
|
body->SetPosition(vector3d(200*(i+1), 0, 2000));
|
||||||
Space::AddBody(body);
|
Space::AddBody(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame* stationFrame = new Frame(pframe, "Station frame...");
|
|
||||||
stationFrame->SetRadius(5000);
|
|
||||||
stationFrame->sBody = 0;
|
|
||||||
stationFrame->SetPosition(vector3d(0,0,zpos));
|
|
||||||
stationFrame->SetAngVelocity(vector3d(0,0,0.5));
|
|
||||||
|
|
||||||
SpaceStation* station = new SpaceStation();
|
SpaceStation* station = new SpaceStation();
|
||||||
station->SetLabel("Poemi-chan's Folly");
|
station->SetLabel("Poemi-chan's Folly");
|
||||||
station->SetFrame(stationFrame);
|
station->SetFrame(stationFrame);
|
||||||
|
@ -100,22 +100,18 @@ void ModelBody::GetRotMatrix(matrix4x4d& m) {
|
|||||||
m.LoadFromOdeMatrix(dGeomGetRotation(geoms[0]));
|
m.LoadFromOdeMatrix(dGeomGetRotation(geoms[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelBody::ViewingRotation(void) {
|
|
||||||
matrix4x4d m;
|
|
||||||
GetRotMatrix(m);
|
|
||||||
m = m.InverseOf();
|
|
||||||
glMultMatrixd(&m[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelBody::TransformToModelCoords(const Frame* camFrame) {
|
void ModelBody::TransformToModelCoords(const Frame* camFrame) {
|
||||||
vector3d fpos = GetPositionRelTo(camFrame);
|
const vector3d pos = GetPosition();
|
||||||
|
|
||||||
const dReal* r = dGeomGetRotation(geoms[0]);
|
const dReal* r = dGeomGetRotation(geoms[0]);
|
||||||
matrix4x4d m;
|
matrix4x4d m;
|
||||||
|
|
||||||
|
Frame::GetFrameTransform(GetFrame(), camFrame, m);
|
||||||
|
glMultMatrixd(&m[0]);
|
||||||
|
|
||||||
m[ 0] = r[ 0]; m[ 1] = r[ 4]; m[ 2] = r[ 8]; m[ 3] = 0;
|
m[ 0] = r[ 0]; m[ 1] = r[ 4]; m[ 2] = r[ 8]; m[ 3] = 0;
|
||||||
m[ 4] = r[ 1]; m[ 5] = r[ 5]; m[ 6] = r[ 9]; m[ 7] = 0;
|
m[ 4] = r[ 1]; m[ 5] = r[ 5]; m[ 6] = r[ 9]; m[ 7] = 0;
|
||||||
m[ 8] = r[ 2]; m[ 9] = r[ 6]; m[10] = r[10]; m[11] = 0;
|
m[ 8] = r[ 2]; m[ 9] = r[ 6]; m[10] = r[10]; m[11] = 0;
|
||||||
m[12] = fpos.x; m[13] = fpos.y; m[14] = fpos.z; m[15] = 1;
|
m[12] = pos.x; m[13] = pos.y; m[14] = pos.z; m[15] = 1;
|
||||||
glMultMatrixd(&m[0]);
|
glMultMatrixd(&m[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,11 +168,12 @@ void ModelBody::RenderSbreModel(const Frame* camFrame, int model, ObjParams* par
|
|||||||
Frame::GetFrameTransform(GetFrame(), camFrame, frameTrans);
|
Frame::GetFrameTransform(GetFrame(), camFrame, frameTrans);
|
||||||
|
|
||||||
vector3d pos = GetPosition();
|
vector3d pos = GetPosition();
|
||||||
pos = L3D::world_view->viewingRotation * frameTrans * pos;
|
pos = frameTrans * pos;
|
||||||
Vector p; p.x = pos.x; p.y = pos.y; p.z = -pos.z;
|
Vector p; p.x = pos.x; p.y = pos.y; p.z = -pos.z;
|
||||||
matrix4x4d rot;
|
matrix4x4d rot;
|
||||||
rot.LoadFromOdeMatrix(dGeomGetRotation(geoms[0]));
|
rot.LoadFromOdeMatrix(dGeomGetRotation(geoms[0]));
|
||||||
rot = L3D::world_view->viewingRotation * frameTrans * rot;
|
frameTrans.ClearToRotOnly();
|
||||||
|
rot = frameTrans * rot;
|
||||||
Matrix m;
|
Matrix m;
|
||||||
m.x1 = rot[0]; m.x2 = rot[4]; m.x3 = -rot[8];
|
m.x1 = rot[0]; m.x2 = rot[4]; m.x3 = -rot[8];
|
||||||
m.y1 = rot[1]; m.y2 = rot[5]; m.y3 = -rot[9];
|
m.y1 = rot[1]; m.y2 = rot[5]; m.y3 = -rot[9];
|
||||||
|
@ -17,7 +17,6 @@ public:
|
|||||||
vector3d GetPosition(void);
|
vector3d GetPosition(void);
|
||||||
virtual double GetRadius(void) const;
|
virtual double GetRadius(void) const;
|
||||||
void TransformToModelCoords(const Frame* camFrame);
|
void TransformToModelCoords(const Frame* camFrame);
|
||||||
void ViewingRotation(void);
|
|
||||||
void GetRotMatrix(matrix4x4d& m);
|
void GetRotMatrix(matrix4x4d& m);
|
||||||
virtual void SetFrame(Frame* f);
|
virtual void SetFrame(Frame* f);
|
||||||
void GeomsSetBody(dBodyID body);
|
void GeomsSetBody(dBodyID body);
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
ObjectViewerView::ObjectViewerView(void) : View() {
|
ObjectViewerView::ObjectViewerView(void) : View() {
|
||||||
SetTransparency(true);
|
SetTransparency(true);
|
||||||
viewingRotation = matrix4x4d::Identity();
|
|
||||||
viewingDist = 1000.0f;
|
viewingDist = 1000.0f;
|
||||||
|
|
||||||
m_infoLabel = new Gui::Label("");
|
m_infoLabel = new Gui::Label("");
|
||||||
@ -26,27 +25,18 @@ void ObjectViewerView::Draw3D(void) {
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
vector3d pos = vector3d(0, 0, viewingDist);
|
matrix4x4d camRot;
|
||||||
//p = matrix4x4d::RotateXMatrix(-DEG_2_RAD*m_external_view_rotx) * p;
|
camRot = matrix4x4d::RotateXMatrix(-DEG2RAD(rot));
|
||||||
pos = matrix4x4d::RotateYMatrix(-DEG_2_RAD*rot) * pos;
|
camRot = matrix4x4d::RotateYMatrix(-DEG2RAD(rot)) * camRot;
|
||||||
pos = matrix4x4d::RotateXMatrix(-DEG_2_RAD*rot) * pos;
|
vector3d pos = camRot * vector3d(0,0,viewingDist);
|
||||||
|
|
||||||
float lightPos[4];
|
float lightPos[4] = { 1, 1, 1, 0 };
|
||||||
lightPos[0] = 1;
|
|
||||||
lightPos[1] = 1;
|
|
||||||
lightPos[2] = 1;
|
|
||||||
lightPos[3] = 0;
|
|
||||||
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
|
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
|
||||||
|
|
||||||
/* SBRE rendering (See ModelBody.cpp) uses this.. */
|
|
||||||
glRotatef(-rot, 0, 1, 0);
|
|
||||||
glRotatef(-rot, 1, 0, 0);
|
|
||||||
//L3D::world_view->viewingRotation = matrix4x4d::Identity();
|
|
||||||
glGetDoublev(GL_MODELVIEW_MATRIX, &L3D::world_view->viewingRotation[0]);
|
|
||||||
|
|
||||||
Body* body = L3D::player->GetNavTarget();
|
Body* body = L3D::player->GetNavTarget();
|
||||||
if(body) {
|
if(body) {
|
||||||
Frame cam_frame(body->GetFrame(), "", Frame::TEMP_VIEWING);
|
Frame cam_frame(body->GetFrame(), "", Frame::TEMP_VIEWING);
|
||||||
|
cam_frame.SetOrientation(camRot);
|
||||||
cam_frame.SetPosition(body->GetPosition()+pos);
|
cam_frame.SetPosition(body->GetPosition()+pos);
|
||||||
body->Render(&cam_frame);
|
body->Render(&cam_frame);
|
||||||
body->GetFrame()->RemoveChild(&cam_frame);
|
body->GetFrame()->RemoveChild(&cam_frame);
|
||||||
|
@ -11,7 +11,6 @@ public:
|
|||||||
virtual void Update(void);
|
virtual void Update(void);
|
||||||
virtual void Draw3D(void);
|
virtual void Draw3D(void);
|
||||||
private:
|
private:
|
||||||
matrix4x4d viewingRotation;
|
|
||||||
float viewingDist;
|
float viewingDist;
|
||||||
Gui::Label* m_infoLabel;
|
Gui::Label* m_infoLabel;
|
||||||
const Body* lastTarget;
|
const Body* lastTarget;
|
||||||
|
@ -831,7 +831,9 @@ void Planet::Render(const Frame* a_camFrame) {
|
|||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
double rad = sbody.GetRadius();
|
double rad = sbody.GetRadius();
|
||||||
vector3d fpos = GetPositionRelTo(a_camFrame);
|
matrix4x4d ftran;
|
||||||
|
Frame::GetFrameTransform(GetFrame(), a_camFrame, ftran);
|
||||||
|
vector3d fpos = ftran * GetPosition();
|
||||||
|
|
||||||
double apparent_size = rad / fpos.Length();
|
double apparent_size = rad / fpos.Length();
|
||||||
double len = fpos.Length();
|
double len = fpos.Length();
|
||||||
@ -845,6 +847,9 @@ void Planet::Render(const Frame* a_camFrame) {
|
|||||||
glTranslatef(fpos.x, fpos.y, fpos.z);
|
glTranslatef(fpos.x, fpos.y, fpos.z);
|
||||||
glColor3f(1, 1, 1);
|
glColor3f(1, 1, 1);
|
||||||
|
|
||||||
|
ftran.ClearToRotOnly();
|
||||||
|
glMultMatrixd(&ftran[0]);
|
||||||
|
|
||||||
if(apparent_size < 0.001) {
|
if(apparent_size < 0.001) {
|
||||||
if(crudDList) {
|
if(crudDList) {
|
||||||
glDeleteLists(crudDList, 1);
|
glDeleteLists(crudDList, 1);
|
||||||
@ -873,6 +878,8 @@ void Planet::Render(const Frame* a_camFrame) {
|
|||||||
glCallList(crudDList);
|
glCallList(crudDList);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
fpos = ftran.InverseOf() * fpos;
|
||||||
|
|
||||||
DrawAtmosphere(rad, fpos);
|
DrawAtmosphere(rad, fpos);
|
||||||
|
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#include "world_view.h"
|
#include "world_view.h"
|
||||||
#include "space_station_view.h"
|
#include "space_station_view.h"
|
||||||
|
|
||||||
#define DEG_2_RAD 0.0174532925
|
|
||||||
|
|
||||||
Player::Player(ShipType::Type shipType) : Ship(shipType) {
|
Player::Player(ShipType::Type shipType) : Ship(shipType) {
|
||||||
m_external_view_rotx = m_external_view_roty = 0;
|
m_external_view_rotx = m_external_view_roty = 0;
|
||||||
m_external_view_dist = 200;
|
m_external_view_dist = 200;
|
||||||
@ -27,7 +25,6 @@ void Player::Render(const Frame* camFrame) {
|
|||||||
} else {
|
} else {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
/* Could only rotate, since transform is zero (camFrame is at player origin). */
|
/* Could only rotate, since transform is zero (camFrame is at player origin). */
|
||||||
TransformToModelCoords(camFrame);
|
|
||||||
RenderLaserfire();
|
RenderLaserfire();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
@ -42,8 +39,8 @@ void Player::SetDockedWith(SpaceStation* s) {
|
|||||||
|
|
||||||
vector3d Player::GetExternalViewTranslation(void) {
|
vector3d Player::GetExternalViewTranslation(void) {
|
||||||
vector3d p = vector3d(0, 0, m_external_view_dist);
|
vector3d p = vector3d(0, 0, m_external_view_dist);
|
||||||
p = matrix4x4d::RotateXMatrix(-DEG_2_RAD*m_external_view_rotx) * p;
|
p = matrix4x4d::RotateXMatrix(-DEG2RAD(m_external_view_rotx)) * p;
|
||||||
p = matrix4x4d::RotateYMatrix(-DEG_2_RAD*m_external_view_roty) * p;
|
p = matrix4x4d::RotateYMatrix(-DEG2RAD(m_external_view_roty)) * p;
|
||||||
matrix4x4d m;
|
matrix4x4d m;
|
||||||
GetRotMatrix(m);
|
GetRotMatrix(m);
|
||||||
p = m*p;
|
p = m*p;
|
||||||
@ -51,10 +48,9 @@ vector3d Player::GetExternalViewTranslation(void) {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::ApplyExternalViewRotation(void) {
|
void Player::ApplyExternalViewRotation(matrix4x4d& m) {
|
||||||
//glTranslatef(0, 0, m_external_view_dist);
|
m = matrix4x4d::RotateXMatrix(-DEG2RAD(m_external_view_rotx)) * m;
|
||||||
glRotatef(-m_external_view_rotx, 1, 0, 0);
|
m = matrix4x4d::RotateYMatrix(-DEG2RAD(m_external_view_roty)) * m;
|
||||||
glRotatef(-m_external_view_roty, 0, 1, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::TimeStepUpdate(const float timeStep) {
|
void Player::TimeStepUpdate(const float timeStep) {
|
||||||
@ -169,21 +165,16 @@ void Player::DrawHUD(const Frame* cam_frame) {
|
|||||||
glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
|
glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
|
||||||
glGetIntegerv(GL_VIEWPORT, viewport);
|
glGetIntegerv(GL_VIEWPORT, viewport);
|
||||||
|
|
||||||
const dReal* vel = dBodyGetLinearVel(m_body);
|
|
||||||
|
|
||||||
const matrix4x4d& rot = L3D::world_view->viewingRotation;
|
|
||||||
vector3d loc_v = rot*vector3d(vel[0], vel[1], vel[2]);
|
|
||||||
|
|
||||||
Gui::Screen::EnterOrtho();
|
Gui::Screen::EnterOrtho();
|
||||||
glColor3f(.7, .7, .7);
|
glColor3f(.7, .7, .7);
|
||||||
|
|
||||||
|
/* Object labels. */
|
||||||
{
|
{
|
||||||
for(std::list<Body*>::iterator i = Space::bodies.begin(); i != Space::bodies.end(); ++i) {
|
for(std::list<Body*>::iterator i = Space::bodies.begin(); i != Space::bodies.end(); ++i) {
|
||||||
if((L3D::GetCamType() != L3D::CAM_EXTERNAL) && (*i == this)) continue;
|
if((L3D::GetCamType() != L3D::CAM_EXTERNAL) && (*i == this)) continue;
|
||||||
Body* b = *i;
|
Body* b = *i;
|
||||||
vector3d _pos = b->GetPositionRelTo(cam_frame);
|
vector3d _pos = b->GetPositionRelTo(cam_frame);
|
||||||
vector3d cam_coord = rot*_pos;
|
if(_pos.z < 0
|
||||||
if(cam_coord.z < 0
|
|
||||||
&& Gui::Screen::Project(_pos.x,_pos.y,_pos.z,modelMatrix,projMatrix,viewport,
|
&& Gui::Screen::Project(_pos.x,_pos.y,_pos.z,modelMatrix,projMatrix,viewport,
|
||||||
&_pos.x, &_pos.y, &_pos.z)) {
|
&_pos.x, &_pos.y, &_pos.z)) {
|
||||||
b->SetProjectedPos(_pos);
|
b->SetProjectedPos(_pos);
|
||||||
@ -196,13 +187,14 @@ void Player::DrawHUD(const Frame* cam_frame) {
|
|||||||
|
|
||||||
DrawTargetSquares();
|
DrawTargetSquares();
|
||||||
|
|
||||||
GLdouble pos[3];
|
/* Direction indicator. */
|
||||||
|
|
||||||
const float sz = HUD_CROSSHAIR_SIZE;
|
const float sz = HUD_CROSSHAIR_SIZE;
|
||||||
/* If velocity vector is in front ofus. Draw indicator. */
|
const dReal* vel = dBodyGetLinearVel(m_body);
|
||||||
|
vector3d loc_v = cam_frame->GetOrientation().InverseOf() * vector3d(vel[0], vel[1], vel[2]);
|
||||||
if(loc_v.z < 0) {
|
if(loc_v.z < 0) {
|
||||||
if(Gui::Screen::Project(vel[0],vel[1],vel[2], modelMatrix, projMatrix, viewport,
|
GLdouble pos[3];
|
||||||
&pos[0], &pos[1], &pos[2])) {
|
if(Gui::Screen::Project(loc_v[0], loc_v[1], loc_v[2], modelMatrix, projMatrix,
|
||||||
|
viewport, &pos[0], &pos[1], &pos[2])) {
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex2f(pos[0]-sz, pos[1]-sz);
|
glVertex2f(pos[0]-sz, pos[1]-sz);
|
||||||
glVertex2f(pos[0]-0.5*sz, pos[1]-0.5*sz);
|
glVertex2f(pos[0]-0.5*sz, pos[1]-0.5*sz);
|
||||||
@ -219,8 +211,8 @@ void Player::DrawHUD(const Frame* cam_frame) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Normal crosshairs. */
|
||||||
if(L3D::GetCamType() == L3D::CAM_FRONT) {
|
if(L3D::GetCamType() == L3D::CAM_FRONT) {
|
||||||
/* Normal crosshairs. */
|
|
||||||
float px = Gui::Screen::GetWidth()/2.0;
|
float px = Gui::Screen::GetWidth()/2.0;
|
||||||
float py = Gui::Screen::GetHeight()/2.0;
|
float py = Gui::Screen::GetHeight()/2.0;
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
void DrawHUD(const Frame* cam_frame);
|
void DrawHUD(const Frame* cam_frame);
|
||||||
virtual void SetDockedWith(SpaceStation*);
|
virtual void SetDockedWith(SpaceStation*);
|
||||||
vector3d GetExternalViewTranslation(void);
|
vector3d GetExternalViewTranslation(void);
|
||||||
void ApplyExternalViewRotation(void);
|
void ApplyExternalViewRotation(matrix4x4d &m);
|
||||||
void TimeStepUpdate(const float timeStep);
|
void TimeStepUpdate(const float timeStep);
|
||||||
private:
|
private:
|
||||||
void DrawTargetSquares();
|
void DrawTargetSquares();
|
||||||
|
18
src/ship.cpp
18
src/ship.cpp
@ -203,6 +203,13 @@ void Ship::SetCombatTarget(Body* const target) {
|
|||||||
L3D::world_view->UpdateCommsOptions();
|
L3D::world_view->UpdateCommsOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Ship::IsFiringLasers(void) {
|
||||||
|
for(int i = 0; i < ShipType::GUNMOUNT_MAX; i++) {
|
||||||
|
if(m_gunState[i]) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Assumed to be at model coords. */
|
/* Assumed to be at model coords. */
|
||||||
void Ship::RenderLaserfire(void) {
|
void Ship::RenderLaserfire(void) {
|
||||||
const ShipType& stype = GetShipType();
|
const ShipType& stype = GetShipType();
|
||||||
@ -265,10 +272,11 @@ void Ship::Render(const Frame* camFrame) {
|
|||||||
|
|
||||||
RenderSbreModel(camFrame, stype.sbreModel, ¶ms);
|
RenderSbreModel(camFrame, stype.sbreModel, ¶ms);
|
||||||
|
|
||||||
glPushMatrix();
|
if(IsFiringLasers()) {
|
||||||
TransformToModelCoords(camFrame);
|
glPushMatrix();
|
||||||
//render_coll_mesh(sbreCollMesh);
|
TransformToModelCoords(camFrame);
|
||||||
RenderLaserfire();
|
RenderLaserfire();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@ protected:
|
|||||||
enum ShipType::Type m_shipType;
|
enum ShipType::Type m_shipType;
|
||||||
Uint32 m_gunState[ShipType::GUNMOUNT_MAX];
|
Uint32 m_gunState[ShipType::GUNMOUNT_MAX];
|
||||||
private:
|
private:
|
||||||
|
bool IsFiringLasers(void);
|
||||||
|
|
||||||
float m_wheelState;
|
float m_wheelState;
|
||||||
float m_wheelTransition;
|
float m_wheelTransition;
|
||||||
|
|
||||||
|
@ -94,20 +94,33 @@ void WorldView::Draw3D(void) {
|
|||||||
/* Make temporary camera frame at player. */
|
/* Make temporary camera frame at player. */
|
||||||
Frame cam_frame(L3D::player->GetFrame(), "", Frame::TEMP_VIEWING);
|
Frame cam_frame(L3D::player->GetFrame(), "", Frame::TEMP_VIEWING);
|
||||||
|
|
||||||
|
matrix4x4d camRot = matrix4x4d::Identity();
|
||||||
|
|
||||||
if(L3D::GetCamType() == L3D::CAM_FRONT) {
|
if(L3D::GetCamType() == L3D::CAM_FRONT) {
|
||||||
cam_frame.SetPosition(L3D::player->GetPosition());
|
cam_frame.SetPosition(L3D::player->GetPosition());
|
||||||
} else if(L3D::GetCamType() == L3D::CAM_REAR) {
|
} else if(L3D::GetCamType() == L3D::CAM_REAR) {
|
||||||
glRotatef(180.0f, 0, 1, 0);
|
camRot.RotateY(M_PI);
|
||||||
|
//glRotatef(180.0f, 0, 1, 0);
|
||||||
cam_frame.SetPosition(L3D::player->GetPosition());
|
cam_frame.SetPosition(L3D::player->GetPosition());
|
||||||
} else { /* CAM_EXTERNAL */
|
} else { /* CAM_EXTERNAL */
|
||||||
cam_frame.SetPosition(L3D::player->GetPosition() + L3D::player->GetExternalViewTranslation());
|
cam_frame.SetPosition(L3D::player->GetPosition() + L3D::player->GetExternalViewTranslation());
|
||||||
L3D::player->ApplyExternalViewRotation();
|
L3D::player->ApplyExternalViewRotation(camRot);
|
||||||
}
|
}
|
||||||
L3D::player->ViewingRotation();
|
|
||||||
|
|
||||||
glGetDoublev(GL_MODELVIEW_MATRIX, &viewingRotation[0]);
|
{
|
||||||
|
matrix4x4d prot;
|
||||||
|
L3D::player->GetRotMatrix(prot);
|
||||||
|
camRot = prot * camRot;
|
||||||
|
}
|
||||||
|
cam_frame.SetOrientation(camRot);
|
||||||
|
|
||||||
|
matrix4x4d trans2bg;
|
||||||
|
Frame::GetFrameTransform(Space::GetRootFrame(), &cam_frame, trans2bg);
|
||||||
|
trans2bg.ClearToRotOnly();
|
||||||
|
glPushMatrix();
|
||||||
|
glMultMatrixd(&trans2bg[0]);
|
||||||
glCallList(m_bgstarsDlist);
|
glCallList(m_bgstarsDlist);
|
||||||
|
glPopMatrix();
|
||||||
/* Position light at sol. */
|
/* Position light at sol. */
|
||||||
matrix4x4d m;
|
matrix4x4d m;
|
||||||
Frame::GetFrameTransform(Space::GetRootFrame(), &cam_frame, m);
|
Frame::GetFrameTransform(Space::GetRootFrame(), &cam_frame, m);
|
||||||
|
@ -10,7 +10,6 @@ public:
|
|||||||
WorldView(void);
|
WorldView(void);
|
||||||
virtual void Update(void);
|
virtual void Update(void);
|
||||||
virtual void Draw3D(void);
|
virtual void Draw3D(void);
|
||||||
matrix4x4d viewingRotation;
|
|
||||||
static const float PICK_OBJECT_RECT_SIZE;
|
static const float PICK_OBJECT_RECT_SIZE;
|
||||||
void UpdateCommsOptions(void);
|
void UpdateCommsOptions(void);
|
||||||
bool GetShowLabels(void) { return labelsOn; }
|
bool GetShowLabels(void) { return labelsOn; }
|
||||||
|
Loading…
Reference in New Issue
Block a user