16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 11:39:19 +02:00

working vehicle spotlights

This commit is contained in:
tmj-fstate
2017-02-25 21:02:27 +01:00
parent 259e9042e1
commit 493340e602
11 changed files with 353 additions and 184 deletions

View File

@@ -24,7 +24,7 @@ struct opengl_light {
opengl_light() {
position[ 0 ] = position[ 1 ] = position[ 2 ] = 0.0f; position[ 3 ] = 1.0f;
ambient[ 0 ] = ambient[ 1 ] = ambient[ 2 ] = ambient[ 3 ] = 1.0f;
ambient[ 0 ] = ambient[ 1 ] = ambient[ 2 ] = 0.0f; ambient[ 3 ] = 1.0f;
diffuse[ 0 ] = diffuse[ 1 ] = diffuse[ 2 ] = diffuse[ 3 ] = 1.0f;
specular[ 0 ] = specular[ 1 ] = specular[ 2 ] = specular[ 3 ] = 1.0f;
}
@@ -45,6 +45,13 @@ struct opengl_light {
glLightfv( id, GL_SPOT_DIRECTION, directionarray );
}
}
inline
void set_position( Math3D::vector3 const &Position ) {
position[ 0 ] = Position.x;
position[ 1 ] = Position.y;
position[ 2 ] = Position.z;
}
};
// encapsulates basic rendering setup.
@@ -66,7 +73,8 @@ class opengl_renderer {
public:
GLenum static const sunlight{ GL_LIGHT0 };
// GLenum static const ambientlight{ GL_LIGHT1 };
GLenum static const vehiclelight{ GL_LIGHT1 };
GLenum static const vehiclelightrear{ GL_LIGHT2 };
texture_manager::size_type
GetTextureId( std::string Filename, std::string const &Dir, int const Filter = -1, bool const Loadnow = true ) {