mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
use glm instead of Math3D in vehicle
WARNING: Model rotation is broken
This commit is contained in:
@@ -46,12 +46,12 @@ light_array::update() {
|
||||
if( light.index == end::front ) {
|
||||
// front light set
|
||||
light.position = light.owner->GetPosition() + ( light.owner->VectorFront() * ( std::max( 0.0, light.owner->GetLength() * 0.5 - 2.0 ) ) );// +( light.owner->VectorUp() * 0.25 );
|
||||
light.direction = glm::make_vec3( light.owner->VectorFront().getArray() );
|
||||
light.direction = glm::make_vec3( glm::value_ptr(light.owner->VectorFront()) ); // TODO: It is needed to get value_ptr and then make_vec3?
|
||||
}
|
||||
else {
|
||||
// rear light set
|
||||
light.position = light.owner->GetPosition() - ( light.owner->VectorFront() * ( std::max( 0.0, light.owner->GetLength() * 0.5 - 2.0 ) ) );// +( light.owner->VectorUp() * 0.25 );
|
||||
light.direction = glm::make_vec3( light.owner->VectorFront().getArray() );
|
||||
light.direction = glm::make_vec3( glm::value_ptr(light.owner->VectorFront()) ); // TODO: It is needed to get value_ptr and then make_vec3?
|
||||
light.direction.x = -light.direction.x;
|
||||
light.direction.z = -light.direction.z;
|
||||
}
|
||||
|
||||
@@ -1203,7 +1203,7 @@ bool opengl33_renderer::Render_lowpoly( TDynamicObject *Dynamic, float const Squ
|
||||
|
||||
::glPushMatrix();
|
||||
::glTranslated( originoffset.x, originoffset.y, originoffset.z );
|
||||
::glMultMatrixd( Dynamic->mMatrix.readArray() );
|
||||
::glMultMatrixd( glm::value_ptr(Dynamic->mMatrix) );
|
||||
}
|
||||
// HACK: reduce light level for vehicle interior if there's strong global lighting source
|
||||
if( false == Alpha ) {
|
||||
@@ -2890,7 +2890,7 @@ bool opengl33_renderer::Render(TDynamicObject *Dynamic)
|
||||
|
||||
::glPushMatrix();
|
||||
::glTranslated(originoffset.x, originoffset.y, originoffset.z);
|
||||
::glMultMatrixd(Dynamic->mMatrix.getArray());
|
||||
::glMultMatrixd(glm::value_ptr(Dynamic->mMatrix));
|
||||
|
||||
switch (m_renderpass.draw_mode)
|
||||
{
|
||||
@@ -3012,7 +3012,7 @@ bool opengl33_renderer::Render_cab(TDynamicObject const *Dynamic, float const Li
|
||||
|
||||
auto const originoffset = Dynamic->GetPosition() - m_renderpass.pass_camera.position();
|
||||
::glTranslated(originoffset.x, originoffset.y, originoffset.z);
|
||||
::glMultMatrixd(Dynamic->mMatrix.readArray());
|
||||
::glMultMatrixd(glm::value_ptr(Dynamic->mMatrix));
|
||||
|
||||
switch (m_renderpass.draw_mode)
|
||||
{
|
||||
@@ -3908,7 +3908,7 @@ bool opengl33_renderer::Render_Alpha(TDynamicObject *Dynamic)
|
||||
::glPushMatrix();
|
||||
|
||||
::glTranslated(originoffset.x, originoffset.y, originoffset.z);
|
||||
::glMultMatrixd(Dynamic->mMatrix.getArray());
|
||||
::glMultMatrixd(glm::value_ptr(Dynamic->mMatrix));
|
||||
|
||||
if (Dynamic->fShade > 0.0f)
|
||||
{
|
||||
@@ -4665,7 +4665,7 @@ void opengl33_renderer::Update_Lights(light_array &Lights)
|
||||
auto const offset{ 75.f * ( 5.f / cone ) };
|
||||
headlights.position() =
|
||||
scenelight.owner->GetPosition()
|
||||
- scenelight.direction * offset
|
||||
- glm::dvec3(scenelight.direction * offset)
|
||||
+ up * ( size * 0.5 );
|
||||
/*
|
||||
headlights.projection() = ortho_projection(
|
||||
|
||||
@@ -806,7 +806,7 @@ bool opengl_renderer::Render_lowpoly( TDynamicObject *Dynamic, float const Squar
|
||||
::glPushMatrix();
|
||||
|
||||
::glTranslated( originoffset.x, originoffset.y, originoffset.z );
|
||||
::glMultMatrixd( Dynamic->mMatrix.getArray() );
|
||||
::glMultMatrixd( glm::value_ptr(Dynamic->mMatrix) );
|
||||
|
||||
m_renderspecular = true; // vehicles are rendered with specular component. static models without, at least for the time being
|
||||
}
|
||||
@@ -2480,7 +2480,7 @@ opengl_renderer::Render( TDynamicObject *Dynamic ) {
|
||||
::glPushMatrix();
|
||||
|
||||
::glTranslated( originoffset.x, originoffset.y, originoffset.z );
|
||||
::glMultMatrixd( Dynamic->mMatrix.getArray() );
|
||||
::glMultMatrixd( glm::value_ptr(Dynamic->mMatrix) );
|
||||
|
||||
switch( m_renderpass.draw_mode ) {
|
||||
|
||||
@@ -2593,7 +2593,7 @@ opengl_renderer::Render_cab( TDynamicObject const *Dynamic, float const Lightlev
|
||||
|
||||
auto const originoffset = Dynamic->GetPosition() - m_renderpass.camera.position();
|
||||
::glTranslated( originoffset.x, originoffset.y, originoffset.z );
|
||||
::glMultMatrixd( Dynamic->mMatrix.readArray() );
|
||||
::glMultMatrixd( glm::value_ptr(Dynamic->mMatrix) );
|
||||
|
||||
switch( m_renderpass.draw_mode ) {
|
||||
case rendermode::color: {
|
||||
@@ -3675,7 +3675,7 @@ opengl_renderer::Render_Alpha( TDynamicObject *Dynamic ) {
|
||||
::glPushMatrix();
|
||||
|
||||
::glTranslated( originoffset.x, originoffset.y, originoffset.z );
|
||||
::glMultMatrixd( Dynamic->mMatrix.getArray() );
|
||||
::glMultMatrixd( glm::value_ptr(Dynamic->mMatrix) );
|
||||
|
||||
if( Dynamic->fShade > 0.0f ) {
|
||||
// change light level based on light level of the occupied track
|
||||
|
||||
Reference in New Issue
Block a user