[Change] Clean up the silly lighting direction picking.
This commit is contained in:
parent
fdaea7190d
commit
e8d67b6f02
@ -47,4 +47,5 @@
|
|||||||
#define MIN(x,y) ((x)<(y)?(x):(y))
|
#define MIN(x,y) ((x)<(y)?(x):(y))
|
||||||
#define MAX(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 CLAMP(a, min, max) (((a) > (max)) ? (max) : (((a) < (min)) ? (min) : (a)))
|
||||||
|
#define DEG_2_RAD 0.0174532925
|
||||||
|
|
||||||
|
@ -130,22 +130,13 @@ void ModelBody::RenderSbreModel(const Frame* camFrame, int model, ObjParams* par
|
|||||||
/* TODO Reduce. */
|
/* TODO Reduce. */
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||||
{
|
{
|
||||||
/* TODO Need to use correct starlight colour. */
|
GLfloat lightCol[4];
|
||||||
float lightCol[3] = { 1,1,1 };
|
glGetLightfv(GL_LIGHT0, GL_DIFFUSE, lightCol);
|
||||||
float lightDir[3];
|
lightCol[3] = 0;
|
||||||
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 lightDir[4];
|
||||||
|
glGetLightfv(GL_LIGHT0, GL_POSITION, lightDir);
|
||||||
|
lightDir[2] = -lightDir[2];
|
||||||
sbreSetDirLight(lightCol, lightDir);
|
sbreSetDirLight(lightCol, lightDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,26 +14,6 @@ ObjectViewerView::ObjectViewerView(void) : View() {
|
|||||||
Add(m_infoLabel, 2, 2);
|
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) {
|
void ObjectViewerView::Draw3D(void) {
|
||||||
static float rot;
|
static float rot;
|
||||||
rot += 0.1;
|
rot += 0.1;
|
||||||
|
Loading…
Reference in New Issue
Block a user