mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
use glm instead of Math3D in rendering
This commit is contained in:
@@ -47,9 +47,6 @@ public:
|
||||
inline
|
||||
bool
|
||||
point_inside( float3 const &Point ) const { return point_inside( Point.x, Point.y, Point.z ); }
|
||||
inline
|
||||
bool
|
||||
point_inside( Math3D::vector3 const &Point ) const { return point_inside( static_cast<float>( Point.x ), static_cast<float>( Point.y ), static_cast<float>( Point.z ) ); }
|
||||
bool
|
||||
point_inside( float const X, float const Y, float const Z ) const;
|
||||
// tests if the sphere is in frustum, returns the distance between origin and sphere centre
|
||||
@@ -62,9 +59,6 @@ public:
|
||||
inline
|
||||
float
|
||||
sphere_inside( float3 const &Center, float const Radius ) const { return sphere_inside( Center.x, Center.y, Center.z, Radius ); }
|
||||
inline
|
||||
float
|
||||
sphere_inside( Math3D::vector3 const &Center, float const Radius ) const { return sphere_inside( static_cast<float>( Center.x ), static_cast<float>( Center.y ), static_cast<float>( Center.z ), Radius ); }
|
||||
float
|
||||
sphere_inside( float const X, float const Y, float const Z, float const Radius ) const;
|
||||
// returns true if specified cube is inside of the frustum. Size = half of the length
|
||||
@@ -74,9 +68,6 @@ public:
|
||||
inline
|
||||
bool
|
||||
cube_inside( float3 const &Center, float const Size ) const { return cube_inside( Center.x, Center.y, Center.z, Size ); }
|
||||
inline
|
||||
bool
|
||||
cube_inside( Math3D::vector3 const &Center, float const Size ) const { return cube_inside( static_cast<float>( Center.x ), static_cast<float>( Center.y ), static_cast<float>( Center.z ), Size ); }
|
||||
bool
|
||||
cube_inside( float const X, float const Y, float const Z, float const Size ) const;
|
||||
|
||||
|
||||
@@ -1266,7 +1266,7 @@ bool opengl33_renderer::Render_coupler_adapter( TDynamicObject *Dynamic, float c
|
||||
|
||||
if( Dynamic->m_coupleradapters[ End ] == nullptr ) { return false; }
|
||||
|
||||
auto const position { Math3D::vector3 {
|
||||
auto const position { glm::dvec3 {
|
||||
0.f,
|
||||
Dynamic->MoverParameters->Couplers[ End ].adapter_height,
|
||||
( Dynamic->MoverParameters->Couplers[ End ].adapter_length + Dynamic->MoverParameters->Dim.L * 0.5 ) * ( End == end::front ? 1 : -1 ) } };
|
||||
@@ -2681,7 +2681,7 @@ void opengl33_renderer::Render(scene::shape_node const &Shape, bool const Ignore
|
||||
case rendermode::shadows:
|
||||
{
|
||||
// 'camera' for the light pass is the light source, but we need to draw what the 'real' camera sees
|
||||
distancesquared = Math3D::SquareMagnitude((data.area.center - m_renderpass.viewport_camera.position()) / (double)Global.ZoomFactor) / Global.fDistanceFactor;
|
||||
distancesquared = glm::length2((data.area.center - m_renderpass.viewport_camera.position()) / (double)Global.ZoomFactor) / Global.fDistanceFactor;
|
||||
break;
|
||||
}
|
||||
case rendermode::reflections:
|
||||
@@ -3105,9 +3105,9 @@ bool opengl33_renderer::Render(TModel3d *Model, material_data const *Material, f
|
||||
return true;
|
||||
}
|
||||
|
||||
bool opengl33_renderer::Render(TModel3d *Model, material_data const *Material, float const Squaredistance, Math3D::vector3 const &Position, glm::vec3 const &A)
|
||||
bool opengl33_renderer::Render(TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &A)
|
||||
{
|
||||
Math3D::vector3 Angle(A);
|
||||
glm::dvec3 Angle(A); // TODO: Why copy?
|
||||
::glPushMatrix();
|
||||
::glTranslated(Position.x, Position.y, Position.z);
|
||||
if (Angle.y != 0.0)
|
||||
@@ -3980,9 +3980,9 @@ bool opengl33_renderer::Render_Alpha(TModel3d *Model, material_data const *Mater
|
||||
return true;
|
||||
}
|
||||
|
||||
bool opengl33_renderer::Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance, Math3D::vector3 const &Position, glm::vec3 const &A)
|
||||
bool opengl33_renderer::Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &A)
|
||||
{
|
||||
Math3D::vector3 Angle(A);
|
||||
glm::dvec3 Angle(A); // TODO: Why copy?
|
||||
::glPushMatrix();
|
||||
::glTranslated(Position.x, Position.y, Position.z);
|
||||
if (Angle.y != 0.0)
|
||||
|
||||
@@ -261,7 +261,7 @@ class opengl33_renderer : public gfx_renderer {
|
||||
void Render(scene::shape_node const &Shape, bool const Ignorerange);
|
||||
void Render(TAnimModel *Instance);
|
||||
bool Render(TDynamicObject *Dynamic);
|
||||
bool Render(TModel3d *Model, material_data const *Material, float const Squaredistance, Math3D::vector3 const &Position, glm::vec3 const &Angle);
|
||||
bool Render(TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle);
|
||||
bool Render(TModel3d *Model, material_data const *Material, float const Squaredistance);
|
||||
void Render(TSubModel *Submodel);
|
||||
void Render(TTrack *Track);
|
||||
@@ -280,7 +280,7 @@ class opengl33_renderer : public gfx_renderer {
|
||||
void Render_Alpha(TTraction *Traction);
|
||||
void Render_Alpha(scene::lines_node const &Lines);
|
||||
bool Render_Alpha(TDynamicObject *Dynamic);
|
||||
bool Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance, Math3D::vector3 const &Position, glm::vec3 const &Angle);
|
||||
bool Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle);
|
||||
bool Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance);
|
||||
void Render_Alpha(TSubModel *Submodel);
|
||||
void Update_Lights(light_array &Lights);
|
||||
|
||||
@@ -867,7 +867,7 @@ bool opengl_renderer::Render_coupler_adapter( TDynamicObject *Dynamic, float con
|
||||
|
||||
if( Dynamic->m_coupleradapters[ End ] == nullptr ) { return false; }
|
||||
|
||||
auto const position { Math3D::vector3 {
|
||||
auto const position { glm::dvec3 {
|
||||
0.f,
|
||||
Dynamic->MoverParameters->Couplers[ End ].adapter_height,
|
||||
( Dynamic->MoverParameters->Couplers[ End ].adapter_length + Dynamic->MoverParameters->Dim.L * 0.5 ) * ( End == end::front ? 1 : -1 ) } };
|
||||
@@ -2277,7 +2277,7 @@ opengl_renderer::Render( scene::shape_node const &Shape, bool const Ignorerange
|
||||
case rendermode::shadows:
|
||||
case rendermode::cabshadows: {
|
||||
// 'camera' for the light pass is the light source, but we need to draw what the 'real' camera sees
|
||||
distancesquared = Math3D::SquareMagnitude( ( data.area.center - Global.pCamera.Pos ) / (double)Global.ZoomFactor ) / Global.fDistanceFactor;
|
||||
distancesquared = glm::length2( ( data.area.center - Global.pCamera.Pos ) / (double)Global.ZoomFactor ) / Global.fDistanceFactor;
|
||||
break;
|
||||
}
|
||||
case rendermode::reflections: {
|
||||
@@ -2696,7 +2696,7 @@ opengl_renderer::Render( TModel3d *Model, material_data const *Material, float c
|
||||
}
|
||||
|
||||
bool
|
||||
opengl_renderer::Render( TModel3d *Model, material_data const *Material, float const Squaredistance, Math3D::vector3 const &Position, glm::vec3 const &Angle ) {
|
||||
opengl_renderer::Render( TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle ) {
|
||||
|
||||
::glPushMatrix();
|
||||
::glTranslated( Position.x, Position.y, Position.z );
|
||||
@@ -3505,7 +3505,7 @@ opengl_renderer::Render_Alpha( TAnimModel *Instance ) {
|
||||
switch( m_renderpass.draw_mode ) {
|
||||
case rendermode::shadows: {
|
||||
// 'camera' for the light pass is the light source, but we need to draw what the 'real' camera sees
|
||||
distancesquared = Math3D::SquareMagnitude( ( Instance->location() - Global.pCamera.Pos ) / (double)Global.ZoomFactor ) / Global.fDistanceFactor;
|
||||
distancesquared = glm::length2( ( Instance->location() - Global.pCamera.Pos ) / (double)Global.ZoomFactor ) / Global.fDistanceFactor;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -3549,7 +3549,7 @@ opengl_renderer::Render_Alpha( TTraction *Traction ) {
|
||||
switch( m_renderpass.draw_mode ) {
|
||||
case rendermode::shadows: {
|
||||
// 'camera' for the light pass is the light source, but we need to draw what the 'real' camera sees
|
||||
distancesquared = Math3D::SquareMagnitude( ( Traction->location() - Global.pCamera.Pos ) / Global.ZoomFactor ) / Global.fDistanceFactor;
|
||||
distancesquared = glm::length2( ( Traction->location() - Global.pCamera.Pos ) / Global.ZoomFactor ) / Global.fDistanceFactor;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -3613,7 +3613,7 @@ opengl_renderer::Render_Alpha( scene::lines_node const &Lines ) {
|
||||
switch( m_renderpass.draw_mode ) {
|
||||
case rendermode::shadows: {
|
||||
// 'camera' for the light pass is the light source, but we need to draw what the 'real' camera sees
|
||||
distancesquared = Math3D::SquareMagnitude( ( data.area.center - Global.pCamera.Pos ) / Global.ZoomFactor ) / Global.fDistanceFactor;
|
||||
distancesquared = glm::length2( ( data.area.center - Global.pCamera.Pos ) / Global.ZoomFactor ) / Global.fDistanceFactor;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -3769,7 +3769,7 @@ opengl_renderer::Render_Alpha( TModel3d *Model, material_data const *Material, f
|
||||
}
|
||||
|
||||
bool
|
||||
opengl_renderer::Render_Alpha( TModel3d *Model, material_data const *Material, float const Squaredistance, Math3D::vector3 const &Position, glm::vec3 const &Angle ) {
|
||||
opengl_renderer::Render_Alpha( TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle ) {
|
||||
|
||||
::glPushMatrix();
|
||||
::glTranslated( Position.x, Position.y, Position.z );
|
||||
|
||||
@@ -223,7 +223,7 @@ private:
|
||||
bool
|
||||
Render( TDynamicObject *Dynamic );
|
||||
bool
|
||||
Render( TModel3d *Model, material_data const *Material, float const Squaredistance, Math3D::vector3 const &Position, glm::vec3 const &Angle );
|
||||
Render( TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle );
|
||||
bool
|
||||
Render( TModel3d *Model, material_data const *Material, float const Squaredistance );
|
||||
void
|
||||
@@ -259,7 +259,7 @@ private:
|
||||
bool
|
||||
Render_Alpha( TDynamicObject *Dynamic );
|
||||
bool
|
||||
Render_Alpha( TModel3d *Model, material_data const *Material, float const Squaredistance, Math3D::vector3 const &Position, glm::vec3 const &Angle );
|
||||
Render_Alpha( TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle );
|
||||
bool
|
||||
Render_Alpha( TModel3d *Model, material_data const *Material, float const Squaredistance );
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user