[Change] Clean up the silly lighting direction picking.

This commit is contained in:
Allanis 2017-11-22 21:55:36 +00:00
parent cb28ed344b
commit f498e9863c
3 changed files with 7 additions and 35 deletions

View File

@ -47,4 +47,5 @@
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)>(y)?(x):(y))
#define CLAMP(a, min, max) (((a) > (max)) ? (max) : (((a) < (min)) ? (min) : (a)))
#define DEG_2_RAD 0.0174532925

View File

@ -130,22 +130,13 @@ void ModelBody::RenderSbreModel(const Frame* camFrame, int model, ObjParams* par
/* TODO Reduce. */
glPushAttrib(GL_ALL_ATTRIB_BITS);
{
/* TODO Need to use correct starlight colour. */
float lightCol[3] = { 1,1,1 };
float lightDir[3];
vector3d _lightDir = Frame::GetFramePosRelativeToOther(Space::GetRootFrame(), camFrame);
matrix4x4d poo = L3D::world_view->viewingRotation;
poo[2] = -poo[2];
poo[6] = -poo[6];
poo[8] = -poo[8];
poo[9] = -poo[9];
_lightDir = poo*_lightDir;
lightDir[0] = _lightDir.x;
lightDir[1] = _lightDir.y;
lightDir[2] = _lightDir.z;
GLfloat lightCol[4];
glGetLightfv(GL_LIGHT0, GL_DIFFUSE, lightCol);
lightCol[3] = 0;
GLfloat lightDir[4];
glGetLightfv(GL_LIGHT0, GL_POSITION, lightDir);
lightDir[2] = -lightDir[2];
sbreSetDirLight(lightCol, lightDir);
}

View File

@ -14,26 +14,6 @@ ObjectViewerView::ObjectViewerView(void) : View() {
Add(m_infoLabel, 2, 2);
}
#if 0
vector3d Player::GetExternalViewTranslation(void) {
vector3d p = vector3d(0, 0, m_external_view_dist);
p = matrix4x4d::RotateXMatrix(-DEG_2_RAD*m_external_view_rotx) * p;
p = matrix3x4d::RotateYMatrix(-DEG_2_RAD*m_external_view_roty) * p;
matrix4x4d m;
GetRotMatrix(m);
p = m*p;
//printf("%f,%f,%f\n", p.x, p.y, p.z);
return p;
}
void Player::ApplyExternalViewRotation(void) {
//glTranslatef(0, 0, m_external_view_dist);
glRotatef(-m_external_view_rotx, 1, 0, 0);
glRotatef(-m_external_view_roty, 0, 1, 0);
}
#endif
#define DEG_2_RAD 0.0174532925
void ObjectViewerView::Draw3D(void) {
static float rot;
rot += 0.1;